0

I have set up a host-only network in VirtualBox.

Windows Host:

VirtualBox Host-Only Network
 IPv4 Address. . . . . . . . . . . : 192.168.56.1

Wireless LAN Adapter Wireless Network Connection 2
  IPv4 Address. . . . . . . . . . . : 172.19.156.59
  Subnet Mask . . . . . . . . . . . : 255.255.255.0
  Default Gateway . . . . . . . . . : 172.19.156.1

CentOS VM:

eth0      Link encap:Ethernet  HWaddr 08:00:27:AF:A3:28  
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:feaf:a328/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:381 errors:0 dropped:0 overruns:0 frame:0
          TX packets:423 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:56181 (54.8 KiB)  TX bytes:50846 (49.6 KiB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:C4:A8:B6  
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fec4:a8b6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8984 errors:0 dropped:0 overruns:0 frame:0
          TX packets:162 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1155253 (1.1 MiB)  TX bytes:31231 (30.4 KiB)

eth2      Link encap:Ethernet  HWaddr 08:00:27:DB:B6:AB  
          inet addr:10.0.4.15  Bcast:10.0.4.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fedb:b6ab/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:220 errors:0 dropped:0 overruns:0 frame:0
          TX packets:487 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:87762 (85.7 KiB)  TX bytes:37818 (36.9 KiB)

When I connect to the internet in the CentOS VM, I want to see which path the packets take to reach say google.com I can ping the default gateway in the Windows Host, and my primary interest is to see how the packets get there.

[root@localhost network-scripts]# traceroute -I 172.19.156.1
traceroute to 172.19.156.1 (172.19.156.1), 30 hops max, 60 byte packets
 1  172.19.156.1 (172.19.156.1)  1.182 ms  3.395 ms  0.825 ms
[root@localhost network-scripts]# traceroute -T 172.19.156.1
traceroute to 172.19.156.1 (172.19.156.1), 30 hops max, 60 byte packets
 1  172.19.156.1 (172.19.156.1)  14.336 ms  13.957 ms  19.046 ms
[root@localhost network-scripts]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.0.2.2        0.0.0.0         UG    0      0        0 eth0
10.0.2.0        *               255.255.255.0   U     0      0        0 eth0
10.0.4.0        *               255.255.255.0   U     0      0        0 eth2
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1003   0        0 eth1
link-local      *               255.255.0.0     U     1004   0        0 eth2
192.168.56.0    *               255.255.255.0   U     0      0        0 eth1

I have used the -I and -T handles as default traceroute over UDP returns * Does the above output mean that packets go straight from 10.0.2.2 to 172.19.156.1?

I also get multiple * when trying to traceroute -T 172.16.156.59 (Windows host)

  • 1
    You can also run tcpdump like this: tcpdump -i eth1 src host 192.168.1.1 to see packets from a specific VM (IP). Looking at the headers you can determine their path. More examples: wiki.linuxwall.info/doku.php/en:ressources:astuces:tcpdump – slm Oct 10 '14 at 12:40
  • Packets for 192.168.56.0 are going to go through eth1, so they likely won't pass through 10.0.2.2 (on the eth0 net) at all. – Mark Plotnick Oct 10 '14 at 16:12
  • @MarkPlotnick as dense as it may sound, if packets want to exit the 192.168.56.0/24 network surely they have to go via the default gateway 10.0.2.2? I just want to see the sequence of hops. – user Oct 12 '14 at 4:31
  • Sorry, ignore my comment; I incorrectly tied the 192.168.56.0 net to the 172.19.156 net because they were listed together. I'll remove the comment. – Mark Plotnick Oct 12 '14 at 10:18
  • What type of networking (NAT, bridged, etc.) does the 10.0.2.0 network on the VM use? – Mark Plotnick Oct 12 '14 at 10:18
0

The VirtualBox manual has this to say about NAT networking:

The network frames sent out by the guest operating system are received by VirtualBox's NAT engine, which extracts the TCP/IP data and resends it using the host operating system. To an application on the host, or to another computer on the same network as the host, it looks like the data was sent by the VirtualBox application on the host, using an IP address belonging to the host.

So I believe that any traceroute from your VM that goes through its NAT interface will report the same set of gateways as would a traceroute that is run on the host, meaning that traceroute won't list the VirtualBox NAT gateway nor the interface on the host used to send out traffic from the host.

  • I'm not sure about traceroute yet on the host.. as I simply get multiple * when I try to traceroute to any destination. But thanks for the explanation. – user Oct 13 '14 at 1:44

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.