VirtualBox: MacOS host cannot connect to guest, but guest can connect to host

by Aleks G   Last Updated May 26, 2018 23:01 PM

My setup:

  • MacOS host (High Sierra 10.13.3)
  • Linux guest (Ubuntu 16.04)
  • Virtual Box 5.2.12
  • NAT networking

I need to talk from host to guest and from guest to internet.

The guest gets an IP address of 10.0.2.15 and gateway of 10.0.2.2. I can ping host from guest with no problem. Yet, I cannot ping guest from host:

PING 10.0.2.15 (10.0.2.15): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 ...

10.0.2.2 address seems to be assigned to my host: I have an httpd server running on host - and if I navigate to 10.0.2.2 in a browser from guest, I get the host's site.

Looking at network configuration, I don't see any interfaces added by virtualbox:

host$ ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    inet 127.0.0.1 netmask 0xff000000 
    inet6 ::1 prefixlen 128 
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    nd6 options=201<PERFORMNUD,DAD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
OHC4: flags=0<> mtu 0
EHC36: flags=0<> mtu 0
EHC38: flags=0<> mtu 0
OHC6: flags=0<> mtu 0
en1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether xxxxx 
    inet6 fe80::1c34:9a51:ed93:3a5b%en1 prefixlen 64 secured scopeid 0x9 
    inet 10.37.37.37 netmask 0xffffff00 broadcast 10.37.37.255
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
    ether xxxxx
    media: autoselect
    status: inactive
fw0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 4078
    lladdr xxxxx
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect <full-duplex>
    status: inactive
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    options=b<RXCSUM,TXCSUM,VLAN_HWTAGGING>
    ether xxxxx
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect (none)
    status: inactive
utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
    inet6 fe80::9a23:8dd9:bf4e:f69d%utun0 prefixlen 64 scopeid 0x8 
    nd6 options=201<PERFORMNUD,DAD>

and I don't see any routes to connect from host to guest:

host$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            10.37.37.1         UGSc           77       10     en1
10.37.37/24        link#9             UCS             3        0     en1
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              3   458010     lo0
169.254            link#9             UCS             0        0     en1
255.255.255.255/32 link#9             UCS             0        0     en1

Internet6:
Destination                             Gateway                         Flags         Netif Expire
default                                 fe80::%utun0                    UGcI          utun0
::1                                     ::1                             UHL             lo0
fe80::%lo0/64                           fe80::1%lo0                     UcI             lo0
fe80::1%lo0                             link#1                          UHLI            lo0
fe80::%utun0/64                         fe80::9a23:8dd9:bf4e:f69d%utun0 UcI           utun0
fe80::9a23:8dd9:bf4e:f69d%utun0         link#8                          UHLI            lo0
fe80::%en1/64                           link#9                          UCI             en1
fe80::1c34:9a51:ed93:3a5b%en1           f0:b4:79:1f:81:f0               UHLI            lo0
ff01::%lo0/32                           ::1                             UmCI            lo0
ff01::%utun0/32                         fe80::9a23:8dd9:bf4e:f69d%utun0 UmCI          utun0
ff01::%en1/32                           link#9                          UmCI            en1
ff02::%lo0/32                           ::1                             UmCI            lo0
ff02::%utun0/32                         fe80::9a23:8dd9:bf4e:f69d%utun0 UmCI          utun0
ff02::%en1/32                           link#9                          UmCI            en1

It's understandable that host can't talk to guest. The question is how can I make it do it?



Related Questions




Mac OS High Sierra VM slow rendering

Updated September 16, 2018 16:01 PM