How to Create a Persistent Network Route in CentOS/RHEL 6

Routing is normally configured on routing devices, for example, your standard gateway, however if persistent routers are necessary they can be configured for each interface. This post describes how to configure a network route in the configuration files that will be persistent even after a reboot.

1. On CentOS/RHEL 6 systems, create a the file /etc/sysconfig/network-scripts/route-eth0 and set an persistent route for eth0 like:

# vi /etc/sysconfig/network-scripts/route-eth0


This will create two routes, one to the network via and another to network via, both routes will use eth0.

2. There a different syntax that can be used as well: via dev eth0 via dev eth0

Sample route outputs:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use  Iface   UG    0      0        0  eth0   UG    0      0        0  eth0   U     0      0        0  eth1     U     0      0        0  eth1         UG    0      0        0  eth0
# ip route show via dev eth0 via dev eth0 dev eth1  proto kernel  scope link  src dev eth1  scope link
default via dev eth0