Wednesday, July 16, 2008

Configuring IPv6 in CentOS Linux

To configure an IPv6 address manually into your CentOS Linux, there are several files that you can choose to change to:

/etc/sysconfig/networking/profiles/default/ifcfg-eth0
/etc/sysconfig/networking/devices/ifcfg-eth0
/etc/sysconfig/network-scripts/ifcfg-eth0


Choose only one from those files and add the following lines:

IPV6INIT=yes
IPV6ADDR=2001:db8:1234:5678:0001:0002:dead:beef/64

Then, restart your network interface for changes to take effect:

#/etc/init.d/network restart
or
#service network restart

Check your interface configuration:

# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0c:29:cf:3f:18
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
---> inet6 addr: 2001:db8:1234:5678:0001:0002:dead:beef/64 Scope:Global
inet6 addr: fe80::20c:29ff:fecf:3f18/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4344229 errors:0 dropped:0 overruns:0 frame:0
TX packets:1734857 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:2992698082 (2.7 GiB) TX bytes:102015418 (97.2 MiB)
Interrupt:217 Base address:0x400

Observe the line pointed by the arrow, you have now a global IPv6 address.

IPv6 Documentation Prefix


The IPv6 prefix 2001:db8::/32 that we used in this article is for documentation or experimentation purposes only. But you can still use this address in your local network if you like. If you want more information about this prefix you can visit APNIC's FAQ about IPv6 Documentation Prefix or read RFC 3849: IPv6 Address Prefix Reserved for Documentation.


No comments: