unable to ping guest ip 10.0.2.15 on host

0

I am beginner of ubuntu, and i have installed ubuntu 16.04 on my desktop computer, then installed Vagrant by following steps

sudo apt-get install virtualbox
sudo apt-get install vagrant
vagrant box add ubuntu/xenial64
vagrant init ubuntu/xenial64
vagrant up
vagrant ssh

and I can access it:

vagrant@ubuntu-xenial:~$ ifconfig

enp0s3    Link encap:Ethernet  HWaddr 02:ba:5f:3b:91:b0

           inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
           inet6 addr: fe80::ba:5fff:fe3b:91b0/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:282 errors:0 dropped:0 overruns:0 frame:0
           TX packets:201 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:31982 (31.9 KB)  TX bytes:30222 (30.2 KB)

 lo        Link encap:Local Loopback  

           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1 
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

so i am trying to ping on host to 10.0.2.15 but...

admin@admin-desktop:~$ ping 10.0.2.15

PING 10.0.2.15 (10.0.2.15) 56(84) bytes of data.

nothing happens.

ip route output on guest

 vagrant@ubuntu-xenial:~$ ip route
 default via 10.0.2.2 dev enp0s3 
 10.0.2.0/24 dev enp0s3  proto kernel  scope link  src 10.0.2.15 

ip route output on host

 admin@admin-desktop:~$ ip route
 default via 172.16.20.1 dev enp3s0  proto static  metric 100 
 169.254.0.0/16 dev enp3s0  scope link  metric 1000 
 172.16.20.0/24 dev enp3s0  proto kernel  scope link  src 172.16.20.187  metric 100 

i tried to set up NAT to Bridge adaptar shows below error

admin@admin-desktop:~$ vagrant reload
==> default: Attempting graceful shutdown of VM...
default: Guest communication could not be established! This is usually because
default: SSH is not running, the authentication information was changed,
default: or some other networking issue. Vagrant will force halt, if
default: capable.
==> default: Forcing shutdown of VM...
==> default: Checking if box 'ubuntu/xenial64' is up to date...
==> default: A newer version of the box 'ubuntu/xenial64' is available! You currently
==> default: have version '20191108.0.0'. The latest is version '20191113.0.0'. Run
==> default: `vagrant box update` to update.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["modifyvm", "49520cee-d0ee-43e3-869c-4f78e1fb9dfd", "--natpf1", "ssh,tcp,127.0.0.1,2222,,22"]

Stderr: VBoxManage: error: A NAT rule of this name already exists
VBoxManage: error: Details: code NS_ERROR_INVALID_ARG (0x80070057), component NATEngineWrap, interface INATEngine, callee nsISupports
VBoxManage: error: Context: "AddRedirect(Bstr(strName).raw(), proto, Bstr(strHostIp).raw(), RTStrToUInt16(strHostPort), Bstr(strGuestIp).raw(), RTStrToUInt16(strGuestPort))" at line 1838 of file VBoxManageModifyVM.cpp
enter code here
networking
vagrant
virtualbox
ping
vagrantfile
asked on Stack Overflow Nov 13, 2019 by Pundlik Patil

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0