1

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

Arenim
  • 227
  • 1
  • 3
  • 9

1 Answers1

4

As you don't mention you added a route on the third system, I'm guessing the problem is that the third system doesn't know how to route return packets to 172.28.11.0/24. So you need to add a route there.

Note that the route command has been deprecated in linux for a very long time now. You should familiarize yourself with the ip command, it is very powerful and you can do all sorts of interesting routing tricks with it.

You can add the required route on the third system thusly:

ip route add 172.28.11.0/24 via 172.28.18.2
wurtel
  • 3,864
  • 12
  • 15