CentOS – IPv6 – use slaac for router and first IP but statically add second address

anthonysomerset asked:

With IPv6 networking we prefer to configure as little as possible on the end device and rely on SLAAC to configure, default route and address info. and then manually add additional addresses as needed without interfering with SLAAC operations.

On Ubuntu this is trivial:

iface ens192 inet6 auto
    up /sbin/ip -6 addr add some:pref:ix::some:suff:ix/64 dev $IFACE

and the relevant ifconfig output like this:

ens192    Link encap:Ethernet  HWaddr 00:50:56:xx:xx:xx  
      inet addr:xxx.xxx.xxx.xxx  Bcast:xxx.xxx.xxx.xxx  Mask:
      inet6 addr: some:pref:ix::some:suff:ix/64 Scope:Global
      inet6 addr: fe80::250:56ff:xxxx:xxxx/64 Scope:Link
      inet6 addr: some:pref:ix::defa:ult:suff:ix/64 Scope:Global

However i’m struggling to work out how i might achieve similar results in CentOS or other Redhat based (specifically 6.x) releases

My answer:

In /etc/sysconfig/network-scripts/ifcfg-ens192 you will set IPV6ADDR_SECONDARIES to a space-separated list of IPv6 addresses and prefixes.

For example:

IPV6ADDR_SECONDARIES="2001:db8:f107:30::2a/64 2001:db8:f107:30::2b/64"

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.