Adding static routes

From Brandonhutchinson.com

(Difference between revisions)
Jump to: navigation, search
(New page: == Overview == To add static routes that will be preserved after reboot, follow [http://kbase.redhat.com/faq/FAQ_79_2561.shtm How do I configure static routes in Red Hat Enterprise Linux ...)
(Example)
Line 12: Line 12:
# '''route add -net 10.226.223.0/24 gw 149.122.23.9'''
# '''route add -net 10.226.223.0/24 gw 149.122.23.9'''
-
* Add an '''/etc/sysconfig/network-scripts/route-eth0''' to preserve this route across reboots.
+
* Create/edit an '''/etc/sysconfig/network-scripts/route-eth0''' file to preserve this route across reboots.
GATEWAY0=149.122.23.9
GATEWAY0=149.122.23.9
NETMASK0=255.255.255.0
NETMASK0=255.255.255.0
ADDRESS0=10.226.223.0
ADDRESS0=10.226.223.0

Revision as of 18:09, 1 August 2008

Overview

To add static routes that will be preserved after reboot, follow How do I configure static routes in Red Hat Enterprise Linux version 3?

This should work for at least RHEL 3, 4, and 5.

Example

In this example, I want to route traffic for network 10.226.223.0/24 using the gateway 149.122.23.9.

  • Add a route for the current session.
# route add -net 10.226.223.0/24 gw 149.122.23.9
  • Create/edit an /etc/sysconfig/network-scripts/route-eth0 file to preserve this route across reboots.
GATEWAY0=149.122.23.9
NETMASK0=255.255.255.0
ADDRESS0=10.226.223.0
Personal tools