United States (change)
Shortcuts: Downloads Fedora Red Hat Network
Account Links: Cart Your Account Logout
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