I have a machine with an interface that has two different addresses on CentOS 5
eth0: 10.20.21.77
eth0:1 141.218.1.221
If I issue this command I get the result I'm looking for.
/sbin/route add -net 141.218.1.0 netmask 255.255.255.0 gw 10.20.21.77
ip route show dev eth0
141.218.1.0/24 via 10.20.21.77 scope link
141.218.1.0/24 proto kernel scope link src 141.218.1.221
10.20.21.0/24 proto kernel scope link src 10.20.21.221
169.254.0.0/16 scope link
default via 10.20.21.1
Now I reboot the machine and the route goes away, I've tried creating a file in /etc/sysconfig/network-scripts/route-eth0 that contains
141.218.1.0/24 via 10.20.21.77
Also tried:
141.218.1.0/24 via 10.20.21.77 dev eth0
On a reboot it looks like this...
ip route show dev eth0
141.218.1.0/24 proto kernel scope link src 141.218.1.221
10.20.21.0/24 proto kernel scope link src 10.20.21.77
169.254.0.0/16 scope link
default via 10.20.21.1
Running ifup-routes by hand results with:
./ifup-routes eth0
RTNETLINK answers: File exists
Thanks for any help.