HostOnly adapter unable to choose correct network

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
Johnnyq72
Posts: 6
Joined: 18. May 2015, 13:50

HostOnly adapter unable to choose correct network

Post by Johnnyq72 »

Running VBox on Mac.

IP address MAC LAN (en4) 192.168.2.3
IP address MAC vboxnet0 192.168.56.1

HostOnly network 192.168.56.0 / 24

VBox 1 IP 192.168.56.66
VBox 2 IP 192.168.56.67

All traffic between MAC and VBox 1 or 2 is put on 192.168.2.254 (local gateway) in stead of being handled by 192.168.56.1 (which would be the logical thing as this is the local network to handle this traffic).
Can anybody see what I am missing here? 192.168.2 and 192.168.56 should be 2 separate C-class networks (both with a 24 bit subnet mask).
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: HostOnly adapter unable to choose correct network

Post by Perryg »

Depends on how you configured the guest network. Did you by chance specify a gateway? Are you using more than one network adapter in the guest/s?
Johnnyq72
Posts: 6
Joined: 18. May 2015, 13:50

Re: HostOnly adapter unable to choose correct network

Post by Johnnyq72 »

The guest network is 192.168.56.1 (vboxnet0 adapter on the host)
Node A is 192.168.56.66
Node B is 192.168.56.67

Both guests have 2 NIC's
- The guest network (above)
- A NatNetwork adapter to be able to access Internet (10.0.2.0/24)

On the HOST (!) though,
When pinging or traceroute'ing 192.168.56.66, all traffic goes to the local host network 192.168.2.0/24 which seems utterly unlogical since this is a correctly masked C-class network.
That's why I don't understand...

It cannot be this NatNetwork playing me, right? As all of this is happening on the host, not in the VM. They can talk to each other and access the Internet without issue.
Disabling the eth1 (NatNetwork) on the installation does not really help...

*******-***-***-***-*:~ johnny72$ traceroute 192.168.56.66
traceroute to 192.168.56.66 (192.168.56.66), 64 hops max, 52 byte packets
1 192.168.2.254 (192.168.2.254) 0.811 ms 0.683 ms 0.489 ms

I guess hop 1 should go to 192.168.56.1 in stead of 192.168.2.254 (which is my local gateway)

I have done these setups many times before, and never had any issue... #Baffled and / or #Dumb ;-)
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: HostOnly adapter unable to choose correct network

Post by noteirak »

Not sure of the commands on OSX but please give the output of the following or equivalent:

Code: Select all

ifconfig -a
route -n
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Johnnyq72
Posts: 6
Joined: 18. May 2015, 13:50

Re: HostOnly adapter unable to choose correct network

Post by Johnnyq72 »

Code: Select all

$ ifconfig -a
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
        options=3<RXCSUM,TXCSUM>
        inet6 ::1 prefixlen 128
        inet 127.0.0.1 netmask 0xff000000
        inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
        nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8823<UP,BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
        ether b8:e8:56:20:6f:aa
        nd6 options=1<PERFORMNUD>
        media: autoselect (<unknown type>)
        status: inactive
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        options=60<TSO4,TSO6>
        ether 32:00:14:dc:e0:00
        media: autoselect <full-duplex>
        status: inactive
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=63<RXCSUM,TXCSUM,TSO4,TSO6>
        ether 02:f7:6f:f6:13:00
        Configuration:
                id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
                maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
                root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
                ipfilter disabled flags 0x2
        member: en1 flags=3<LEARNING,DISCOVER>
                ifmaxaddr 0 port 6 priority 0 path cost 0
        nd6 options=1<PERFORMNUD>
        media: <unknown type>
        status: inactive
p2p0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 2304
        ether 0a:e8:56:20:6f:aa
        media: autoselect
        status: inactive
awdl0: flags=8902<BROADCAST,PROMISC,SIMPLEX,MULTICAST> mtu 1452
        ether 96:ba:d4:76:df:1f
        nd6 options=1<PERFORMNUD>
        media: autoselect
        status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
        inet6 fe80::b81e:bf99:9a9d:e837%utun0 prefixlen 64 scopeid 0xa
        inet6 fdeb:b4db:f9f0:2a4b:b81e:bf99:9a9d:e837 prefixlen 64
        nd6 options=1<PERFORMNUD>
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=4<VLAN_MTU>
        ether 00:f7:6f:6f:64:55
        inet6 fe80::2f7:6fff:fe6f:6455%en4 prefixlen 64 scopeid 0x4
        inet 192.168.2.3 netmask 0xffffff00 broadcast 192.168.2.255
        nd6 options=1<PERFORMNUD>
        media: autoselect (100baseTX <full-duplex,flow-control>)
        status: active
utun1: flags=80d1<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1406
        inet 46.30.31.215 --> 46.30.31.215 netmask 0xffffffff
        inet6 fe80::bae8:56ff:fe20:6faa%utun1 prefixlen 64 scopeid 0xb
        inet6 2a02:22f0:3:65b::beef:215 prefixlen 128
        nd6 options=1<PERFORMNUD>
vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
        ether 0a:00:27:00:00:00
        inet 192.168.56.1 netmask 0xffffff00 broadcast 192.168.56.255

Code: Select all

$ route -n get default
   route to: default
destination: default
       mask: default
    gateway: 192.168.2.254
  interface: en4
      flags: <UP,GATEWAY,DONE,STATIC,PRCLONING>
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0
Thanks for taking the time!
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: HostOnly adapter unable to choose correct network

Post by noteirak »

for the route, don't add "get default", simply show the whole routing table. Your IP information seems correct at least
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Johnnyq72
Posts: 6
Joined: 18. May 2015, 13:50

Re: HostOnly adapter unable to choose correct network

Post by Johnnyq72 »

Hi Noteirak,

Somehow MAC doesn't do route and then show the route table and does it like all the other UNIX'es with netstat -rn (which is somewhat ugly) but here goes:

Code: Select all

netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            192.168.2.254      UGSc           48        2     en4
10.5/16            46.30.31.215       UGSc            0        0   utun1
10.10.212.64/26    46.30.31.215       UGSc            0        0   utun1
46.30.24/21        46.30.31.215       UGSc            0    29177   utun1
46.30.25.236/32    192.168.2.254      UGSc            1        0     en4
46.30.31.215/32    127.0.0.1          UGSc           12        0     lo0
89.250.138.32/27   46.30.31.215       UGSc            0        0   utun1
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH             14   581167     lo0
169.254            link#4             UCS             0        0     en4
172.19/24          46.30.31.215       UGSc            1    14868   utun1
172.20/23          46.30.31.215       UGSc            2     3164   utun1
172.20.12/24       46.30.31.215       UGSc            0        0   utun1
172.20.23/24       46.30.31.215       UGSc            0        0   utun1
172.21             46.30.31.215       UGSc            0    67791   utun1
192.168.0          46.30.31.215       UGSc            0        0   utun1
192.168.2          link#4             UCS             5        0     en4
192.168.2.1        e0:c9:7a:64:f3:4b  UHLWI           0        0     en4    687
192.168.2.3/32     link#4             UCS             1        0     en4
192.168.2.3        0:f7:6f:6f:64:55   UHLWI           0       29     lo0
192.168.2.4        f0:d1:a9:3e:e9:34  UHLWI           0      321     en4    411
192.168.2.9        bc:30:7d:4f:fe:bd  UHLWI           0        0     en4   1177
192.168.2.10       0:11:32:2d:7c:2f   UHLWIi          1 11666912     en4    775
192.168.2.254      34:4d:ea:9d:62:9b  UHLSr          53      120     en4   1190
192.168.2.255      ff:ff:ff:ff:ff:ff  UHLWbI          0        2     en4
194.245.140.235/32 46.30.31.215       UGSc            0        0   utun1
213.155.91.32/28   46.30.31.215       UGSc            0        0   utun1

Internet6:
Destination                             Gateway                         Flags         Netif Expire
default                                 link#11                         UGCS          utun1
::1                                     ::1                             UHL             lo0
2a00:1450:400c:c00::63                  link#11                         UGHWIi        utun1
2a00:1450:400c:c05::5e                  link#11                         UGHW3I        utun1    293
2a00:1450:4013:c01::54                  link#11                         UGHW3I        utun1    300
2a00:1450:4013:c01::5e                  link#11                         UGHWIi        utun1
2a00:1450:4013:c01::5f                  link#11                         UGHW3I        utun1    298
2a00:1450:4013:c01::64                  link#11                         UGHW3I        utun1    299
2a00:1450:4013:c01::84                  link#11                         UGHWIi        utun1
2a00:1450:4013:c01::8b                  link#11                         UGHW3I        utun1    298
2a00:1450:4013:c01::9b                  link#11                         UGHWIi        utun1
2a00:1450:4013:c01::9c                  link#11                         UGHWIi        utun1
2a01:7c8:eb::95:170:72:227              link#11                         UGHW3I        utun1    285
2a01:7c8:7c8:a11::3                     link#11                         UGHW3I        utun1     83
2a02:22f0:3:65b::beef:215               link#11                         UHL             lo0
2a02:22f0:3:bb90::60                    link#11                         UGHW3I        utun1    251
fdeb:b4db:f9f0:2a4b:b81e:bf99:9a9d:e837 link#10                         UHL             lo0
fe80::%lo0/64                           fe80::1%lo0                     UcI             lo0
fe80::1%lo0                             link#1                          UHLI            lo0
fe80::2f7:6fff:fe6f:6455%en4            0:f7:6f:6f:64:55                UHLI            lo0
fe80::%utun0/64                         fe80::b81e:bf99:9a9d:e837%utun0 UcI           utun0
fe80::b81e:bf99:9a9d:e837%utun0         link#10                         UHLI            lo0
fe80::%utun1/64                         fe80::bae8:56ff:fe20:6faa%utun1 UcI           utun1
fe80::bae8:56ff:fe20:6faa%utun1         link#11                         UHLI            lo0
ff01::%lo0/32                           ::1                             UmCI            lo0
ff01::%utun0/32                         fe80::b81e:bf99:9a9d:e837%utun0 UmCI          utun0
ff01::%utun1/32                         fe80::bae8:56ff:fe20:6faa%utun1 UmCI          utun1
ff02::%lo0/32                           ::1                             UmCI            lo0
ff02::%en4/32                           link#4                          UmCI            en4
ff02::%en0/32                           link#5                          UmCI            en0
ff02::%utun0/32                         fe80::b81e:bf99:9a9d:e837%utun0 UmCI          utun0
I had the same idea that my IP chizzle looked okay, but somehow the thing does not discreminate between 192.168.2.0 and 192.168.56.0 as were the network running with a B-class mask, which it isn't... :roll: :shock:
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: HostOnly adapter unable to choose correct network

Post by noteirak »

Ok so one thing is for sure: the 192.168.56.0/24 doesn't exist in your routing table, so it will be sent to the gateway. Why it doesn't exist is the real issue.
Normally that entry should be managed by OSX itself, since you have the vboxnet0 interface up & running (from the ifconfig).

Not having a MAC, I can't tell if the error is with OSX (or any 3rd party tool) or with VirtualBox itself, but let's try something: While the VM is running, disable vboxnet0, wait 5 sec, re-enable it, then try to ping again from the host.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Johnnyq72
Posts: 6
Joined: 18. May 2015, 13:50

Re: HostOnly adapter unable to choose correct network

Post by Johnnyq72 »

I agree. The issue isn't with VBox.
I will need to follow up your tip.
Thanks so far and I will keep you informed (but busy right now, sorry).
Post Reply