Linux routing basics

Posted on Fri 27 August 2010 in Linux • 1 min read

You getting from your ISP a subnet like this,
and your router has the ip !

You need to enable the ip forwarding in the kernel

sysctl -w net.ipv4.ip_forward=1

And we need to enable proxy arp! This is necessary because your router must answer all arp request for hosts other than itself ;)

sysctl -w net.ipv4.conf.eth0.proxy_arp=1
sysctl -w net.ipv4.conf.eth1.proxy_arp=1

Edit your /etc/sysctl.conf !

net.ipv4.ip_forward = 1
net.ipv4.conf.eth0.proxy_arp = 1
net.ipv4.conf.eth1.proxy_arp = 1

If your router has no external ip on the internal nic, you need to setup routes like

route add -host gw eth1