Route traffic beetween LAN / WAN interface

8,184

Found the soulution by myself.

eth0 = WAN eth1 = LAN

Enable ip forwarding in kernel:

echo 1 > /proc/sys/net/ipv4/ip_forward

Adding iptables rules for nat:

iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT

& restart your network :-)

Share:
8,184

Related videos on Youtube

AgentTux
Author by

AgentTux

Updated on September 18, 2022

Comments

  • AgentTux
    AgentTux over 1 year

    we use an internal little server with a dhcpd service (pxe system). The server has two nic's: - LAN (PXE) - WAN (uplink of remaining company lan / network)

    WAN NIC is auto configured by DHCP server.

    I need to route the traffic beetween these nic's.

    Client's on LAN side should be have an internet connection (internet connection of wan side but there may not be traffic of dhcp on wan).

    How can I implement it ?