Automatically acquire IPV6 address in CentOS 6

centos6ethernetipv6linux-networking

The network has fixed IPv4 address, and automatic acquired IPv6 address. Does anyone have an idea how to setup? Thanks a lot!

I didn't use NetworkManager. The following is my setting, but it does not work 🙁

/etc/sysconfig/network:

NETWORKING=yes 
HOSTNAME=desk.myname.ca 
NETWORKING_IPV6=yes 
IPV6FORWARDING=yes
IPV6_AUTOCONF=yes

/etc/sysconfig/network-scripts/ifcfg-eth0 :

DEVICE=eth0 
TYPE="Ethernet" 
UUID=29b0480a-83aa-4124-ab27-01dda940afv3 
ONBOOT=yes 
NM_CONTROLLED=no 
BOOTPROTO=none 
IPADDR=214.52.131.212 
GATEWAY=214.52.137.1 
NETMASK=255.255.255.0 
DNS1=214.52.101.101 
DNS2=214.52.101.100
NAME="System eth0" 
HWADDR=49:73:E6:CC:6A:26
IPV6INIT=yes 
IPV6_AUTOCONFIG=yes 

I could not get the a global IPV6 address, as shown by the output of ifconfig:

eth0      Link encap:Ethernet  HWaddr 49:73:E6:CC:6A:26  
          inet addr:214.52.131.212 Bcast:214.52.137.255  Mask:255.255.255.0
          inet6 addr: fe80::4637:e6ff:fecc:6a26/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2721783 errors:0 dropped:0 overruns:0 frame:0
          TX packets:526400 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:731944071 (698.0 MiB)  TX bytes:107641953 (102.6 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:3020 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3020 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:92956 (90.7 KiB)  TX bytes:92956 (90.7 KiB)

virbr0    Link encap:Ethernet  HWaddr 79:73:E1:1C:AA:61  
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

Best Answer

In order to do SLAAC, you have to have a router that's sending Router Advertisements (RA), to provide the network prefix and prefix length. That will also have the default gateway.

Something, somewhere on the local subnet needs to send the RAs. Usually its the router, but there are some tools to have a Linux (or BSD) box send the RAs on behalf of the local router, if it' not able (like some home routers).

Also, make sure that you are accepting the RAs. See

net.ipv6.conf.default.accept_ra

net.ipv6.conf.all.accept_ra

and make sure they are set to 1