LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Add static route for Tunneled range? (http://www.linuxquestions.org/questions/linux-software-2/add-static-route-for-tunneled-range-4175459563/)

ne0shell 04-25-2013 09:15 AM

Add static route for Tunneled range?
 
I need to add a static route to survive restarts for a range that is connected via GRE tunnel.

All the examples I've found are not clear on if I need to create a route config in network scripts for the tunnel device or if it just entered on the eth device. (Centos 6),

Example:

range is 192.168.1.0/24
tunnel gateway is 10.0.0.1
tunnel device is "tun0"
active NIC is "eth0"

Command example given:
echo 192.168.1.0/24 via 10.0.0.1″ >> /etc/sysconfig/network-scripts/route-eth0

Is this correct or should it actually be:

echo 192.168.1.0/24 via 10.0.0.1″ >> /etc/sysconfig/network-scripts/route-tun0

?

(Even the examples here on LQO only show actual NICs, none show tunnel specific setting)

ne0shell 04-26-2013 12:06 AM

I'll answer my own question since I figured it out.

The correct file would be for that actual device so in this example it should be:

/etc/sysconfig/network-scripts/route-tun0


The correct syntax for the entry in the file is not exactly what the echo command I found lists, it should be like this:

192.168.1.0/24 via 10.0.0.1 dev tun0

or, from the cli:

echo 192.168.1.0/24 via 10.0.0.1 >> /etc/sysconfig/network-scripts/route-tun0


All times are GMT -5. The time now is 10:02 AM.