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 and gateway of I can ping host from guest with no problem. Yet, I cannot ping guest from host:

PING ( 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 ... address seems to be assigned to my host: I have an httpd server running on host - and if I navigate to 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
    inet 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
    ether xxxxx 
    inet6 fe80::1c34:9a51:ed93:3a5b%en1 prefixlen 64 secured scopeid 0x9 
    inet netmask 0xffffff00 broadcast
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect
    status: active
    ether xxxxx
    media: autoselect
    status: inactive
    lladdr xxxxx
    nd6 options=201<PERFORMNUD,DAD>
    media: autoselect <full-duplex>
    status: inactive
    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

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

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?


I did figure it out eventually. The trick is to create a host-only network and then add two network interfaces in the guest - one for host-only network and the other one using NAT. Now the NAT interface allows the guest to access the internet and host-only interface allows two-way communication between the host and the guest.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.