I have several IPv6 addresses on a CentOS 7 server and need to make a specific v6 address the default address used in routing. I have been able to do this by modifying the route table.
ip -6 route del default ip -6 route add default via 2001:470:xxxx:xx::1 src 2001:470:xxxx:xx::6
Problem is each time the network interface is restarted or the server itself is rebooted, the change to the default IPv6 route is lost. How can I make this change persistent so its permanently kept?
When Red Hat’s networking scripts set multiple IPv6 addresses configured in
/etc/sysconfig/network-scripts/ifcfg-*, for whatever reason, they are applied in reverse order, so that the last address listed in
IPV6ADDR_SECONDARIES becomes the address used by default for outgoing connections. Reversing the order in which IPv6 addresses are listed is generally sufficient to fix the problem.
To answer the only vaguely related bounty question: IPv6 static routes can be set by adding them to a corresponding
/etc/sysconfig/network-scripts/route6-*. The format of this file is the same as the
ip route add command with that bit omitted, e.g.:
default via 2001:db8:dead:beef:: dev eno1 2001:db8:deca:fbad via 2001:db8:dead:beef::8bad:f00d dev eno1
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.