I'm trying to set up simple enogh system with 3 virtual debian jessie machines: first connected to second and second connected to third. I want first one to be able ping third one.
To achieve this, I've set up static IP addresses (via /etc/network/interfaces) like this:
#FIRST:
eth0 inet static address 172.28.11.2 netmask 255.255.255.0
#SECOND:
eth0 inet static address 172.28.11.1 netmask 255.255.255.0
eth1 inet static address 172.28.18.2 netmask 255.255.255.0
#THIRD:
eth0 inet static address 172.28.18.1 netmask 255.255.255.0
Also I've enabled ipv4_forward option in all these machines:
net.ipv4.ip_forward=1 # /etc/sysctl.conf, all machines
and checked that it works (by invoking cat /proc/...../ip_forward and ensuring there is 1
in output)
First can ping second (checked, works). Second can ping third (checked, works).
Now I'm trying to set up simple routing table: I'm adding this route on first node:
route add -net 172.28.18.0 netmask 255.255.255.0 dev eth0 gw 172.28.11.1
After it I can ping 172.28.11.2 (second node in other network mask) but still can't reach 172.28.11.1 (third node).
If I do traceroute I see that there IS a 172.28.11.1
hop in route (so it TRIES to connect there) but no luck.
What I've missed?
P.S. My config: windows 10 as host, vmware player as virtualization, debian 8 as all guests