Thursday, 13 March 2008

Adding routes automaticly when booting

If you add a static route for your network you have probably noticed that it disappears when you reboot. This can get annoying as you need to re-add it every time.

To have the route added by default every time you boot add the route to the file /etc/sysconfig/network/routes in the form:
Destination    Gateway    Netmask   Device
So if you want all traffic to the subnet 192.168.2.0 to go through gateway 192.168.1.1 you would use:
192.168.2.0    192.168.1.1   255.255.255.0
Note that device isn't required. If you omit it route will try and figure out the device by your Ethernet device’s settings.

If you want to set a default gateway use the destination of 0.0.0.0

No comments:

Post a Comment