2

I am using Debian stretch to run a Debian jessie guest. I have the guest setup with a NAT and a Host-only adapter. When I try to ping my guest from my host, my ping gets routed to my wireless Internet adapter instead of the virtual network.

From ifconfig -a, the virtual host-only network:

vboxnet1: flags=4098<BROADCAST,MULTICAST>  mtu 1500
        inet 172.16.57.1  netmask 255.255.0.0  broadcast 172.16.255.255
        ether 0a:00:27:00:00:01  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and my wireless adapter:

wlp4s1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.103  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::218:39ff:fe19:2edd  prefixlen 64  scopeid 0x20<link>
        ether 00:18:39:19:2e:dd  txqueuelen 1000  (Ethernet)
        RX packets 473074  bytes 138461228 (132.0 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 438482  bytes 389764274 (371.7 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

My routing table:

$ netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         192.168.1.1     0.0.0.0         UG        0 0          0 wlp4s1
192.168.1.0     0.0.0.0         255.255.255.0   U         0 0          0 wlp4s1

I would expect there to be some routes in netstat -rn directing relevant traffic to the virtual host-only nextwork, but I don't see this.

When I try to ping my guest (puffin) from my host:

$ ping puffin
PING puffin (172.16.57.101) 56(84) bytes of data.
From 1-128-201-31.ftth.glasoperator.nl (31.201.128.1) icmp_seq=1 Packet filtered

I have my guest's IP address (on eth1/the host-only adapter) set statically to 172.16.57.101 (and it is up) and dhcp is disabled on vboxnet1 (the host-only network).

Edit:

I found the problem with:

ip link
...
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff
  • Your default route is likely to go through your wireless adapter, ping can be pretty dumb at times, make sure when you ping you are specifying with -I vboxnet1 that you are trying to use that adapter as the route to the host. Better solution in general might be to set up a bridged connection and get rid of the NAT/Host-only all-together. – Gravy Feb 11 '16 at 15:25
  • 1
    @Gravy, thanks for the tip about "-I". Apparently vboxnet1 wasn't up. I found the solution here: bbs.archlinux.org/viewtopic.php?id=131711 and bbs.archlinux.org/viewtopic.php?pid=1178607. I wanted to avoid a bridge connection because I didn't want my guest exposed (even though this is overkill on my LAN). – Jonathan Feb 11 '16 at 16:17
  • 1
    Awesome. Glad you got it settled. If you have the chance you should transcribe those answers onto this site for record keeping/ Future searches, and then accept that answer :) – Gravy Feb 11 '16 at 16:20
  • Definitely. I will need to remember to accept it in 2 days after it is allowed (unless someone writes better answer before then). – Jonathan Feb 11 '16 at 16:28
2

Apparently VirtualBox wasn't able to start vboxnet0/vboxnet1, which I noticed when I did:

$ ping -I vboxnet1 puffin
connect: Network is unreachable

The problem could be found with

$ip link
(...)
5: vboxnet1: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff

The following fixed the issue:

sudo ip link up vboxnet1

And now I get:

$ip link
(...)
5: vboxnet1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT group default qlen 1000
    link/ether 0a:00:27:00:00:01 brd ff:ff:ff:ff:ff:ff

More details can be found:

|improve this answer|||||

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.