LinuxDevCenter.com

oreilly.comSafari Books Online.Conferences.

We've expanded our Linux news coverage and improved our search! Search for all things Linux across O'Reilly!

Search
Search Tips

advertisement

Listen Print Discuss Subscribe to Linux Subscribe to Newsletters

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 /usr/src:

% 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.

Pre-Configuration Steps

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 .o files and old dependencies:

    % make mrproper

Configuring the Kernel

You can use make config, 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.

code maturity level options
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).

loadable module support
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 modprobe with 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.

networking support options
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 in /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 bzImage and 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 called ipv6.o.

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 like this:

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 142.133.100.75
[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).

Conclusion

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.

References

  • Linux Kernel
  • IPv6 Internet
  • OpenSSH

IPv6 Linux Projects:

  • USAGI Project
  • TAHI Project
  • KAME Project
  • Debian IPv6 Project

IPv6 Documentation:

  • Linux IPv6 HOW-TO
  • Linux IPv6 FAQ
  • IPv6 @ Open System Lab

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.


Have a question about configuring IPv6 under Linux? Ask Ibrahim here.
You must be logged in to the O'Reilly Network to post a talkback.
Post Comment
Full Threads Oldest First

Showing messages 1 through 6 of 6.

  • Routing using ipv6
    2004-03-30 02:49:18  psr [Reply | View]

    How to make an ipv6 router such that it listens to fec0::ffff as its prefix
    • Routing using ipv6
      2004-03-31 13:14:19  haddad_i [Reply | View]

      routers in this case are assumed to be configured manually - unless there is some development in this area that I am not aware off.
  • Most (all?) distro's IPv6 enabled out-of-the-box
    2004-01-04 00:23:57  anonymous2 [Reply | View]

    Hi,

    I wonder why all the kernel compiling stuff is describred; for most (all) current distro's, IPv6 is enabled out-of-the-box.

    There's an easy check for this: check if the file /proc/net/if_inet6 exists. If so, just do 'modprobe ipv6' (as root) and you've reached the same as after completing the kernel compiling stuff in the article.

    And if you want IPv6 connectivity to the outside world, go to http://www.prik.net/stuff/ and run the newest script. Even if you're behind Alcatel / Thomson NAT, that script will take care of it.

    Sander


    • Most (all?) distro's IPv6 enabled out-of-the-box
      2004-01-05 04:44:54  anonymous2 [Reply | View]

      Hello Sander,
      Thanks for your feedback. It is true that the latest releases of distros include support for ipv6. However the steps are illustrated & useful for readers not running the latest distro releases & to give readers info on how to enable ipv6 support on their machines themselves.
      As for ipv6 connectivity, it is true that you can download and run a certain script to do that. However, in a follow up article, I will explain how to get an ipv6 connectivity to the outside world using Freenet6, explaining all the steps to the users so they would have knowledge of what they are doing.
      Thanks again for your feedback and I hope you read the upcoming article on connecting Linux machines to the 6bone using the Freenet6 service.
      Best regards,
      Ibrahim
      • Most (all?) distro's IPv6 enabled out-of-the-box
        2004-01-16 05:15:23  anonymous2 [Reply | View]

        I'd like to point out that Freenet6 (and 6bone) are deprecated and will eventually be removed.

        A better way may be to use the 6to4 anycast address, as described here: http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/configuring-ipv6to4-tunnels.html
        • Most (all?) distro's IPv6 enabled out-of-the-box
          2004-01-19 07:43:17  anonymous2 [Reply | View]

          Hello,

          I appologize for late reply. I wanted to double check the infomation before I post my reply.

          As far as addressing:
          - 6bone uses 3ffe::/16
          - "IPv6 Internet" uses 2001::/16 (the allocation of addresses is done by regional registries to
          providers)
          - 6bone is phasing out in 2006 (still a few years...)
          - Freenet6, at this moment, uses 3ffe:b00::/16. I contacted them and they intent to continue supporting freenet6. However, it seems that some "competitors" of Freenet6 are sending false
          messages using the "6bone phasing out" to say that Freenet6 is going south... The reality is that large corporations are still using 3ffe::

          For more info on this, I suggest to contact freenet6 directly.

          Thank you,
          Ibrahim


Tagged Articles

Be the first to post this article to del.icio.us

Sponsored Resources

  • Inside Lightroom
Advertisement

Sponsored by:

O'Reilly Media

©2009, O'Reilly Media, Inc.
(707) 827-7000 / (800) 998-9938
All trademarks and registered trademarks appearing on oreilly.com are the property of their respective owners.
About O'Reilly
Academic Solutions
Authors
Contacts
Customer Service
Jobs
Newsletters
O'Reilly Labs
Press Room
Privacy Policy
RSS Feeds
Terms of Service
User Groups
Writing for O'Reilly
Content Archive
Business Technology
Computer Technology
Google
Microsoft
Mobile
Network
Operating System
Digital Photography
Programming
Software
Web
Web Design
More O'Reilly Sites
O'Reilly Radar
Ignite
Tools of Change for Publishing
Digital Media
Inside iPhone
O'Reilly FYI
makezine.com
craftzine.com
hackszine.com
perl.com
xml.com

Partner Sites
InsideRIA
java.net
O'Reilly Insights on Forbes.com