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 @KodeKloud

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

2 Likes

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

This worked! Thanks @mashiurrahman

How to make this persistant?