26Nov/090
Configuring Static Routes on Linux
How to configure static routes on linux ?
This question has been asked many times and I decided to keep the answer here. Actually there is no accurate answer because it depends on the distribution. Therefore this solution covers only RedHat and Fedora.
Static route configuration is stored in a /etc/sysconfig/network-scripts/route-interface file. For eth0, static routes would be stored in the /etc/sysconfig/network-scripts/route-eth0 file.
The route-interface file has two formats:
IP Command Arguments Format
default 192.168.0.1 dev eth0 10.0.0.0/24 via 192.168.0.1 dev eth0 192.168.1.0/24 via 192.168.0.1 dev eth0
Network/Netmask Directives Format
ADDRESS0=10.0.0.0 NETMASK0=255.255.255.0 GATEWAY0=192.168.0.1 ADDRESS1=192.168.1.0 NETMASK1=255.255.255.0 GATEWAY1=192.168.0.1
23Nov/09Off
Kernighan’s Law
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it."