Search My Techie Guy

Wednesday, August 20, 2014

ip route add - rhel 6.2 and making the route persistent through server reboots

Here is how to add an ip route on the rhel 6.2 command line.

ip route add prefix dev interface src interface_ip via gateway

For example:

ip route add 10.6.40.0/24 dev eth3 src 172.27.122.250 via 172.27.122.249

To make this change persistent after server reboots, add the command to the /etc/rc.local script.

# more /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
touch /var/lock/subsys/local
#
ip route add 172.27.97.0/24 dev eth3 src 172.27.122.250 via 172.27.122.249
Post a Comment