Monday, December 1, 2008

How to add static route to your Linux Fedora machine

To add a default route into your Linux box,
route add -net 0.0.0.0 netmask 0.0.0.0 gw 10.0.0.1
However, if you only execute this command, the route will disappears if you reboot your system.

So, what would be the best way to permanently add that route to your system?

You may add or edit the default gateway on /etc/sysconfig/network file, to make sure your default route setting is preserve after your system boot.

Configuration example on network file:
NETWORKING=yes
HOSTNAME=fedora.frontier.com
GATEWAY=10.0.0.1

You may also add the route add statement into /etc/rc.d/rc.local file so that every time your machine starts this will be executed and your route tables are updated.

No comments:

Post a Comment