Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Static routes are forgotten once the network service is restarted. However, IPv4 static routes can be made persistent by adding them to /etc/sysconfig/static_routes. This file is read by the network service when (re)starting and the static routes are added to the routing table.

This is the relevant code from /etc/init.d/network

# Add non interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
    grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
        /sbin/route add -$args
    done
fi

However, no such file seems to exist for IPv6 static routes, which are lost upon network restart. Is editing the /etc/init.d/network script the only way? (So that it reads from a manually created file storing IPv6 routes and adds them to routing table when network (re)starts).

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

I don't run CentOS or Red Hat to check, but some documentation point to /etc/sysconfig/static-routes-ipv6. Complete documentation is available at http://www.deepspace6.net/projects/initscripts-ipv6.html This is the example given:

#Device   IPv6 network to route   IPv6 gateway address
eth0      fec0:0:0:2::/64         fec0:0:0:1:0:0:0:20
eth0      2000::/3                3ffe:ffff:0000:f102:0:0:0:1
share|improve this answer
    
Thanks. How do I add route to IPv6 host instead of network? –  Nitin Garg Sep 27 '12 at 6:23
    
Again, I don't have the resources to test it, but my first guess would be to specify only the interface name and a /128 address: eth0 fd42:0:0:2::1/128 –  Philippe Gauthier Sep 27 '12 at 15:58
    
I looked at the shell scripts called from the network service. And eventually the 'ip' command is called to add the routes. It so happens that even if you mention /128, this command adds the route as a UG and not UGH. Well thanks anyway :) –  Nitin Garg Sep 28 '12 at 15:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.