Enabling IPv6 in Linux
Pages: 1, 2
Supporting IPv6 in the Linux Kernel
IPv6 support can be enabled as a built-in kernel feature or as a loadable module. First, we will demonstrate how to support IPv6 as a built-in feature of the kernel, and then as a kernel module that can be loaded and unloaded as needed. For the purpose of this article, we will be using a Linux test machine running Red Hat 9.0 and the official kernel version 2.6.0-test9, which was available at the time of writing this article (November 2003). However, you can follow the same steps for virtually any kernel version.
Download and Unpack
You need to download the latest kernel version and uncompress it;
alternatively, you can use whatever kernel version is already available on your
system. I would assume, though, that you’d want to try the latest and greatest version. Download the compressed source and
uncompress it under
% cd /usr/src % bunzip2 linux-2.6.0-test9.tar.bz2 % tar -xvf linux-2.6.0-test9.tar
A directory called linux-2.6.0-test9 will be created.
Before you can configure the kernel, you need to perform a few steps:
Delete the symbolic link to the older kernel source tree:
% rm linux
Create a symbolic link to the new kernel source tree:
% ln -s linux-2.6.0-test9 linux
Move into the kernel source directory:
% cd linux
Make sure to clean up any existing
.ofiles and old dependencies:
% make mrproper
Configuring the Kernel
You can use
make menuconfig, or
make xconfig to configure the kernel. We'll use the latter here.
There are three areas where you need to update the kernel configuration; we
will explain all of them.
Figure 2. Code maturity level options.
Since IPv6 is still an experimental feature, you need to enable the "Prompt for development and/or incomplete code/driver" option to be able to have the option to activate IPv6 support in a later configuration option (see Figure 2).
Figure 3. Loadable module support.
In most systems, the option "Enable loadable module support" is enabled by default, as shown in Figure 3. You can also enable the following options:
Module Unloading and Forced Module Unloading. Enable these options if you want to be able to unload a module or force a module to unload, even if the kernel believes it is unsafe.
Module Versioning Support (EXPERIMENTAL). If you enable this option, it will be possible sometimes to load modules compiled against a different kernel version. This is not required in our case since you are compiling the IPv6 module with the same kernel you are running. However, you can enable it.
Automatic Kernel Module Loading. If you enable this option, then when needed, the kernel will be able to load modules for itself: when a part of the kernel needs a module, it will run
modprobewith the appropriate arguments, thereby loading the module if it is available.
To enable support for IPv6, you need to enable the "IPv6 protocol (EXPERIMENTAL)" either as a built-in kernel feature or as a module, as shown in Figure 4.
Figure 4. Networking support options.
Compiling and Installing the New Kernel
After enabling these options, save the configuration and exit the kernel configuration tool. Now you are ready to compile the kernel.
% make bzImage
The result of the compilation will be a new compressed kernel image created
/usr/src/linux/arch/i386/boot/ (or the appropriate
architecture-specific directory for your computer). If you compiled some
features as loadable modules, you should compile and install the modules:
% make modules % make modules_install
You can now copy the new kernel image
System.map to your boot directory:
% cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.0-test9-ipv6 % cp /usr/src/linux/System.map /boot/System.map-2.6.0-test9-ipv6 % rm /boot/System.map % ln -fs /boot/System.map-2.6.0-test9-ipv6 /boot/System.map
If you configured IPv6 support as a module, a module will be created in
/lib/modules/linux-2.6.0-test9/kernel/net/ipv6. The module is
Updating your Bootloader Configuration
If you use LILO, you need to add a new entry in the LILO configuration file
/etc/lilo.conf) for your freshly-compiled kernel. At boot time,
you'll see this entry in the list of kernels to boot. A sample entry will look
Image=/boot/vmlinuz-2.6.0-test9-ipv6 label=2.6.0-test9-ipv6 root=/dev/hda1 read-only
Make sure that the
root directive refers to the correct partition on
your system. Next, run
/sbin/lilo to install the bootloader with
the new configuration options.
After following these steps, you will have a boot-time entry called
2.6.0-test9-ipv6. We recommend that you do not set this new image
as the default at first; it is best to try it and make sure it works before you
set it as a default boot image or delete a known-good entry.
On the other hand, if you use grub as your bootloader, add an entry to the
/etc/grub.conf configuration file as follows:
title 2.6.0-test9-ipv6 root (hd0,0) kernel /vmlinuz-2.6.0-test9-ipv6 ro root=/dev/hda1
Please remember that you need to update this entry to reflect your disk partitioning.
Rebooting with the New Kernel
You are now ready to reboot your Linux machine with the new kernel:
% shutdown -r now
When the bootloader prompt comes up, choose to boot with
2.6.0-test9-ipv6. After rebooting, if you compiled IPv6 as a
module, load that module:
% insmod ipv6
Testing your Configuration
Now you can verify the network interfaces on your Linux machine by typing
ifconfig at the command prompt.
[root@pgtest1-ibha root]# ifconfig eth0 Link encap:Ethernet HWaddr 00:50:8B:F1:6A:D0 inet addr:192.168.15.70 Bcast: 192.168.15.255 Mask:255.255.255.0 inet6 addr: fec0::1:250:8bff:fef1:6ad0/64 Scope:Site inet6 addr: fe80::250:8bff:fef1:6ad0/10 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:28134 errors:0 dropped:0 overruns:0 frame:0 TX packets:4351 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:1719007 (1.6 Mb) TX bytes:352632 (344.3 Kb) Interrupt:5 Base address:0x1000 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:394 errors:0 dropped:0 overruns:0 frame:0 TX packets:394 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:47176 (46.0 Kb) TX bytes:47176 (46.0 Kb) [root@pgtest1-ibha root]#
You can also test by pinging your IPv6 loopback address and your link local address.
[root@pgtest1-ibha root]# ping6 ::1 PING ::1(::1) from ::1 : 56 data bytes 64 bytes from ::1: icmp_seq=1 ttl=64 time=0.052 ms 64 bytes from ::1: icmp_seq=2 ttl=64 time=0.046 ms 64 bytes from ::1: icmp_seq=3 ttl=64 time=0.044 ms 64 bytes from ::1: icmp_seq=4 ttl=64 time=0.047 ms 64 bytes from ::1: icmp_seq=5 ttl=64 time=0.046 ms --- ::1 ping statistics --- 5 packets transmitted, 5 received, 0% loss, time 3997ms rtt min/avg/max/mdev = 0.044/0.047/0.052/0.002 ms [root@pgtest1-ibha root]# [root@pgtest1-ibha root]# ping6 fec0::1:250:8bff:fef1:6ad0 PING fec0::1:250:8bff:fef1:6ad0(fec0::1:250:8bff:fef1:6ad0) from ::1 : 56 data bytes 64 bytes from fec0::1:250:8bff:fef1:6ad0: icmp_seq=1 ttl=64 time=0.043 ms 64 bytes from fec0::1:250:8bff:fef1:6ad0: icmp_seq=2 ttl=64 time=0.057 ms 64 bytes from fec0::1:250:8bff:fef1:6ad0: icmp_seq=3 ttl=64 time=0.047 ms --- fec0::1:250:8bff:fef1:6ad0 ping statistics --- 3 packets transmitted, 3 received, 0% loss, time 2000ms rtt min/avg/max/mdev = 0.043/0.049/0.057/0.005 ms [root@pgtest1-ibha root]#
If you try to ssh over IPv6, you'll see something like this:
[root@pgtest1-ibha root]# ssh -6 fec0::1:250:8bff:fef1:6ad0 The authenticity of host 'fec0::1:250:8bff:fef1:6ad0 (fec0::1:250:8bff:fef1:6ad0)' can't be established. RSA key fingerprint is b6:1b:d2:62:03:0c:d4:a0:61:46:50:9b:6e:03:5b:05. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'fec0::1:250:8bff:fef1:6ad0' (RSA) to the list of known hosts. root@fec0::1:250:8bff:fef1:6ad0's password: Last login: Thu Nov 6 20:09:08 2003 from 188.8.131.52 [root@pgtest1-ibha root]#
Since you do not yet have a global IPv6 address, you are limited to test with your own machine and the machines sitting on the same local link (vlan).
This article introduced IPv6, along with a step-by-step tutorial on supporting IPv6 on your Linux machine. An upcoming article will demonstrate how to connect your Linux machine, now IPv6-enabled, to the IPv6 Internet, which will also allow you to have all kinds of testing and functionalities over IPv6.
IPv6 Linux Projects:
Ibrahim Haddad is the Director of Technology for the Software Operations Group (Home & Network Mobility Business Unit) at Motorola Inc.
Return to the LinuxDevCenter.com.
Routing using ipv6
2004-03-30 02:49:18 psr [View]
Routing using ipv6
2004-03-31 13:14:19 haddad_i [View]
2004-01-04 00:23:57 anonymous2 [View]
Most (all?) distro's IPv6 enabled out-of-the-box
2004-01-05 04:44:54 anonymous2 [View]