Account Links: Cart | Your Account | Logout

Skip to content

Red Hat Knowledgebase

Red Hat Knowledgebase Search:

Updated Within the Last:

New Solutions within the last day New Solutions within the last week New Solutions within the last month

Browse by topics:


Click to View a Topic
Red Hat Enterprise Linux > AS/ES/WS v. 4 > Issue <<  36 of 628 >>

Solution Tools:


Email a Solution Postcard Printer version Submit a comment on this answer Update notifications Request an answer Back

Article Reference

Article ID: 9670
Last update: 04-10-08
Issue:
How do I create persistent static routes in Red Hat Enterprise Linux 4?
Resolution:

To add a persistent static route, create the following file for each ethX device.

/etc/sysconfig/network-scripts/route-ethX

Every entry or a route has three lines as follows:

GATEWAY<N>=xxx.xxx.xxx.xxx
NETMASK<N>=yyy.yyy.yyy.yyy
ADDRESS<N>=zzz.zzz.zzz.zzz

As the names implies, they are the gateway IP, Netmask and the IP/Network Address.

Note the <N> next to each of the three entities. This number defines the route entry number and should be the same on all the entities.

Example:


GATEWAY0=192.168.1.1
NETMASK0=255.255.255.0
ADDRESS0=10.10.10.0

GATEWAY1=192.168.1.1
NETMASK1=255.255.255.0
ADDRESS1=20.20.20.2

Restart the network.

To dynamically add a route execute the following command:

# ip route add <Net/IP>/Netmask> via <Gateway IP> dev <InterfaceX>

Example:

# ip route add 10.10.10.0/24 via 192.168.1.1 dev eth0

Confirm with following command:

# ip route show


How well did this entry answer your question?


good wrong incomplete out of date
Red Hat Enterprise Linux > AS/ES/WS v. 4 > Issue <<   36  of  628  >>