Host only networking incomplete HWaddress

Discussions related to using VirtualBox on Linux hosts.
Post Reply
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Host only networking incomplete HWaddress

Post by ndastur »

Host setup:
Centos 5.6
VirtualBox 4.0.8
eth0 has a statically configured IP (non-private address)

Guest setup:
Centos 5.6
Guest additions installed
Two NICs
eth0 - NAT interface with DHCP assigned IP
eth1 - Host only interface with statically assigned 192.168.56.10 (DHCP disabled on vboxnet0)

I would think with this setup the guest should be able to connect in/out to the world at large and the host system should be able to connect to the guest using for example ssh 192.168.56.10. However, I have been tearing my hair out as I just can't seem to get it to work.

From host:
# ping 192.168.56.10 gives
PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data.
From 192.168.56.1 icmp_seq=2 Destination Host Unreachable
From 192.168.56.1 icmp_seq=3 Destination Host Unreachable
From 192.168.56.1 icmp_seq=4 Destination Host Unreachable
and at this point on the host
# arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.56.10                    (incomplete)                              vboxnet0
[my internet IP]            ether   00:00:xx:xx:xx:xx   C                     eth0
[my internet IP GW]      ether   00:10:xx:xx:xx:xx   C                     eth0
Now the weird thing I found by chance is that if I ping from the guest to 192.168.56.1 firstly that works fine and now on the host
# arp -n
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.56.10            ether   02:00:02:00:AA:02   C                     vboxnet0
[my internet IP GW]    ether   00:00:xx:xx:xx:xx   C                     eth0
and so now a ping from host to guest works as does ssh
# ping 192.168.56.10
PING 192.168.56.10 (192.168.56.10) 56(84) bytes of data.
64 bytes from 192.168.56.10: icmp_seq=1 ttl=64 time=0.123 ms
64 bytes from 192.168.56.10: icmp_seq=2 ttl=64 time=0.119 ms
64 bytes from 192.168.56.10: icmp_seq=3 ttl=64 time=0.117 ms
but this only lasts along as a arp cache time (20mins or so)

Is there something wrong in my setup, or is this a VB bug?
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Host only networking incomplete HWaddress

Post by Martin »

Does the host also have an address in the 192.168.56.x network on the host only adapter vboxnet0?
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Re: Host only networking incomplete HWaddress

Post by ndastur »

No it doesn't.

The host routing table looks like this
/sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
94.75.xxx.xxx   0.0.0.0         255.255.255.240 U     0      0        0 eth0
192.168.56.0    0.0.0.0         255.255.255.0   U     0      0        0 vboxnet0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
0.0.0.0         94.75.xxx.xxx   0.0.0.0         UG    0      0        0 eth0
I also reconfigured the guest eth1 to use a VB assigned MAC address, in case the local MAC was the problem and that didn't make any difference either. Looking more and more like a VB bug
Martin
Volunteer
Posts: 2560
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Host only networking incomplete HWaddress

Post by Martin »

To be able to send and receive packages from the 192.168.56.0 network your host needs to have an IP address from that network on the vboxnet0 interface.
vboxnet0 should have the address 192.168.56.1 when a guest with hostonly networking is active and you didn't change the default settings under "File" .> "Preferences" -> "Network"
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Re: Host only networking incomplete HWaddress

Post by ndastur »

I don't quite understand.

The interface vboxnet0 should give me the IP on my host machine (i.e. 192.168.56.1). And from the guest POV this happens, hence I am able to ping out. I have left the defaults from the file->preferences->network for vboxnet0. Tried with both dhcp and without. Although DHCP should have nothing to do with it.

BTW this all works flawlessly on OSX
mschwartz
Posts: 92
Joined: 18. Oct 2010, 21:01
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: ubuntu

Re: Host only networking incomplete HWaddress

Post by mschwartz »

I'm not a centos guy, but what you've described looks like a centos problem. The sending out of ARP packets is a function of the OS, not of virtualbox.

Without further details, my guess would be you have some sort of ip firewall causing problems. It might be on the guest or the host, but it looks more likely to be on the host.

More on ARP here:

http://en.wikipedia.org/wiki/Address_Re ... n_Protocol
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Re: Host only networking incomplete HWaddress

Post by ndastur »

Thank you. I will look into further, however, I did wonder about this and brief turned off my firewall and also made sure selinux was disabled etc -> no difference.
Y E T I
Posts: 161
Joined: 9. Aug 2010, 01:47
Primary OS: Other
VBox Version: OSE self-compiled
Guest OSses: ?
Location: H i m a l a y a s
Contact:

Re: Host only networking incomplete HWaddress

Post by Y E T I »

My experience with centos is that is is some what anal when it comes to the nics and how they are configured. I find it works better of the eth0=host-only and eth1=nat
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Re: Host only networking incomplete HWaddress

Post by ndastur »

Thank you for suggestion, but no luck with my ubuntu box either. Exactly the same problem occurs, i.e. I can ping out but not in, unless I do ping out first
ndastur
Posts: 17
Joined: 21. Jun 2011, 12:06
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Centos, Windows, OSX

Re: Host only networking incomplete HWaddress

Post by ndastur »

Okay, things just got a little weirder ...

I was continuing to try and investigate the problem and if I am running
$ sudo tcpdump -ni vboxnet0 -f arp
to capture and display the arp stream then I can suddenly ping my virtual boxes! So there must be something in the setup of vboxnet0 as an interface.

Does anyone know how and where the adaptor vboxnet0 is created?
Post Reply