I'm creating a local network of three virtual machines (all Ubuntu 14.04, just from the box). The first one is connected to the third and the second is connected to the third as well.
comp1 (220.127.116.11) --- (18.104.22.168) comp3 (22.214.171.124) --- (126.96.36.199) comp2
This is how I set up the addresses and routing:
vm1: ip link set eth0 up ip a add 188.8.131.52/24 dev eth0 ip ro add 184.108.40.206/24 via 220.127.116.11 vm2: ip link set eth0 up ip a add 18.104.22.168/24 dev eth0 ip ro add 22.214.171.124/24 via 126.96.36.199 vm3: ip link set eth0 up ip link set eth1 up ip a add 188.8.131.52/24 dev eth0 ip a add 184.108.40.206/24 dev eth1
Computers 1 and 3 can ping each other (220.127.116.11 to 18.104.22.168 and to 22.214.171.124 and back), the same with computers 2 and 3.
But when I try to ping computer 1 from computer 2, or 2 from 1 ping packets get lost.
PING 126.96.36.199 (188.8.131.52) 56(84) bytes of data. --- 184.108.40.206 ping statistics --- 4 packets transmitted, 0 received, 100% packet loss, time 3049ms
Why does it happen and what am I doing wrong?