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

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).


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
  • 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

Did you try route6-{interface} in /etc/sysconfig/network-scripts? It should work like route-{interface} does for ipv4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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