Forwarding traffic between 2 interfaces

49,401

Worked when I did:

sysctl -w net.ipv4.conf.all.forwarding=1
Share:
49,401

Related videos on Youtube

Konstantin Tarashchanskiy
Author by

Konstantin Tarashchanskiy

Updated on September 18, 2022

Comments

  • Konstantin Tarashchanskiy
    Konstantin Tarashchanskiy over 1 year

    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 172.16.0.0 netmask 255.255.255.0 gw 172.16.30.1
    

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

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