Powered by coANDco UK

How2 use IPv6

From How2s

This How2 is concerned to people who want to get their first experiences with the new IP address format IPv6 that was designed by the IETF as an intended replacement for the current used IPv4 address format. This How2 is divided into two sections. The first section gives a short introduction to the structure of the new address format. The aim of the second section is to build up a small network running with IPv6.

IPv6 Address Format

IPv6 addresses are similar in spirit to IPv4 addresses except that they are 16 bytes long. The address is splitted in a link and node portion:

1                               64                              128
|            Link                |          Node (EUI-64)         |

The written representation for IPv6 addresses consists of hex values of each of the 16-bit chunks, seperated by colons. For example: 3A57:0:0:9CD5:3312:123D:1302:1979. Because many addresses contain a lot of 0's, a more compact way of representing such addresses can be used. Any substring that looks like :0:0:0: can be replaced with "::". For example ::1302:A5BD would be the address that starts with 96 zero bits. Since there are two types of IPv6 addresses that contain an embedded IPv4 address, these have their own special notation that makes extraction of the IPv4 address easier as for example ::00FF:

The node portion of the address will be a unique ID based on EUI-64. EUI-64 is actually an IEEE effort to expand the well-known 6-byte globally unique MAC-addresses to 8-byte addresss. As long as this new standard is not implemented in the network interfaces it is possible to transform the EUI-48 (MAC-)address into a modified EUI-64 for use by IPv6. Let's say the EUI-48 address the node has is 28-9F-18-1C-82-35. The global/local bit (the seventh bit in the top byte) of this address must be inverted (because in EUI-64 the definition of this bit is flipped), changing the first byte from 28 to 2A. Then you must add 2 bytes (to create an 8-byte quantity out of a 6-byte quantity) by inserting the 2 bytes between the OUI and the rest of the address. IEEE says that the inserted bytes should be FF and FE. So the resulting modified EUI-64 address for use by IPv6 would be 2A-9F-18-FF-FE-1C-82-35.

IPv6 addresses do not have classes, but the address space is still subdivided in various ways based on the leading bits of the link portion of the address. Rather than specifying different address classes, the leading bits specify different uses of the IPv6 address. The current allocation of these prefixes can be checked out at the IANA IPv6 Address Space page. Note that there exist a "link local use" and a "site local use" assignment. The idea behind the first one is to enable a host to construct an address that will work on the network to which it is connected without being concerned about global uniqueness of the address. The second prefix is intended to allow valid addresses to be constructed on a site (e.g., private corporate network) that is not connected to the larger Internet.

Check out RFC 3513 for everything you want to know about the new address format.

Set up IPv6 Network with Linux

This section gives some information how to set up a network with stateless IPv6 autoconfiguration on Linux. On the IPv6 Information Page exist a lot of tutorials for different Operating Systems explaining how to build networks with IPv6 and information how to connect to the world wide IPv6 Backbone "6Bone" that is set up for testing purposes. There exist also a very good tutorial Linux IPv6 HowTo for Linux users.

To build a network with statless IPv6 address autoconfiguration you will need two things:

1. An IPv6 enabled kernel. You most probably have this by default and you could verify this by running "modprobe ipv6", and unless there is an error message everything should be fine.

2. The IPv6 router needs the radvd Linux IPv6 Router Advertisement Daemon software and it is quite easy to install. There exists for example a "radvd rpm" for RedHat.

To set up a network with IPv6 run on every host first modprobe ipv6 to enable IPv6 support and runifconfig -a and inspect which of your interfaces that have IPv6 addresses. Can you see the link-local IPv6 address that was automatically assigned? (If not, maybe you shold first bring up the interface with the command ifconfig <interface> up). If two of your hosts are connected on the same hub, they should be able to communicate using their link local address. Thus, use the program ping6 to ping your neighbor.

#/usr/sbin/ping6 -I <interface> <neighbor-link-local-address>

By the way on an ethernet the link-local-address is formed by concatenating the link-local prefix with interface identifier based on EUI-64 as mentionedin the section above. Although there should not be two hosts using the same interface identifier, a host performs a Duplicate address detection (DAD) procedure to really ensure that no-one is already using the address. It uses "neighbor discovery" messages.

To get a global IPv6 address by using stateless IPv6 address autoconfiguration, a router on your network must announce a prefix (the link part of the address) that you can prepend to your interface identifier. To perform the route advertisement the "radvd" software can be used. To enable IPv6 routing and route advertisement, do the following on your router after the instalation of the radvd.

#sysctl -w net.ipv6.conf.all.forwarding=1
net.ipv6.conf.all.forwarding = 1

That's all. Now you should receive the announcements from the router. Run again ifconfig -a and inspect if you can see your global address. Use ping6 or traceroute6 to some IPv6 address on another network.

Enjoy your IPv6 network!!

Please check out our sponsor, thanks to whom How2s.org is FREE: