You are not logged in.

#1 2014-01-18 17:29:46

Marneus68
Member
From: France
Registered: 2014-01-18
Posts: 2

[SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

Hello everyone,

I recently installed VirtualBox on my Arch Linux install to tinker with GitLab on a Debian VM. I've set up a standard VM running Debian (wheezy) and made sure it's network settings were set to "NAT". However, I am unable to ping or ssh to this VM (which is running an ssh server among other things). Where this gets a bit weirder is that I'm perfectly able to ping and ssh to my host machine (running Arch).

I installed the version of VirtualBox available on the official repos and I'm running on the default kernel too.
I've install VirutalBox by following the infos posted on the wiki. My current user is part of the vboxusers group :

 % groups duane
disk lp wheel uucp locate rfkill games network video audio optical floppy storage scanner power users vboxusers

I've added the proper kernel modules to /etc/modules-load.d/virtualbox.conf so that they are loaded automatically on boot time :

vboxdrv
vboxnetadp
vboxnetflt
vboxpci
 % lsmod | grep vbox      
vboxpci                14581  0 
vboxnetflt             17612  0 
vboxnetadp             18355  0 
vboxdrv               264794  5 vboxnetadp,vboxnetflt,vboxpci

I must also note that the net-tools package is installed.

Now, I get the ip adress of my host :

 % ip addr     
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp9s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether f0:4d:a2:48:5b:38 brd ff:ff:ff:ff:ff:ff
3: wlp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 5c:ac:4c:09:d3:f3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.22/24 brd 192.168.1.255 scope global wlp4s0
       valid_lft forever preferred_lft forever
    inet6 fe80::5eac:4cff:fe09:d3f3/64 scope link 
       valid_lft forever preferred_lft forever

Then I try to ping it from my Debian guest.

user@debian:~% ping 192.168.1.22  -c 3
PING 192.168.1.22 (192.168.1.22) 56(84) bytes of data.
64 bytes from 192.168.1.22: icmp_req=1 ttl=63 time=0.961 ms
64 bytes from 192.168.1.22: icmp_req=2 ttl=63 time=0.722 ms
64 bytes from 192.168.1.22: icmp_req=3 ttl=63 time=0.680 ms

--- 192.168.1.22 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2001ms
rtt min/avg/max/mdev = 0.680/0.787/0.961/0.127 ms

Now I get the ip adress of my guest :

eth0      Link encap:Ethernet  HWaddr 08:00:27:77:0e:48  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe77:e48/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:69 errors:0 dropped:0 overruns:0 frame:0
          TX packets:93 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:11577 (11.3 KiB)  TX bytes:15395 (15.0 KiB)

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:16436  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:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And I try to ping my guest from my host :

 % ping 10.0.2.15 -c 3
PING 10.0.2.15 (10.0.2.15) 56(84) bytes of data.

--- 10.0.2.15 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2007ms

There. I hope I didn't give too much information.
I don't really understand what's going on there, usually that workfow works immediately in all the distributions I tried before, and on windows as well. I think I followed all the steps to make this work and yet it doesn't, and I'm not sure this problem is related to VirtualBox itself.
Thanks in advance for any tip or comment on that.

Last edited by Marneus68 (2014-01-24 10:19:39)

Offline

#2 2014-01-18 19:18:17

frank604
Member
From: BC, Canada
Registered: 2011-04-20
Posts: 1,219

Re: [SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

Try bridge.  Disable dhcp.  Set a statis ip like 192.168.1.40. Gateway should be router (192.168.1.1 if by default).  Then you can ping your guest.

Offline

#3 2014-01-19 07:04:25

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: [SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

AFAIK, with NAT the internal ip address is invisible outside unless there is port forwarding. What NAT does is make the external visible to the virtual machine. A simpler way to allow ssh inward is to use bridge, as recommended, which makes the internal card visible like any card on the host network.

Offline

#4 2014-01-19 09:12:13

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 714

Re: [SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

What I do for all my VB guest VM's is to set 2 network interfaces, one the normal (default) NAT, and the other a host-only interface. That way your guests are completely hidden from the local lan which may be desirable if e.g., your host is a laptop which you move around various places. The guests can access anything outbound and you can still ssh to them from the host (and also, using ssh ProxyCommand via that host if you want to access them remotely).

Offline

#5 2014-01-19 22:23:22

Marneus68
Member
From: France
Registered: 2014-01-18
Posts: 2

Re: [SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

Thanks a lot for you replies. As recommended I switched to a bridged connection. For some reason I was sure that NAT was what I wanted.
Using the bridged connection will however be a temporary solution until I can set my machines up like Bulletmark recommends.

Thanks again guys.

Offline

#6 2014-01-19 22:58:52

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,742

Re: [SOLVED] VirtualBox: Arch Linux host unable to reach guest over NA...

For NAT, the host looks to the VM like a router.  You would have to open a port on the host and forward it to the VM, just like you have to open a port on a router and forward it to a computer on the private network.  Using a bridge, the guest shows up on the same network as the host, but with a different IP.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB