lost and found ( for me ? )

How to add static routes permanently on CentOS 5.5 or Ubuntu 10.10

CentOS

Create /etc/sysconfig/network-script/route-eth[x] file.
[x] means interface number.

Here’s an example of adding a static route on eth0
# cat /etc/sysconfig/network-scripts/route-eth0
10.0.0.0/8 via 192.168.0.254


[destination] via [gateway’s IP]

Ubuntu

add static route in /etc/network/interfaces file and then do “/etc/init.d/networking restart” to reflect on it
# add static route
up route add -net 10.0.0.0/8 gw 192.168.0.254 dev eth0

up route add [-host/-net] [address] gw [gateway’s IP] dev [interface number]

# /etc/init.d/networking restart

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.