How can two subnets be connected?

I can not ping or traceroute between these subnets.

Vbox1 subnet ifconfig:

eth0      Link encap:Ethernet  HWaddr 08:00:27:f1:68:9e
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fef1:689e/64 Scope:Link
          RX packets:207703 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41701 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:45480669 (45.4 MB)  TX bytes:4855362 (4.8 MB)

eth1      Link encap:Ethernet  HWaddr 08:00:27:79:02:34
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe79:234/64 Scope:Link
          RX packets:913 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1335 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:129887 (129.8 KB)  TX bytes:150700 (150.7 KB)

lo        Link encap:Local Loopback
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:15106 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15106 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:949613 (949.6 KB)  TX bytes:949613 (949.6 KB)

And p4 (because I do not have access to that machine from here, I give a manual-typed summary):

etho : only inet6 addr
lo : inet addr : Mask :
venet0 : only inet6 addr
vmbr0 : inet addr : BCast : Mask :

Two subnets were connected successful. After switching of ISP I can not access the p4 subnet anymore. So something has changed, but I expect it should be a minor problem, because before using subnets it was working successful.

I have read Virtual machine in two subnets, but the suggestion is to use VLAN. But according to Best way to segment traffic, VLAN or subnet? VLAN works on network layer 2, and subnet on network layer 3. And layer 3, subnets, should be used.

So I should have a gateway between these subnets.

According to Ubuntu KB - Network Config I added to vbox1:

sudo route add default gw eth1

But it generates:

SIOCADDRT: Network is unreachable

Searching returns Ubuntu tunnel or gateway a difference between a host address and a network address.

For your information, vbox1 is Ubuntu 13.04 (Raring Ringtail) and p4 is Debian 7.5 (Wheezy).

I am stuck now.

  • 3
    I don't fully understand your question. The one box is actually part of two subnets: and The p4 box is on a completely different subnet. You need at least one device which is configured to be on both subnets in order to be able to receive packages from the one subnet and send them to the other one. Or explained differently: Supposed you are on vbox1 and you are the one who is responsible for sending packets over the network: Over which interface would you send packets to Would you use eth1 or eth0? vbox1 does not know that either...
    – TomS
    Nov 30, 2015 at 14:37
  • eth1 is on 10.0.3.X network, gateway must be in local network, you can't add 10.10.14.Y as a gateway. if P4 is ipv6 only, try discovering it with ip n , next try to ping link-local adress (e.g. then one who start with fe80:: )
    – Archemar
    Nov 30, 2015 at 15:01
  • @TomS p4 box is indeed a different subnet. On this moment indeed vbox1 does not know how to access. My preference is to adjust vbox1. This is a Virtualbox client so settings can be reversed. My question is how to connects these two different subnets?
    – Bernard
    Nov 30, 2015 at 15:15
  • @Archemar p4 is not ip6 only, at least I think so. I can see ip4 style addresses like My preference is using ip4, not making thing more complex as needed. The odd thing the subnets it was working before switching to an other ISP. So my assumption is it should be minor adjustment
    – Bernard
    Nov 30, 2015 at 15:17

1 Answer 1


Move vbox1 to a different subnet: Change its IP address on eth0 from to (or some other free IP address in the subnet Then, vbox1 knows via which interface p4 ( is accessible (--> via eth0). vbox1 automatically adjusts its routing table then. Now you should be able to access p4 from vbox1. If you want to access p4 from any additional client in, you need to configure vbox1 as a router (i.e. a device that can forward packets arriving on eth1 [] to eth0 [] (and vice-versa). That's what's meant by "connecting two networks").

How to do that depends on the distribution you are using. Basically, you need to write "1" into the device file /proc/sys/net/ipv4/ip_forward.

Like echo 1 > /proc/sys/net/ipv4/ip_forward

This, however is only valid during the current boot cycle. The setting is gone after a reboot.

If you want to do that permanently, you have to put this line into some startup script. If you are using Ubuntu, you can also put this into /etc/sysctl.conf (I'm not sure about other distros). Uncomment the line net.ipv4.ip_forward=1. If you want to have this in effect immediately, you can also issue sudo sysctl -w net.ipv4.ip_forward=1 instead of the ´echo´ mentioned above.

Pls. see also this link on askubuntu.com.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .