Cannot ping nor SSH to VM

Hello Team,

I have a Windows 10 Laptop, I have created the VM for Centos following the Lab demo in the Virtualbox, I did follow steps to know the ip address, start the sshd service, then downloaded the Mobaxterm for Windows on my Laptop, opened the session menu, provided the IP from the ip addr in the remote host and the username osboxes, when I click OK their is an Connection timed out error.

I tried to ping the IP of the VM service (got via ip addr) and got an error “Destination host unreachable”.

Hi @rohitgaikwad
Kindly make sure that the sshd service is up and running using the following command:
sudo systemctl status sshd

Hello Team,

Thank you for replying, I did check for the status of sshd which is active and running; however the inet address is only for virbr01 and not for enp03 and enp08 where there is no IP address, could that be a reason, I am connected to internet via Wi-Fi.

I saw in the lecture that the IP address (INET) is assigned to the enp in my case it is not.

Thanks,
Rohit Gaikwad

@rohitgaikwad
Check the steps below to set a static IP

  1. By default that Network Card is configured to use NAT . ( communicate to the internet )

  2. What you can do is to add a Second Network Card which will be configured as HOST-ONLY + configure host only network. (to be able to communicate with your mac)

A. To create host only network go to that HIGHLIGHTED network and create vmboxnet0

B. Then you need to enable second network interface and point it to just created host only network vmboxnet0 .

C. Reboot Ubuntu and second interface will get IP address assigned.

D. After reboot check for that new IP address (ifconfig) and ssh to it. Don’t use root at first.

Hi @Ayman

I’m having the same issue. I’m using a windows 10 host. I followed the video setting the first network adapter as bridged adapter. I logged into the VM and no IP is set on the enp0s3. So I set an IP

sudo su
ip addr add 192.168.1.10 dev enp0s3

I still cannot ping the or ssh to the VM. ssh service is running

Any Help on this issue?

Hello,

Even I faced a similar issue, and have been able to solve it on my VM.

My ‘ip address’ output was similar:-


where we can see the dev enp0s3 did not have any ip address.

The nmcli command also showed the device to be down. I used the ifup command to get the interface up.

After the device was up, I was able to get the ip address on the dev enpps3.

I was also able to ping www.google.com successfully.

I was also able to connect using ssh from my host laptop to the guest centos.

Sincerely hope this helps.

Thanks,
Mashiur Rahman

3 Likes

Thanks alot @mashiurrahman this helped me. I can now connect via ssh

This worked! Thanks @mashiurrahman

How to make this persistant?

I have tried everything, but not able to connect to ssh using putty.

Please help.

  • Type nmtui in the terminal
  • Go to ‘edit connection’ and hit enter
  • Select ‘enp0s3’ and hit enter
  • Go down to ‘Automatically connect’ using down arrow key
  • Press space bar
  • Go down and press hit enter on ‘Ok’
  • Go back and quit

Hello @mashiurrahman

I tried the same steps you suggested, however I am getting the below error:

Could you please check and let me know if anything else is missing?

Regards
Sudheer

Hello Sudheer,
try

$ sudo pkill dhclient 
$ sudo dhclient

Thanks @Ayman . I see now all the connections are up and running and I see the IP address for enp0s3. I tried to connect to the IP using Putty from my Host machine, but couldn’t connect. I am still not able to ping google in Virtual box. Please let me know if I am missing anything.

Regards
Sudheer

Hi @sudhir560 ,
Can you please check your Internet connection of the virtual machine?

Regards,

Hi @Tej-Singh-Rana

Internet connection is in place for the VM.

Regards
Sudheer

Hello @Tej-Singh-Rana

I restarted the virtual box and now I am able to ping google from Virtual box. However, I am unable to login using Putty. Getting the message “Access denied” even though I am using the right credentials(osboxes.org). Not sure if anything is missing here.

Hi @sudhir560 ,
User name is osboxes not osboxes.org. Please try with osboxes and let me know.

Regards,

Hi @Tej-Singh-Rana

Thanks for your support. I am able to SSH into Virtual box from Host(Windows 10) using Putty.

Regards
Sudheer

1 Like

Awesome, thanks for the confirmation. :+1: