Linux routing basics

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

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

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 172.30.26.20 gw 192.168.10.20 eth1

linux-routing