(Other routing page: routes.html)
Here’s how to set up Red Hat 7.3 /etc/sysconfig/static-routes file, I mention this here because this had me halted for longer than I wanted to be stuck trying to figure out how exactly this file works:
eth0 v 172.16.0.1 eth1 v 16.1.224.98 eth1 v default gw 16.1.224.1
So this system has 2 static IP addresses, 172.16.0.1 and 16.1.224.98. Looking at my route table I have:
[root@linux root]# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 16.1.224.0 0.0.0.0 255.255.252.0 U 40 0 0 eth1 172.16.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo [root@linux root]#
So I have my loopback and the two networks, but I don’t have any host lines (UH) for the static ip addresses themselves, nor do I have a default gateway (UG), so adding the /etc/sysconfig/static-routes and restarting the networking (service network restart) I then get the following correct route information:
[root@linux root]# netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 172.16.0.1 0.0.0.0 255.255.255.255 UH 40 0 0 eth0 16.1.224.98 0.0.0.0 255.255.255.255 UH 40 0 0 eth1 16.1.224.0 0.0.0.0 255.255.252.0 U 40 0 0 eth1 172.16.0.0 0.0.0.0 255.255.0.0 U 40 0 0 eth0 127.0.0.0 0.0.0.0 255.0.0.0 U 40 0 0 lo 0.0.0.0 16.1.224.1 0.0.0.0 UG 40 0 0 eth1 [root@linux root]#