I have a Linux box with two NICs, each connected to a different LAN:
- Network A:
192.168.1.0
255.255.255.0
- Network B:
192.168.2.0
255.255.255.0
The routers are:
192.168.1.1
192.168.2.1
Linux NICs are:
192.168.1.2
192.168.2.2
I want all hosts in network A to be able to ping all hosts in network B and vice versa.
What I've done so far:
On a Linux box: sudo sysctl -w net.ipv4.ip_forward=1
On 192.168.1.1: route add 192.168.2.0 255.255.255.0 gw 192.168.1.2
On 192.168.2.1: route add 192.168.1.0 255.255.255.0 gw 192.168.2.2
I tried it with two different linux distributions (Zentyal and Ubuntu) and nothing's working.
Hosts in network A can only ping 192.168.2.2
, but can’t ping any of the other hosts in network B and vice versa. What am I doing wrong?