Configure Linux as a Router
Routing is forwarding data traffic between two or more computer networks according to given routing rules. Router perform this action which is connected to two or more data lines from different networks. When a data packet comes in on one of the lines, the router reads the network address information in the packet to determine the ultimate destination. Then, using information in its routing table or routing policy, it directs the packet to the next network on its journey. To reach internet for the PC or Laptop in above network, Linux box has to be configured as a router. It should route internal traffic to ISP router and internet traffic back to local network. We have two different methods to do this. Method 1. NAT local network from Linux box This can be easily done with just a simple configuration on your Linux box. First you need to enable ip forwarding in your kernel parameters and then adding a NAT rule to iptables as follows. echo 1 > /proc/sys/net/ipv4/ip_forw