Unable to ping from one vboxnet to another

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
Sintai
Posts: 3
Joined: 23. Jul 2016, 22:59

Unable to ping from one vboxnet to another

Post by Sintai »

Hi all,

I have this problem I am unable to ping from one vboxnet to another vboxnet. Look on my configuration:

Code: Select all

ondrejb@13MBP-03372:~$ vboxmanage list hostonlyifs
Name:            vboxnet0
GUID:            786f6276-656e-4074-8000-0a0027000000
DHCP:            Disabled
IPAddress:       10.1.0.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:00
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet0

Name:            vboxnet1
GUID:            786f6276-656e-4174-8000-0a0027000001
DHCP:            Disabled
IPAddress:       10.2.0.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:01
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet1

Name:            vboxnet2
GUID:            786f6276-656e-4274-8000-0a0027000002
DHCP:            Disabled
IPAddress:       10.3.0.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:02
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet2

Name:            vboxnet3
GUID:            786f6276-656e-4374-8000-0a0027000003
DHCP:            Disabled
IPAddress:       192.168.1.1
NetworkMask:     255.255.255.0
IPV6Address:     
IPV6NetworkMaskPrefixLength: 0
HardwareAddress: 0a:00:27:00:00:03
MediumType:      Ethernet
Status:          Up
VBoxNetworkName: HostInterfaceNetworking-vboxnet3
Ping from one to another vboxnet:

Code: Select all

ondrejb@13MBP-03372:~$ ping -S 10.1.0.1 10.2.0.1
PING 10.2.0.1 (10.2.0.1) from 10.1.0.1: 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
Request timeout for icmp_seq 0
ping: sendto: No route to host
Request timeout for icmp_seq 1
Routing and ping from the virtual server

Code: Select all

ondrej@ondrej-VirtualBox:~$ ping 10.2.0.1
PING 10.2.0.1 (10.2.0.1) 56(84) bytes of data.
64 bytes from 10.2.0.1: icmp_seq=1 ttl=64 time=0.228 ms
64 bytes from 10.2.0.1: icmp_seq=2 ttl=64 time=0.464 ms
^C
--- 10.2.0.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.228/0.346/0.464/0.118 ms
ondrej@ondrej-VirtualBox:~$ ping 10.1.0.1
PING 10.1.0.1 (10.1.0.1) 56(84) bytes of data.
^C
--- 10.1.0.1 ping statistics ---
251 packets transmitted, 0 received, 100% packet loss, time 251283ms

ondrej@ondrej-VirtualBox:~$ netstat -nr
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.2.0.1        0.0.0.0         UG        0 0          0 eth0
10.2.0.0        0.0.0.0         255.255.255.0   U         0 0          0 eth0
172.17.0.0      0.0.0.0         255.255.0.0     U         0 0          0 docker0
ondrej@ondrej-VirtualBox:~$ 
What is missing?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Unable to ping from one vboxnet to another

Post by socratis »

Sintai wrote:What is missing?
Your networks are setup to be isolated. For example, with an IP address of 10.1.0.x and a network mask of 255.255.255.0 can only see directly IPs in the range of 10.1.0.1 up to 10.1.0.254. That is anything that looks like 10.1.0.x. You cannot directly see an IP of 10.2.0.x. You need a router, something that can connect the two networks. Like the "box" in the ASCII-art below:
.             ___________________________
             |        R O U T E R        |
10.1.0.1 --> | 10.1.0.254 <-> 10.2.0.254 | --> 10.2.0.1
             |___________________________|
You're missing the router.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Sintai
Posts: 3
Joined: 23. Jul 2016, 22:59

Re: Unable to ping from one vboxnet to another

Post by Sintai »

Why it doesn't route MAC by itself? MAC knows how to route all of the networks.

Code: Select all

10.1/24            link#10            UC              3        0 vboxnet
10.1.0.145         8:0:27:60:49:cd    UHLWI           0        0 vboxnet   1122
10.1.0.255         ff:ff:ff:ff:ff:ff  UHLWbI          0        2 vboxnet
10.2/24            link#11            UC              4        0 vboxnet
10.2.0.11          8:0:27:8f:6b:11    UHLWI           0        3 vboxnet   1163
10.2.0.145         8:0:27:f7:a3:e5    UHLWI           0        2 vboxnet   1200
10.2.0.255         ff:ff:ff:ff:ff:ff  UHLWbI          0        2 vboxnet
10.3/24            link#12            UC              2        0 vboxnet
10.3.0.255         ff:ff:ff:ff:ff:ff  UHLWbI          0        2 vboxnet
192.168.1          link#13            UC              4        0 vboxnet
192.168.1.111      8:0:27:49:e:e5     UHLWI           0        0 vboxnet   1169
192.168.1.145      8:0:27:49:e:e5     UHLWI           0        1 vboxnet   1170
192.168.1.255      ff:ff:ff:ff:ff:ff  UHLWbI          0        2 vboxnet
And default routes are MAC vboxnet interfaces for all of the guests.
Sintai
Posts: 3
Joined: 23. Jul 2016, 22:59

Re: Unable to ping from one vboxnet to another

Post by Sintai »

Problem resolved by turning on IP forwarding on the MAC.

Code: Select all

ondrejb@13MBP-03372:~$ sudo sysctl -w net.inet.ip.forwarding=1
net.inet.ip.forwarding: 0 -> 1
ondrejb@13MBP-03372:~$ sudo sysctl -w net.inet.ip.fw.enable=1
net.inet.ip.fw.enable: 1 -> 1
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Unable to ping from one vboxnet to another

Post by socratis »

OK, that's way beyond my basic net knowledge. Glad you got it going and actually posted the solution!
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply