I have 2 VLANs connected to a 'router'. All the machines can ping other machines within their own VLAN and the router. The router can ping all of the machines. I am trying to get machines to talk to other VLAN via the router.

On the router, the VLANs are on eth1 and eth2. I have added the following iptable rules:

-A FORWARD -i eth1 -o eth2 -j ACCEPT
-A FORWARD -i eth2 -o eth1 -j ACCEPT

On machines within the VLANs I added the following route entry:

route add -net netmask gw

Where 172.16.0.X is the ip address range in the other VLAN and is the router's IP.

What did I do wrong? What did I not do?


Worked when I did:

sysctl -w net.ipv4.conf.all.forwarding=1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.