Configure Linux As a router

Configure Linux As A Router:

  1. Enable Ip Forwarding in sysctl.conf

net.ipv4.ip_forward=1

Configure Firewall, assuming eth0 as WAN Interface, eth1 is LAN Interface :

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE iptables -A FORWARD -i eth1 -j ACCEPT

Port Forwarding With IPTables :

-A PREROUTING -i eth0 -p tcp -m tcp --dport -j DNAT --to-destination DestinationIP:PortNo