Linux IPv6 HOWTO (en) Peter Bieringer pb at bieringer dot de Revision History Revision 0.61 2007-10-06 Revised by: PB Revision 0.60 2007-05-31 Revised by: PB Revision 0.51 2006-11-08 Revised by: PB The goal of the Linux IPv6 HOWTO is to answer both basic and advanced questions about IPv6 on the Linux operating system. This HOWTO will provide the reader with enough information to install, configure, and use IPv6 applications on Linux machines. Intermediate releases of this HOWTO are available at [http://mirrors.bieringer.de/Linux+IPv6-HOWTO/] mirrors.bieringer.de or [http://mirrors.deepspace6.net/Linux+IPv6-HOWTO/] mirrors.deepspace6.net. See also revision history for changes. ----------------------------------------------------------------------------- Table of Contents 1. General 1.1. Copyright, license and others 1.2. Category 1.3. Version, History and To-Do 1.4. Translations 1.5. Technical 1.6. Preface 1.7. Used terms, glossary and shortcuts 1.8. Requirements for using this HOWTO 2. Basics 2.1. What is IPv6? 2.2. History of IPv6 in Linux 2.3. What do IPv6 addresses look like? 2.4. FAQ (Basics) 3. Address types 3.1. Addresses without a special prefix 3.2. Network part, also known as prefix 3.3. Address types (host part) 3.4. Prefix lengths for routing 4. IPv6-ready system check 4.1. IPv6-ready kernel 4.2. IPv6-ready network configuration tools 4.3. IPv6-ready test/debug programs 4.4. IPv6-ready programs 4.5. IPv6-ready client programs (selection) 4.6. IPv6-ready server programs 4.7. FAQ (IPv6-ready system check) 5. Configuring interfaces 5.1. Different network devices 5.2. Bringing interfaces up/down 6. Configuring IPv6 addresses 6.1. Displaying existing IPv6 addresses 6.2. Add an IPv6 address 6.3. Removing an IPv6 address 7. Configuring normal IPv6 routes 7.1. Displaying existing IPv6 routes 7.2. Add an IPv6 route through a gateway 7.3. Removing an IPv6 route through a gateway 7.4. Add an IPv6 route through an interface 7.5. Removing an IPv6 route through an interface 7.6. FAQ for IPv6 routes 8. Neighbor Discovery 8.1. Displaying neighbors using ??ip?? 8.2. Manipulating neighbors table using ??ip?? 9. Configuring IPv6-in-IPv4 tunnels 9.1. Types of tunnels 9.2. Displaying existing tunnels 9.3. Setup of point-to-point tunnel 9.4. Setup of 6to4 tunnels 10. Configuring IPv4-in-IPv6 tunnels 11. Kernel settings in /proc-filesystem 11.1. How to access the /proc-filesystem 11.2. Entries in /proc/sys/net/ipv6/ 11.3. IPv6-related entries in /proc/sys/net/ipv4/ 11.4. IPv6-related entries in /proc/net/ 12. Netlink-Interface to kernel 13. Network debugging 13.1. Server socket binding 13.2. Examples for tcpdump packet dumps 14. Support for persistent IPv6 configuration in Linux distributions 14.1. Red Hat Linux and ??clones?? 14.2. SuSE Linux 14.3. Debian Linux 15. Auto-configuration 15.1. Stateless auto-configuration 15.2. Stateful auto-configuration using Router Advertisement Daemon (radvd) 15.3. Dynamic Host Configuration Protocol v6 (DHCPv6) 16. Mobility 16.1. Common information 17. Firewalling 17.1. Firewalling using netfilter6 17.2. Preparation 17.3. Usage 18. Security 18.1. Node security 18.2. Access limitations 18.3. IPv6 security auditing 19. Encryption and Authentication 19.1. Modes of using encryption and authentication 19.2. Support in kernel (ESP and AH) 19.3. Automatic key exchange (IKE) 19.4. Additional informations: 20. Quality of Service (QoS) 21. Hints for IPv6-enabled daemons 21.1. Berkeley Internet Name Daemon BIND (named) 21.2. Internet super daemon (xinetd) 21.3. Webserver Apache2 (httpd2) 21.4. Router Advertisement Daemon (radvd) 21.5. Dynamic Host Configuration v6 Server (dhcp6s) 21.6. tcp_wrapper 21.7. vsftpd 21.8. proftpd 21.9. Other daemons 22. Programming 22.1. Programming using C-API 22.2. Other programming languages 23. Interoperability 24. Further information and URLs 24.1. Paper printed books, articles, online reviews (mixed) 24.2. Conferences, Meetings, Summits 24.3. Online information 24.4. IPv6 Infrastructure 24.5. Maillists 24.6. Online tools 24.7. Trainings, Seminars 24.8. 'The Online Discovery' ... 25. Revision history / Credits / The End 25.1. Revision history 25.2. Credits 25.3. The End ----------------------------------------------------------------------------- Chapter 1. General Information about available translations you will find in section Translations. ----------------------------------------------------------------------------- 1.1. Copyright, license and others 1.1.1. Copyright Written and Copyright (C) 2001-2007 by Peter Bieringer ----------------------------------------------------------------------------- 1.1.2. License This Linux IPv6 HOWTO is published under GNU GPL version 2: The Linux IPv6 HOWTO, a guide how to configure and use IPv6 on Linux systems. Copyright © 2001-2007 Peter Bieringer This documentation is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ----------------------------------------------------------------------------- 1.1.3. About the author 1.1.3.1. Internet/IPv6 history of the author   * 1993: I got in contact with the Internet using console based e-mail and news client (e.g. look for ??e91abier?? on [http://groups.google.com/] groups.google.com, that's me).   * 1996: I got a request for designing a course on IPv6, including a workshop with the Linux operating system.   * 1997: Started writing a guide on how to install, configure and use IPv6 on Linux systems, called [http://www.bieringer.de/linux/IPv6/] IPv6 & Linux - HowTo (see [http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/ IPv6-HOWTO-0.html#history] IPv6 & Linux - HowTo/History for more information).   * 2001: Started writing this new Linux IPv6 HOWTO. ----------------------------------------------------------------------------- 1.1.3.2. Contact The author can be contacted via e-mail at and also via his [http://www.bieringer.de/pb/] homepage. He's currently living in Munich [northern part of Schwabing] / Bavaria / Germany (south) / Europe (middle) / Earth (surface/mainland). ----------------------------------------------------------------------------- 1.2. Category This HOWTO should be listed in category ??Networking/Protocols??. ----------------------------------------------------------------------------- 1.3. Version, History and To-Do 1.3.1. Version The current version is shown at the beginning of the document. CVS information: CVS-ID: $Id: Linux+IPv6-HOWTO.sgml,v 1.39 2007/10/06 15:44: 58 pbldp Exp $ For other available versions/translations see also [http://www.bieringer.de/ linux/IPv6/] http://www.bieringer.de/linux/IPv6/. ----------------------------------------------------------------------------- 1.3.2. History 1.3.2.1. Major history 2001-11-30: Starting to design new HOWTO. 2002-01-02: A lot of content completed, first public release of chapter 1 (version 0.10). 2002-01-14: More completed, some reviews, public release of the whole document (version 0.14). 2002-08-16: Polish translation is in progress 2002-10-31: Chinese translation is available (see Translations for more) 2002-11-10: German translation is in progress 2003-02-10: German translation is available 2003-04-09: French translation is in progress 2003-05-09: French translation is available 2003-08-15: Spanish translation is in progress 2003-10-16: Italian translation is in progress 2004-03-12: Italian translation is available 2004-06-18: Greek translation is in progress 2004-08-29: Spanish translation is still NOT in progress 2005-07-25: Turkish translation is availble 2007-03-28: Portuguese-Brazil is in progress ----------------------------------------------------------------------------- 1.3.2.2. Full history See revision history at the end of this document. ----------------------------------------------------------------------------- 1.3.3. To-Do   * Fill in missing content   * Finishing grammar checking ----------------------------------------------------------------------------- 1.4. Translations Translations always have to contain the URL, version number and copyright of the original document (but yours, too). Pls. don't translate the original changelog, this is not very useful - also do not translate the full section about available translations, can be run out-of-date, add an URL to this section here in the English howto. Looks like the document's change frequency is mostly less than once per month. Since version 0.27 it looks like that most of the content contributed by me has been written. Translations always have to use the English version as source. ----------------------------------------------------------------------------- 1.4.1. To language Note: an overview with URLs can be found at [http://www.bieringer.de/linux/ IPv6/] http://www.bieringer.de/linux/IPv6/. ----------------------------------------------------------------------------- 1.4.1.1. Chinese A Chinese translation by Burma Chen (announced to me at 2002-10-31) can be found on the TLDP: [http://www.ibiblio.org/pub/Linux/ docs/HOWTO/translations/zh/Linux-IPv6-HOWTO.txt.gz] http://www.ibiblio.org/ pub/Linux/docs/HOWTO/translations/zh/Linux-IPv6-HOWTO.txt.gz (g'zipped txt). It's a snapshot translation, don't know whether kept up-to-date. ----------------------------------------------------------------------------- 1.4.1.2. Polish Since 2002-08-16 a Polish translation was started and is still in progress by Lukasz Jokiel . Taken source: CVS-version 1.29 of LyX file, which was source for howto version 0.27. Status is still work-in-progress (2004-08-30). ----------------------------------------------------------------------------- 1.4.1.3. German With 2002-11-10 a German translation was started by Georg Käfer and the first public version was published 2003-02-10. It's originally available on Deep Space 6 at [http://mirrors.deepspace6.net/ Linux+IPv6-HOWTO-de/] http://mirrors.deepspace6.net/Linux+IPv6-HOWTO-de/ (mirrored e.g. on [http://mirrors.bieringer.de/Linux+IPv6-HOWTO-de/] http:// mirrors.bieringer.de/Linux+IPv6-HOWTO-de/). This version will stay up-to-date as much as possible. ----------------------------------------------------------------------------- 1.4.1.4. French With 2003-04-09 a French translation was started by Michel Boucey and the first public version was published 2003-05-09. It's originally available on Deep Space 6 at [http://mirrors.deepspace6.net/ Linux+IPv6-HOWTO-fr/] http://mirrors.deepspace6.net/Linux+IPv6-HOWTO-fr/ (mirrored e.g. on [http://mirrors.bieringer.de/Linux+IPv6-HOWTO-fr/] http:// mirrors.bieringer.de/Linux+IPv6-HOWTO-fr/). ----------------------------------------------------------------------------- 1.4.1.5. Spanish The first try of a Spanish translations ran into ressource problem, currently I got two other ones, status will be updated when more information is available. ----------------------------------------------------------------------------- 1.4.1.6. Italian With 2003-10-16 a Italian translation was started by Michele Ferritto for the [http://ildp.pluto.linux.it/] ILDP (Italian Linux Documentation Project) and the first public version was published 2004-03-12. It's originally available on the ILDP at [http:// it.tldp.org/HOWTO/Linux+IPv6-HOWTO/] http://it.tldp.org/HOWTO/ Linux+IPv6-HOWTO/. ----------------------------------------------------------------------------- 1.4.1.7. Japanese On 2003-05-14 Shino Taketani send me a note that he planned to translate the HowTo into Japanese. ----------------------------------------------------------------------------- 1.4.1.8. Greek On 2004-06-18 Nikolaos Tsarmpopoulos send me a note that he planned to translate the HowTo into Greek. ----------------------------------------------------------------------------- 1.4.1.9. Turkish On 2005-07-18 Necdet Yucel send me a note that a Turkish translation is available. It's a snapshot translation and can be found at [http://www.belgeler.org/howto/ipv6-howto.html] http:// www.belgeler.org/howto/ipv6-howto.html. ----------------------------------------------------------------------------- 1.4.1.10. Portuguese-Brazil On 2007-03-28 Claudemir da Luz send me a note that he planned to translate the HowTo in Portuguese-Brazil. ----------------------------------------------------------------------------- 1.5. Technical 1.5.1. Original source of this HOWTO This HOWTO is currently written with LyX version 1.5.1 on a Fedora Core 7 system with template SGML/XML (DocBook book). It's available on [http:// cvs.tldp.org/go.to/LDP/LDP/users/Peter-Bieringer/] TLDP-CVS / users / Peter-Bieringer for contribution. ----------------------------------------------------------------------------- 1.5.1.1. Code line wrapping Code line wrapping is done using selfmade utility ??lyxcodelinewrapper.pl??, you can get it from CVS for your own usage: [http://cvs.tldp.org/go.to/LDP/ LDP/users/Peter-Bieringer/] TLDP-CVS / users / Peter-Bieringer ----------------------------------------------------------------------------- 1.5.1.2. SGML generation SGML/XML is generated using export function in LyX. ----------------------------------------------------------------------------- 1.5.2. On-line references to the HTML version of this HOWTO (linking/anchors) 1.5.2.1. Master index page Generally, a reference to the master index page is recommended. ----------------------------------------------------------------------------- 1.5.2.2. Dedicated pages Because the HTML pages are generated out of the SGML file, the HTML filenames turn out to be quite random. However, some pages are tagged in LyX, resulting in static names. These tags are useful for references and shouldn't be changed in the future. If you think that I have forgotten a tag, please let me know, and I will add it. ----------------------------------------------------------------------------- 1.6. Preface Some things first: ----------------------------------------------------------------------------- 1.6.1. How many versions of a Linux & IPv6 related HOWTO are floating around? Including this, there are three (3) HOWTO documents available. Apologies, if that is too many ;-) ----------------------------------------------------------------------------- 1.6.1.1. Linux IPv6 FAQ/HOWTO (outdated) The first IPv6 related document was written by Eric Osborne and called [http: //www.linuxhq.com/IPv6/] Linux IPv6 FAQ/HOWTO (please use it only for historical issues). Latest version was 3.2.1 released July, 14 1997. Please help: if someone knows the date of birth of this HOWTO, please send me an e-mail (information will be needed in ??history??). ----------------------------------------------------------------------------- 1.6.1.2. IPv6 & Linux - HowTo (maintained) There exists a second version called [http://www.bieringer.de/linux/IPv6/] IPv6 & Linux - HowTo written by me (Peter Bieringer) in pure HTML. It was born April 1997 and the first English version was published in June 1997. I will continue to maintain it, but it will slowly fade (but not full) in favour of the Linux IPv6 HOWTO you are currently reading. ----------------------------------------------------------------------------- 1.6.1.3. Linux IPv6 HOWTO (this document) Because the [http://www.bieringer.de/linux/IPv6/] IPv6 & Linux - HowTo is written in pure HTML it's not really compatible with the [http://www.tldp.org /] The Linux Documentation Project (TLDP). I (Peter Bieringer) got a request in late November 2001 to rewrite the [http://www.bieringer.de/linux/IPv6/] IPv6 & Linux - HowTo in SGML. However, because of the discontinuation of that HOWTO ([http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO-0.html# history] Future of IPv6 & Linux - HowTo), and as IPv6 is becoming more and more standard, I decided to write a new document covering basic and advanced issues which will remain important over the next few years. More dynamic and some advanced content will be still found further on in the second HOWTO ([http://www.bieringer.de/linux/IPv6/] IPv6 & Linux - HowTo). ----------------------------------------------------------------------------- 1.7. Used terms, glossary and shortcuts 1.7.1. Network related Base 10 Well known decimal number system, represent any value with digit 0-9. Base 16 Usually used in lower and higher programming languages, known also as hexadecimal number system, represent any value with digit 0-9 and char A-F (case insensitive). Base 85 Representation of a value with 85 different digits/chars, this can lead to shorter strings but never seen in the wild. Bit Smallest storage unit, on/true (1) or off/false (0) Byte Mostly a collection of 8 (but not really a must - see older computer systems) bits Device Here, hardware of network connection, see also NIC Dual homed host A dual homed host is a node with two network (physical or virtual) interfaces on two different links, but does not forward any packets between the interfaces. Host Generally a single homed host on a link. Normally it has only one active network interface, e.g. Ethernet or (not and) PPP. Interface Mostly same as ??device??, see also NIC IP Header Header of an IP packet (each network packet has a header, kind of is depending on network layer) Link A link is a layer 2 network packet transport medium, examples are Ethernet, Token Ring, PPP, SLIP, ATM, ISDN, Frame Relay,... Node A node is a host or a router. Octet A collection of 8 real bits, today also similar to ??byte??. Port Information for the TCP/UDP dispatcher (layer 4) to transport information to upper layers Protocol Each network layer contains mostly a protocol field to make life easier on dispatching transported information to upper layer, seen in layer 2 (MAC) and 3 (IP) Router A router is a node with two or more network (physical or virtual) interfaces, capable of forwarding packets between the interfaces. Socket An IP socket is defined by source and destination IP addresses and Ports and (binding) Stack Network related a collection of layers Subnetmask IP networks uses bit masks to separate local networks from remote ones Tunnel A tunnel is typically a point-to-point connection over which packets are exchanged which carry the data of another protocol, e.g. an IPv6-in-IPv4 tunnel. ----------------------------------------------------------------------------- 1.7.1.1. Shortcuts ACL Access Control List API Application Programming Interface ASIC Application Specified Integrated Circuit BSD Berkeley Software Distribution CAN-Bus Controller Area Network Bus (physical bus system) ISP Internet Service Provider KAME Project - a joint effort of six companies in Japan to provide a free IPv6 and IPsec (for both IPv4 and IPv6) stack for BSD variants to the world [http://www.kame.net/] www.kame.net LIR Local Internet Registry NIC Network Interface Card RFC Request For Comments - set of technical and organizational notes about the Internet USAGI UniverSAl playGround for Ipv6 Project - works to deliver the production quality IPv6 protocol stack for the Linux system. ----------------------------------------------------------------------------- 1.7.2. Document related 1.7.2.1. Long code line wrapping signal char The special character ??¬?? is used for signaling that this code line is wrapped for better viewing in PDF and PS files. ----------------------------------------------------------------------------- 1.7.2.2. Placeholders In generic examples you will sometimes find the following: +---------------------------------------------------------------------------+ | | +---------------------------------------------------------------------------+ For real use on your system command line or in scripts this has to be replaced with relevant content (removing the < and > of course), the result would be e.g. +---------------------------------------------------------------------------+ |1.2.3.4 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 1.7.2.3. Commands in the shell Commands executable as non-root user begin with $, e.g. +---------------------------------------------------------------------------+ |$ whoami | +---------------------------------------------------------------------------+ Commands executable as root user begin with #, e.g. +---------------------------------------------------------------------------+ |# whoami | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 1.8. Requirements for using this HOWTO 1.8.1. Personal prerequisites 1.8.1.1. Experience with Unix tools You should be familiar with the major Unix tools e.g. grep, awk, find, ... , and know about their most commonly used command-line options. ----------------------------------------------------------------------------- 1.8.1.2. Experience with networking theory You should know about layers, protocols, addresses, cables, plugs, etc. If you are new to this field, here is one good starting point for you: [http:// www.rigacci.org/docs/biblio/online/intro_to_networking/book1.htm] http:// www.rigacci.org/docs/biblio/online/intro_to_networking/book1.htm ----------------------------------------------------------------------------- 1.8.1.3. Experience with IPv4 configuration You should definitely have some experience in IPv4 configuration, otherwise it will be hard for you to understand what is really going on. ----------------------------------------------------------------------------- 1.8.1.4. Experience with the Domain Name System (DNS) Also you should understand what the Domain Name System (DNS) is, what it provides and how to use it. ----------------------------------------------------------------------------- 1.8.1.5. Experience with network debugging strategies You should at least understand how to use tcpdump and what it can show you. Otherwise, network debugging will very difficult for you. ----------------------------------------------------------------------------- 1.8.2. Linux operating system compatible hardware Surely you wish to experiment with real hardware, and not only read this HOWTO to fall asleep here and there. ;-7) ----------------------------------------------------------------------------- Chapter 2. Basics 2.1. What is IPv6? IPv6 is a new layer 3 protocol (see [http://www.linuxports.com/howto/ intro_to_networking/c4412.htm#PAGE103HTML] linuxports/howto/ intro_to_networking/ISO - OSI Model) which will supersede IPv4 (also known as IP). IPv4 was designed long time ago ([http://www.faqs.org/rfcs/rfc760.html] RFC 760 / Internet Protocol from January 1980) and since its inception, there have been many requests for more addresses and enhanced capabilities. Latest RFC is [http://www.faqs.org/rfcs/rfc2460.html] RFC 2460 / Internet Protocol Version 6 Specification. Major changes in IPv6 are the redesign of the header, including the increase of address size from 32 bits to 128 bits. Because layer 3 is responsible for end-to-end packet transport using packet routing based on addresses, it must include the new IPv6 addresses (source and destination), like IPv4. For more information about the IPv6 history take a look at older IPv6 related RFCs listed e.g. at [http://www.switch.ch/lan/ipv6/references.html] SWITCH IPv6 Pilot / References. ----------------------------------------------------------------------------- 2.2. History of IPv6 in Linux The years 1992, 1993 and 1994 of the IPv6 History (in general) are covered by following document: [http://www.laynetworks.com/IPv6.htm#CH3] IPv6 or IPng (IP next generation). To-do: better time-line, more content... ----------------------------------------------------------------------------- 2.2.1. Beginning The first IPv6 related network code was added to the Linux kernel 2.1.8 in November 1996 by Pedro Roque. It was based on the BSD API: +---------------------------------------------------------------------------+ |diff -u --recursive --new-file v2.1.7/linux/include/linux/in6.h | |¬ linux/include/linux/in6.h | |--- v2.1.7/linux/include/linux/in6.h Thu Jan 1 02:00:00 1970 | |+++ linux/include/linux/in6.h Sun Nov 3 11:04:42 1996 | |@@ -0,0 +1,99 @@ | |+/* | |+ * Types and definitions for AF_INET6 | |+ * Linux INET6 implementation | |+ * + * Authors: | |+ * Pedro Roque <******> | |+ * | |+ * Source: | |+ * IPv6 Program Interfaces for BSD Systems | |+ * | +---------------------------------------------------------------------------+ The shown lines were copied from patch-2.1.8 (e-mail address was blanked on copy&paste). ----------------------------------------------------------------------------- 2.2.2. In between Because of lack of manpower, the IPv6 implementation in the kernel was unable to follow the discussed drafts or newly released RFCs. In October 2000, a project was started in Japan, called [http://www.linux-ipv6.org/] USAGI, whose aim was to implement all missing, or outdated IPv6 support in Linux. It tracks the current IPv6 implementation in FreeBSD made by the [http:// www.kame.net/] KAME project. From time to time they create snapshots against current vanilla Linux kernel sources. Until kernel development series 2.5.x was started, the [http:// www.linux-ipv6.org/] USAGI patch was so big, that Linux networking maintainers were unable to include it completly in the production source of the Linux kernel 2.4.x series. During kernel development series 2.5.x, [http://www.linux-ipv6.org/] USAGI tried to insert all of their current extensions into this. Some, but not all of them were backpported to series 2.4.x and therefore missing some (many) extensions and also does not confirm to all current drafts and RFCs (see [http://www.ietf.org/html.charters/ipv6-charter.html] IP Version 6 Working Group (ipv6) Charter). This can cause some interoperability problems with other operating systems. ----------------------------------------------------------------------------- 2.2.3. Current Many of the long-term developed IPv6 related patches by [http:// www.linux-ipv6.org/] USAGI and others are integrated into vanilla kernel series 2.6.x. ----------------------------------------------------------------------------- 2.2.4. Future [http://www.linux-ipv6.org/] USAGI and others are still working on implementation of newer features like mobililty and others. From time to time, new extension patches are released and also integration into vanilla kernel series is made. ----------------------------------------------------------------------------- 2.3. What do IPv6 addresses look like? As previously mentioned, IPv6 addresses are 128 bits long. This number of bits generates very high decimal numbers with up to 39 digits: +---------------------------------------------------------------------------+ |2^128-1: 340282366920938463463374607431768211455 | +---------------------------------------------------------------------------+ Such numbers are not really addresses that can be memorized. Also the IPv6 address schema is bitwise orientated (just like IPv4, but that's not often recognized). Therefore a better notation of such big numbers is hexadecimal. In hexadecimal, 4 bits (also known as ??nibble??) are represented by a digit or character from 0-9 and a-f (10-15). This format reduces the length of the IPv6 address to 32 characters. +---------------------------------------------------------------------------+ |2^128-1: 0xffffffffffffffffffffffffffffffff | +---------------------------------------------------------------------------+ This representation is still not very convenient (possible mix-up or loss of single hexadecimal digits), so the designers of IPv6 chose a hexadecimal format with a colon as separator after each block of 16 bits. In addition, the leading "0x" (a signifier for hexadecimal values used in programming languages) is removed: +---------------------------------------------------------------------------+ |2^128-1: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff | +---------------------------------------------------------------------------+ A usable address (see address types later) is e.g.: +---------------------------------------------------------------------------+ |2001:0db8:0100:f101:0210:a4ff:fee3:9566 | +---------------------------------------------------------------------------+ For simplifications, leading zeros of each 16 bit block can be omitted: +---------------------------------------------------------------------------+ |2001:0db8:0100:f101:0210:a4ff:fee3:9566 -> | |¬ 2001:db8:100:f101:210:a4ff:fee3:9566 | +---------------------------------------------------------------------------+ One sequence of 16 bit blocks containing only zeroes can be replaced with ??::??. But not more than one at a time, otherwise it is no longer a unique representation. +---------------------------------------------------------------------------+ |2001:0db8:100:f101:0:0:0:1 -> 2001:db8:100:f101::1 | +---------------------------------------------------------------------------+ The biggest reduction is seen by the IPv6 localhost address: +---------------------------------------------------------------------------+ |0000:0000:0000:0000:0000:0000:0000:0001 -> ::1 | +---------------------------------------------------------------------------+ There is also a so-called compact (base85 coded) representation defined [http://www.faqs.org/rfcs/rfc1924.html] RFC 1924 / A Compact Representation of IPv6 Addresses (published on 1. April 1996), never seen in the wild, probably an April fool's joke, but here is an example: +---------------------------------------------------------------------------+ |# ipv6calc --addr_to_base85 2001:0db8:0100:f101:0210:a4ff:fee3:9566 | |9R}vSQZ1W=9A_Q74Lz&R | +---------------------------------------------------------------------------+ Info: ipv6calc is an IPv6 address format calculator and converter program and can be found here: [http://www.deepspace6.net/projects/ipv6calc.html] ipv6calc homepage ([http://mirrors.bieringer.de/www.deepspace6.net/ projects/ipv6calc.html] Mirror) ----------------------------------------------------------------------------- 2.4. FAQ (Basics) 2.4.1. Why is the name IPv6 and not IPv5 as successor for IPv4? On any IP header, the first 4 bits are reserved for protocol version. So theoretically a protocol number between 0 and 15 is possible:   * 4: is already used for IPv4   * 5: is reserved for the Stream Protocol (STP, [http://www.faqs.org/rfcs/ rfc1819.html] RFC 1819 / Internet Stream Protocol Version 2) (which never really made it to the public) The next free number was 6. Hence IPv6 was born! ----------------------------------------------------------------------------- 2.4.2. IPv6 addresses: why such a high number of bits? During the design of IPv4, people thought that 32 bits were enough for the world. Looking back into the past, 32 bits were enough until now and will perhaps be enough for another few years. However, 32 bits are not enough to provide each network device with a global address in the future. Think about mobile phones, cars (including electronic devices on its CAN-bus), toasters, refrigerators, light switches, and so on... So designers have chosen 128 bits, 4 times more in length than in IPv4 today. The usable size is smaller than it may appear however. This is because in the currently defined address schema, 64 bits are used for interface identifiers. The other 64 bits are used for routing. Assuming the current strict levels of aggregation (/48, /32, ...), it is still possible to ??run out?? of space, but hopefully not in the near future. See also for more information [http://www.faqs.org/rfcs/rfc1715.html] RFC 1715 / The H Ratio for Address Assignment Efficiency and [http://www.faqs.org /rfcs/rfc3194.html] RFC 3194 / The Host-Density Ratio for Address Assignment Efficiency. ----------------------------------------------------------------------------- 2.4.3. IPv6 addresses: why so small a number of bits on a new design? While, there are (possibly) some people (only know about Jim Fleming...) on the Internet who are thinking about IPv8 and IPv16, their design is far away from acceptance and implementation. In the meantime 128 bits was the best choice regarding header overhead and data transport. Consider the minimum Maximum Transfer Unit (MTU) in IPv4 (576 octets) and in IPv6 (1280 octets), the header length in IPv4 is 20 octets (minimum, can increase to 60 octets with IPv4 options) and in IPv6 is 48 octets (fixed). This is 3.4 % of MTU in IPv4 and 3.8 % of MTU in IPv6. This means the header overhead is almost equal. More bits for addresses would require bigger headers and therefore more overhead. Also, consider the maximum MTU on normal links (like Ethernet today): it's 1500 octets (in special cases: 9k octets using Jumbo frames). Ultimately, it wouldn't be a proper design if 10 % or 20 % of transported data in a Layer-3 packet were used for addresses and not for payload. ----------------------------------------------------------------------------- Chapter 3. Address types Like IPv4, IPv6 addresses can be split into network and host parts using subnet masks. IPv4 has shown that sometimes it would be nice, if more than one IP address can be assigned to an interface, each for a different purpose (aliases, multi-cast). To remain extensible in the future, IPv6 is going further and allows more than one IPv6 address to be assigned to an interface. There is currently no limit defined by an RFC, only in the implementation of the IPv6 stack (to prevent DoS attacks). Using this large number of bits for addresses, IPv6 defines address types based on some leading bits, which are hopefully never going to be broken in the future (unlike IPv4 today and the history of class A, B, and C). Also the number of bits are separated into a network part (upper 64 bits) and a host part (lower 64 bits), to facilitate auto-configuration. ----------------------------------------------------------------------------- 3.1. Addresses without a special prefix 3.1.1. Localhost address This is a special address for the loopback interface, similiar to IPv4 with its ??127.0.0.1??. With IPv6, the localhost address is: +---------------------------------------------------------------------------+ |0000:0000:0000:0000:0000:0000:0000:0001 | +---------------------------------------------------------------------------+ or compressed: +---------------------------------------------------------------------------+ |::1 | +---------------------------------------------------------------------------+ Packets with this address as source or destination should never leave the sending host. ----------------------------------------------------------------------------- 3.1.2. Unspecified address This is a special address like ??any?? or ??0.0.0.0?? in IPv4 . For IPv6 it's: +---------------------------------------------------------------------------+ |0000:0000:0000:0000:0000:0000:0000:0000 | +---------------------------------------------------------------------------+ or: +---------------------------------------------------------------------------+ |:: | +---------------------------------------------------------------------------+ These addresses are mostly used/seen in socket binding (to any IPv6 address) or routing tables. Note: the unspecified address cannot be used as destination address. ----------------------------------------------------------------------------- 3.1.3. IPv6 address with embedded IPv4 address There are two addresses which contain an IPv4 address. ----------------------------------------------------------------------------- 3.1.3.1. IPv4-mapped IPv6 address IPv4-only IPv6-compatible addresses are sometimes used/shown for sockets created by an IPv6-enabled daemon, but only binding to an IPv4 address. These addresses are defined with a special prefix of length 96 (a.b.c.d is the IPv4 address): +---------------------------------------------------------------------------+ |0:0:0:0:0:ffff:a.b.c.d/96 | +---------------------------------------------------------------------------+ or in compressed format +---------------------------------------------------------------------------+ |::ffff:a.b.c.d/96 | +---------------------------------------------------------------------------+ For example, the IPv4 address 1.2.3.4 looks like this: +---------------------------------------------------------------------------+ |::ffff:1.2.3.4 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.1.3.2. IPv4-compatible IPv6 address Used for automatic tunneling ([http://www.faqs.org/rfcs/rfc2893.html] RFC 2893 / Transition Mechanisms for IPv6 Hosts and Routers), which is being replaced by 6to4 tunneling. +---------------------------------------------------------------------------+ |0:0:0:0:0:0:a.b.c.d/96 | +---------------------------------------------------------------------------+ or in compressed format +---------------------------------------------------------------------------+ |::a.b.c.d/96 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.2. Network part, also known as prefix Designers defined some address types and left a lot of scope for future definitions as currently unknown requirements arise. [http://www.faqs.org/ rfcs/rfc4291.html] RFC 4291 / IP Version 6 Addressing Architecture defines the current addressing scheme. Now lets take a look at the different types of prefixes (and therefore address types): ----------------------------------------------------------------------------- 3.2.1. Link local address type These are special addresses which will only be valid on a link of an interface. Using this address as destination the packet would never pass through a router. It's used for link communications such as:   * anyone else here on this link?   * anyone here with a special address (e.g. looking for a router)? They begin with ( where ??x?? is any hex character, normally ??0??) +---------------------------------------------------------------------------+ |fe8x: <- currently the only one in use. | |fe9x: | |feax: | |febx: | +---------------------------------------------------------------------------+ An address with this prefix is found on each IPv6-enabled interface after stateless auto-configuration (which is normally always the case). ----------------------------------------------------------------------------- 3.2.2. Site local address type These are addresses similar to the [http://www.faqs.org/rfcs/rfc1918.html] RFC 1918 / Address Allocation for Private Internets in IPv4 today, with the added advantage that everyone who use this address type has the capability to use the given 16 bits for a maximum number of 65536 subnets. Comparable with the 10.0.0.0/8 in IPv4 today. Another advantage: because it's possible to assign more than one address to an interface with IPv6, you can also assign such a site local address in addition to a global one. It begins with: +---------------------------------------------------------------------------+ |fecx: <- most commonly used | |fedx: | |feex: | |fefx: | +---------------------------------------------------------------------------+ (where ??x?? is any hex character, normally ??0??) This address type is now deprecated [http://www.faqs.org/rfcs/rfc3879.html] RFC 3879 / Deprecating Site Local Addresses, but for a test in a lab, such addresses are still a good choice in my humble opinion. ----------------------------------------------------------------------------- 3.2.3. Unique Local IPv6 Unicast Addresses Because the original defined site local addresses are not unique, this can lead to major problems, if two former independend networks would be connected later (overlapping of subnets). This and other issues lead to a new address type named [http://www.faqs.org/rfcs/rfc4193.html] RFC 4193 / Unique Local IPv6 Unicast Addresses. It begins with: +---------------------------------------------------------------------------+ |fdxx: | |fcxx: | +---------------------------------------------------------------------------+ A part of the prefix (40 bits) are generated using a pseudo-random algorithm and it's improbable, that two generated ones are equal. Example for a prefix (generated using a web-based tool: [http:// www.goebel-consult.de/ipv6/createLULA] Goebel Consult / createLULA): +---------------------------------------------------------------------------+ |fd0f:8b72:ac90::/48 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.2.4. Global address type "(Aggregatable) global unicast" Today, there is one global address type defined (the first design, called "provider based," was thrown away some years ago [http://www.faqs.org/rfcs/ rfc1884.html] RFC 1884 / IP Version 6 Addressing Architecture [obsolete], you will find some remains in older Linux kernel sources). It begins with (x are hex characters) +---------------------------------------------------------------------------+ |2xxx: | |3xxx: | +---------------------------------------------------------------------------+ Note: the prefix ??aggregatable?? is thrown away in current drafts. There are some further subtypes defined, see below: ----------------------------------------------------------------------------- 3.2.4.1. 6bone test addresses These were the first global addresses which were defined and in use. They all start with +---------------------------------------------------------------------------+ |3ffe: | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |3ffe:ffff:100:f102::1 | +---------------------------------------------------------------------------+ A special 6bone test address which will never be globally unique begins with +---------------------------------------------------------------------------+ |3ffe:ffff: | +---------------------------------------------------------------------------+ and is mostly shown in older examples. The reason for this is, if real addresses are are shown, it's possible for someone to do a copy & paste to their configuration files, thus inadvertently causing duplicates on a globally unique address. This would cause serious problems for the original host (e.g. getting answer packets for request that were never sent). Because IPv6 is now in production, this prefix is no longer be delegated and is removed from routing after 6.6.2006 (see [http://www.faqs.org/rfcs/ rfc3701.html] RFC 3701 / 6bone Phaseout for more). ----------------------------------------------------------------------------- 3.2.4.2. 6to4 addresses These addresses, designed for a special tunneling mechanism [[http:// www.faqs.org/rfcs/rfc3056.html] RFC 3056 / Connection of IPv6 Domains via IPv4 Clouds and [http://www.faqs.org/rfcs/rfc2893.html] RFC 2893 / Transition Mechanisms for IPv6 Hosts and Routers], encode a given IPv4 address and a possible subnet and begin with +---------------------------------------------------------------------------+ |2002: | +---------------------------------------------------------------------------+ For example, representing 192.168.1.1/5: +---------------------------------------------------------------------------+ |2002:c0a8:0101:5::1 | +---------------------------------------------------------------------------+ A small shell command line can help you generating such address out of a given IPv4 one: +-----------------------------------------------------------------------------+ |ipv4="1.2.3.4"; sla="5"; printf "2002:%02x%02x:%02x%02x:%04x::1" `echo $ipv4 | |¬ | tr "." " "` $sla | +-----------------------------------------------------------------------------+ See also tunneling using 6to4 and information about 6to4 relay routers. ----------------------------------------------------------------------------- 3.2.4.3. Assigned by provider for hierarchical routing These addresses are delegated to Internet service providers (ISP) and begin currently with +---------------------------------------------------------------------------+ |2001: | +---------------------------------------------------------------------------+ Prefixes to major (backbone owning) ISPs (also known as LIRs) are delegated by local registries and currently have a prefix with length 32 assigned. Any ISP customer can get a prefix with length 48. ----------------------------------------------------------------------------- 3.2.4.4. Addresses reserved for examples and documentation Currently, two address ranges are reserved for examples and documentation [http://www.faqs.org/rfcs/rfc3849.html] RFC 3849 / IPv6 Address Prefix Reserved for Documentation: +---------------------------------------------------------------------------+ |3fff:ffff::/32 | |2001:0DB8::/32 EXAMPLENET-WF | +---------------------------------------------------------------------------+ These address ranges should be filtered based on source addresses and should NOT be routed on border routers to the internet, if possible. ----------------------------------------------------------------------------- 3.2.5. Multicast addresses Multicast addresses are used for related services. They alway start with (xx is the scope value) +---------------------------------------------------------------------------+ |ffxy: | +---------------------------------------------------------------------------+ They are split into scopes and types: ----------------------------------------------------------------------------- 3.2.5.1. Multicast scopes Multicast scope is a parameter to specify the maximum distance a multicast packet can travel from the sending entity. Currently, the following regions (scopes) are defined:   * ffx1: node-local, packets never leave the node.   * ffx2: link-local, packets are never forwarded by routers, so they never leave the specified link.   * ffx5: site-local, packets never leave the site.   * ffx8: organization-local, packets never leave the organization (not so easy to implement, must be covered by routing protocol).   * ffxe: global scope.   * others are reserved ----------------------------------------------------------------------------- 3.2.5.2. Multicast types There are many types already defined/reserved (see [http://www.faqs.org/rfcs/ rfc4291.html] RFC 4291 / IP Version 6 Addressing Architecture for details). Some examples are:   * All Nodes Address: ID = 1h, addresses all hosts on the local node (ff01: 0:0:0:0:0:0:1) or the connected link (ff02:0:0:0:0:0:0:1).   * All Routers Address: ID = 2h, addresses all routers on the local node (ff01:0:0:0:0:0:0:2), on the connected link (ff02:0:0:0:0:0:0:2), or on the local site (ff05:0:0:0:0:0:0:2) ----------------------------------------------------------------------------- 3.2.5.3. Solicited node link-local multicast address Special multicast address used as destination address in neighborhood discovery, because unlike in IPv4, ARP no longer exists in IPv6. An example of this address looks like +---------------------------------------------------------------------------+ |ff02::1:ff00:1234 | +---------------------------------------------------------------------------+ Used prefix shows that this is a link-local multicast address. The suffix is generated from the destination address. In this example, a packet should be sent to address ??fe80::1234??, but the network stack doesn't know the current layer 2 MAC address. It replaces the upper 104 bits with ??ff02:0:0: 0:0:1:ff00::/104?? and leaves the lower 24 bits untouched. This address is now used `on-link' to find the corresponding node which has to send a reply containing its layer 2 MAC address. ----------------------------------------------------------------------------- 3.2.6. Anycast addresses Anycast addresses are special addresses and are used to cover things like nearest DNS server, nearest DHCP server, or similar dynamic groups. Addresses are taken out of the unicast address space (aggregatable global or site-local at the moment). The anycast mechanism (client view) will be handled by dynamic routing protocols. Note: Anycast addresses cannot be used as source addresses, they are only used as destination addresses. ----------------------------------------------------------------------------- 3.2.6.1. Subnet-router anycast address A simple example for an anycast address is the subnet-router anycast address. Assuming that a node has the following global assigned IPv6 address: +---------------------------------------------------------------------------+ |2001:db8:100:f101:210:a4ff:fee3:9566/64 <- Node's address | +---------------------------------------------------------------------------+ The subnet-router anycast address will be created blanking the suffix (least significant 64 bits) completely: +---------------------------------------------------------------------------+ |2001:db8:100:f101::/64 <- subnet-router anycast address | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.3. Address types (host part) For auto-configuration and mobility issues, it was decided to use the lower 64 bits as the host part of the address in most of the current address types. Therefore each single subnet can hold a large amount of addresses. This host part can be inspected differently: ----------------------------------------------------------------------------- 3.3.1. Automatically computed (also known as stateless) With auto-configuration, the host part of the address is computed by converting the MAC address of an interface (if available), with the EUI-64 method, to a unique IPv6 address. If no MAC address is available for this device (happens e.g. on virtual devices), something else (like the IPv4 address or the MAC address of a physical interface) is used instead. E.g. a NIC has following MAC address (48 bit): +---------------------------------------------------------------------------+ |00:10:A4:E3:95:66 | +---------------------------------------------------------------------------+ This would be expanded according to the[http://standards.ieee.org/regauth/oui /tutorials/EUI64.html] IEEE-Tutorial EUI-64 design for EUI-48 identifiers to the 64 bit interface identifier: +---------------------------------------------------------------------------+ |0210:a4ff:fee3:9566 | +---------------------------------------------------------------------------+ With a given prefix, the result is the IPv6 address shown in example above: +---------------------------------------------------------------------------+ |2001:0db8:0100:f101:0210:a4ff:fee3:9566 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.3.1.1. Privacy problem with automatically computed addresses and a solution Because the "automatically computed" host part is globally unique (except when a vendor of a NIC uses the same MAC address on more than one NIC), client tracking is possible on the host when not using a proxy of any kind. This is a known problem, and a solution was defined: privacy extension, defined in [http://www.faqs.org/rfcs/rfc3041.html] RFC 3041 / Privacy Extensions for Stateless Address Autoconfiguration in IPv6 (there is also already a newer draft available: [http://www.ietf.org/ids.by.wg/ipv6.html] draft-ietf-ipv6-privacy-addrs-v2-*). Using a random and a static value a new suffix is generated from time to time. Note: this is only reasonable for outgoing client connections and isn't really useful for well-known servers. ----------------------------------------------------------------------------- 3.3.2. Manually set For servers, it's probably easier to remember simpler addresses, this can also be accommodated. It is possible to assign an additional IPv6 address to an interface, e.g. +---------------------------------------------------------------------------+ |2001:0db8:100:f101::1 | +---------------------------------------------------------------------------+ For manual suffixes like ??::1?? shown in the above example, it's required that the 7th most significant bit is set to 0 (the universal/local bit of the automatically generated identifier). Also some other (otherwise unchosen ) bit combinations are reserved for anycast addresses, too. ----------------------------------------------------------------------------- 3.4. Prefix lengths for routing In the early design phase it was planned to use a fully hierarchical routing approach to reduce the size of the routing tables maximally. The reasons behind this approach were the number of current IPv4 routing entries in core routers (> 104 thousand in May 2001), reducing the need of memory in hardware routers (ASIC ??Application Specified Integrated Circuit?? driven) to hold the routing table and increase speed (fewer entries hopefully result in faster lookups). Todays view is that routing will be mostly hierarchically designed for networks with only one service provider. With more than one ISP connections, this is not possible, and subject to an issue named multi-homing (infos on multi-homing: [http://www.ietf.org/ids.by.wg/multi6.html] drafts-ietf-multi6- *,[http://arneill-py.sacramento.ca.us/ipv6mh/] IPv6 Multihoming Solutions). ----------------------------------------------------------------------------- 3.4.1. Prefix lengths (also known as "netmasks") Similar to IPv4, the routable network path for routing to take place. Because standard netmask notation for 128 bits doesn't look nice, designers employed the IPv4 Classless Inter Domain Routing (CIDR, [http://www.faqs.org/rfcs/ rfc1519.html] RFC 1519 / Classless Inter-Domain Routing) scheme, which specifies the number of bits of the IP address to be used for routing. It is also called the "slash" notation. An example: +---------------------------------------------------------------------------+ |2001:0db8:100:1:2:3:4:5/48 | +---------------------------------------------------------------------------+ This notation will be expanded:   * Network: +---------------------------------------------------------------------------+ |2001:0db8:0100:0000:0000:0000:0000:0000 | +---------------------------------------------------------------------------+   * Netmask: +---------------------------------------------------------------------------+ |ffff:ffff:ffff:0000:0000:0000:0000:0000 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 3.4.2. Matching a route Under normal circumstances (no QoS), a lookup in a routing table results in the route with the most significant number of address bits being selected. In other words, the route with the biggest prefix length matches first. For example if a routing table shows following entries (list is not complete): +---------------------------------------------------------------------------+ |2001:0db8:100::/48 :: U 1 0 0 sit1 | |2000::/3 ::192.88.99.1 UG 1 0 0 tun6to4 | +---------------------------------------------------------------------------+ Shown destination addresses of IPv6 packets will be routed through shown device +---------------------------------------------------------------------------+ |2001:0db8:100:1:2:3:4:5/48 -> routed through device sit1 | |2001:0db8:200:1:2:3:4:5/48 -> routed through device tun6to4 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- Chapter 4. IPv6-ready system check Before you can start using IPv6 on a Linux host, you have to test, whether your system is IPv6-ready. You may have to do some work to enable it first. ----------------------------------------------------------------------------- 4.1. IPv6-ready kernel Modern Linux distributions already contain IPv6-ready kernels, the IPv6 capability is generally compiled as a module, but it's possible that this module is not loaded automatically on startup. Note: you shouldn't anymore use kernel series 2.2.x, because it's not IPv6-up-to-date anymore. Also the IPv6 support in series 2.4.x is no longer improved according to definitions in latest RFCs. It's recommend to use series 2.6.x now. ----------------------------------------------------------------------------- 4.1.1. Check for IPv6 support in the current running kernel To check, whether your current running kernel supports IPv6, take a look into your /proc-file-system. Following entry must exists: +---------------------------------------------------------------------------+ |/proc/net/if_inet6 | +---------------------------------------------------------------------------+ A short automatical test looks like: +---------------------------------------------------------------------------+ |# test -f /proc/net/if_inet6 && echo "Running kernel is IPv6 ready" | +---------------------------------------------------------------------------+ If this fails, it is quite likely, that the IPv6 module is not loaded. ----------------------------------------------------------------------------- 4.1.2. Try to load IPv6 module You can try to load the IPv6 module executing +---------------------------------------------------------------------------+ |# modprobe ipv6 | +---------------------------------------------------------------------------+ If this is successful, this module should be listed, testable with following auto-magically line: +---------------------------------------------------------------------------+ |# lsmod |grep -w 'ipv6' && echo "IPv6 module successfully loaded" | +---------------------------------------------------------------------------+ And the check shown above should now run successfully. Note: unloading the module is currently not supported and can result, under some circumstances, in a kernel crash. ----------------------------------------------------------------------------- 4.1.2.1. Automatically loading of module Its possible to automatically load the IPv6 module on demand. You only have to add following line in the configuration file of the kernel module loader (normally /etc/modules.conf or /etc/conf.modules): +---------------------------------------------------------------------------+ |alias net-pf-10 ipv6 # automatically load IPv6 module on demand | +---------------------------------------------------------------------------+ It's also possible to disable automatically loading of the IPv6 module using following line +---------------------------------------------------------------------------+ |alias net-pf-10 off # disable automatically load of IPv6 module on demand| +---------------------------------------------------------------------------+ Additional note: in kernels series 2.6.x, the module loader mechanism was changed. The new configuration file has to be named /etc/modprobe.conf instead of /etc/modules.conf. ----------------------------------------------------------------------------- 4.1.3. Compile kernel with IPv6 capabilities If both above shown results were negative and your kernel has no IP6 support, than you have the following options:   * Update your distribution to a current one which supports IPv6 out-of-the-box (recommended for newbies)   * Compile a new vanilla kernel (easy, if you know which options you needed)   * Recompile kernel sources given by your Linux distribution (sometimes not so easy)   * Compile a kernel with USAGI extensions If you decide to compile a kernel, you should have previous experience in kernel compiling and read the [http://www.tldp.org/HOWTO/Kernel-HOWTO.html] Linux Kernel HOWTO. A comparison between vanilla and USAGI extended kernels is available on [http://www.bieringer.de/linux/IPv6/status/IPv6+Linux-status-kernel.html] IPv6+Linux-Status-Kernel. ----------------------------------------------------------------------------- 4.1.3.1. Compiling a vanilla kernel More detailed hints about compiling an IPv6-enabled kernel can be found e.g. on [http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO-2.html#kernel] IPv6-HOWTO-2#kernel. Note: you should use whenever possible kernel series 2.6.x or above, because the IPv6 support in series 2.4.x only will no longer get backported features from 2.6.x and IPv6 support in series 2.2.x is hopeless outdated. ----------------------------------------------------------------------------- 4.1.3.2. Compiling a kernel with USAGI extensions Same as for vanilla kernel, only recommend for advanced users, which are already familiar with IPv6 and kernel compilation. See also [http:// www.linux-ipv6.org/faq.html] USAGI project / FAQ and [http:// www.deepspace6.net/docs/best_ipv6_support.html] Obtaining the best IPv6 support with Linux (Article) ([http://mirrors.bieringer.de/www.deepspace6.net /docs/best_ipv6_support.html] Mirror). ----------------------------------------------------------------------------- 4.1.4. IPv6-ready network devices Not all existing network devices have already (or ever) the capability to transport IPv6 packets. A current status can be found at [http:// www.bieringer.de/linux/IPv6/status/IPv6+Linux-status-kernel.html#transport] IPv6+Linux-status-kernel.html#transport. A major issue is that because of the network layer structure of kernel implementation an IPv6 packet isn't really recognized by it's IP header number (6 instead of 4). It's recognized by the protocol number of the Layer 2 transport protocol. Therefore any transport protocol which doesn't use such protocol number cannot dispatch IPv6 packets. Note: the packet is still transported over the link, but on receivers side, the dispatching won't work (you can see this e.g. using tcpdump). ----------------------------------------------------------------------------- 4.1.4.1. Currently known never ??IPv6 capable links??   * Serial Line IP (SLIP, [http://www.faqs.org/rfcs/rfc1055.html] RFC 1055 / SLIP), should be better called now to SLIPv4, device named: slX   * Parallel Line IP (PLIP), same like SLIP, device names: plipX   * ISDN with encapsulation rawip, device names: isdnX ----------------------------------------------------------------------------- 4.1.4.2. Currently known ??not supported IPv6 capable links??   * ISDN with encapsulation syncppp, device names: ipppX (design issue of the ipppd, will be merged into more general PPP layer in kernel series 2.5.x) ----------------------------------------------------------------------------- 4.2. IPv6-ready network configuration tools You wont get very far, if you are running an IPv6-ready kernel, but have no tools to configure IPv6. There are several packages in existence which can configure IPv6. ----------------------------------------------------------------------------- 4.2.1. net-tools package The net-tool package includes some tools like ifconfig and route, which helps you to configure IPv6 on an interface. Look at the output of ifconfig -? or route -?, if something is shown like IPv6 or inet6, then the tool is IPv6-ready. Auto-magically check: +---------------------------------------------------------------------------+ |# /sbin/ifconfig -? 2>& 1|grep -qw 'inet6' && echo "utility 'ifconfig' is | |¬ IPv6-ready" | +---------------------------------------------------------------------------+ Same check can be done for route: +-------------------------------------------------------------------------------+ |# /sbin/route -? 2>& 1|grep -qw 'inet6' && echo "utility 'route' is IPv6-ready"| +-------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.2.2. iproute package Alexey N. Kuznetsov (current a maintainer of the Linux networking code) created a tool-set which configures networks through the netlink device. Using this tool-set you have more functionality than net-tools provides, but its not very well documented and isn't for the faint of heart. +---------------------------------------------------------------------------+ |# /sbin/ip 2>&1 |grep -qw 'inet6' && echo "utility 'ip' is IPv6-ready" | +---------------------------------------------------------------------------+ If the program /sbin/ip isn't found, then I strongly recommend you install the iproute package.   * You can get it from your Linux distribution (if contained)   * You can download the tar-ball and recompile it: [ftp://ftp.inr.ac.ru/ ip-routing/] Original FTP source and mirror (missing)   * You're able to look for a proper RPM package at [http://rpmfind.net/linux /rpm2html/search.php?query=iproute] RPMfind/iproute (sometimes rebuilding of a SRPMS package is recommended) ----------------------------------------------------------------------------- 4.3. IPv6-ready test/debug programs After you have prepared your system for IPv6, you now want to use IPv6 for network communications. First you should learn how to examine IPv6 packets with a sniffer program. This is strongly recommended because for debugging/ troubleshooting issues this can aide in providing a diagnosis very quickly. ----------------------------------------------------------------------------- 4.3.1. IPv6 ping This program is normally included in package iputils. It is designed for simple transport tests sending ICMPv6 echo-request packets and wait for ICMPv6 echo-reply packets. Usage +---------------------------------------------------------------------------+ |# ping6 | |# ping6 | |# ping6 [-I ] | +---------------------------------------------------------------------------+ Example +---------------------------------------------------------------------------+ |# ping6 -c 1 ::1 | |PING ::1(::1) from ::1 : 56 data bytes | |64 bytes from ::1: icmp_seq=0 hops=64 time=292 usec | | | |--- ::1 ping statistics --- | |1 packets transmitted, 1 packets received, 0% packet loss | |round-trip min/avg/max/mdev = 0.292/0.292/0.292/0.000 ms | +---------------------------------------------------------------------------+ Hint: ping6 needs raw access to socket and therefore root permissions. So if non-root users cannot use ping6 then there are two possible problems: 1. ping6 is not in users path (probably, because ping6 is generally stored in /usr/sbin -> add path (not really recommended) 2. ping6 doesn't execute properly, generally because of missing root permissions -> chmod u+s /usr/sbin/ping6 ----------------------------------------------------------------------------- 4.3.1.1. Specifying interface for IPv6 ping Using link-local addresses for an IPv6 ping, the kernel does not know through which (physically or virtual) device it must send the packet - each device has a link-local address. A try will result in following error message: +---------------------------------------------------------------------------+ |# ping6 fe80::212:34ff:fe12:3456 | |connect: Invalid argument | +---------------------------------------------------------------------------+ In this case you have to specify the interface additionally like shown here: +---------------------------------------------------------------------------+ |# ping6 -I eth0 -c 1 fe80::2e0:18ff:fe90:9205 | |PING fe80::212:23ff:fe12:3456(fe80::212:23ff:fe12:3456) from | |¬ fe80::212:34ff:fe12:3478 eth0: 56 data bytes | |64 bytes from fe80::212:23ff:fe12:3456: icmp_seq=0 hops=64 time=445 usec | | | |--- fe80::2e0:18ff:fe90:9205 ping statistics --- | |1 packets transmitted, 1 packets received, 0% packet loss round-trip | |¬ min/avg/max/mdev = 0.445/0.445/0.445/0.000 ms | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.3.1.2. Ping6 to multicast addresses An interesting mechanism to detect IPv6-active hosts on a link is to ping6 to the link-local all-node multicast address: +-------------------------------------------------------------------------------+ |# ping6 -I eth0 ff02::1 | |PING ff02::1(ff02::1) from fe80:::2ab:cdff:feef:0123 eth0: 56 data bytes | |64 bytes from ::1: icmp_seq=1 ttl=64 time=0.104 ms | |64 bytes from fe80::212:34ff:fe12:3450: icmp_seq=1 ttl=64 time=0.549 ms (DUP!) | +-------------------------------------------------------------------------------+ Unlike in IPv4, where replies to a ping on the broadcast address can be disabled, in IPv6 currently this behavior cannot be disable except by local IPv6 firewalling. ----------------------------------------------------------------------------- 4.3.2. IPv6 traceroute6 This program is normally included in package iputils. It's a program similar to IPv4 traceroute. Below you will see an example: +--------------------------------------------------------------------------------+ |# traceroute6 www.6bone.net | |traceroute to 6bone.net (3ffe:b00:c18:1::10) from 2001:0db8:0000:f101::2, 30 | |¬ hops max, 16 byte packets | | 1 localipv6gateway (2001:0db8:0000:f101::1) 1.354 ms 1.566 ms 0.407 ms | | 2 swi6T1-T0.ipv6.switch.ch (3ffe:2000:0:400::1) 90.431 ms 91.956 ms 92.377 ms | | 3 3ffe:2000:0:1::132 (3ffe:2000:0:1::132) 118.945 ms 107.982 ms 114.557 ms | | 4 3ffe:c00:8023:2b::2 (3ffe:c00:8023:2b::2) 968.468 ms 993.392 ms 973.441 ms | | 5 3ffe:2e00:e:c::3 (3ffe:2e00:e:c::3) 507.784 ms 505.549 ms 508.928 ms | | 6 www.6bone.net (3ffe:b00:c18:1::10) 1265.85 ms * 1304.74 ms | +--------------------------------------------------------------------------------+ Note: unlike some modern versions of IPv4 traceroute, which can use ICMPv4 echo-request packets as well as UDP packets (default), current IPv6-traceroute is only able to send UDP packets. As you perhaps already know, ICMP echo-request packets are more accepted by firewalls or ACLs on routers inbetween than UDP packets. ----------------------------------------------------------------------------- 4.3.3. IPv6 tracepath6 This program is normally included in package iputils. It's a program like traceroute6 and traces the path to a given destination discovering the MTU along this path. Below you will see an example: +---------------------------------------------------------------------------+ |# tracepath6 www.6bone.net | | 1?: [LOCALHOST] pmtu 1480 | | 1: 3ffe:401::2c0:33ff:fe02:14 150.705ms | | 2: 3ffe:b00:c18::5 267.864ms | | 3: 3ffe:b00:c18::5 asymm 2 266.145ms pmtu 1280 | | 3: 3ffe:3900:5::2 asymm 4 346.632ms | | 4: 3ffe:28ff:ffff:4::3 asymm 5 365.965ms | | 5: 3ffe:1cff:0:ee::2 asymm 4 534.704ms | | 6: 3ffe:3800::1:1 asymm 4 578.126ms !N | |Resume: pmtu 1280 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.3.4. IPv6 tcpdump On Linux, tcpdump is the major tool for packet capturing. Below you find some examples. IPv6 support is normally built-in in current releases of version 3.6. tcpdump uses expressions for filtering packets to minimize the noise:   * icmp6: filters native ICMPv6 traffic   * ip6: filters native IPv6 traffic (including ICMPv6)   * proto ipv6: filters tunneled IPv6-in-IPv4 traffic   * not port ssh: to suppress displaying SSH packets for running tcpdump in a remote SSH session Also some command line options are very useful to catch and print more information in a packet, mostly interesting for digging into ICMPv6 packets:   * ??-s 512??: increase the snap length during capturing of a packet to 512 bytes   * ??-vv??: really verbose output   * ??-n??: don't resolve addresses to names, useful if reverse DNS resolving isn't working proper ----------------------------------------------------------------------------- 4.3.4.1. IPv6 ping to 2001:0db8:100:f101::1 native over a local link +---------------------------------------------------------------------------+ |# tcpdump -t -n -i eth0 -s 512 -vv ip6 or proto ipv6 | |tcpdump: listening on eth0 | |2001:0db8:100:f101:2e0:18ff:fe90:9205 > 2001:0db8:100:f101::1: icmp6: echo | |¬ request (len 64, hlim 64) | |2001:0db8:100:f101::1 > 2001:0db8:100:f101:2e0:18ff:fe90:9205: icmp6: echo | |¬ reply (len 64, hlim 64) | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.3.4.2. IPv6 ping to 2001:0db8:100::1 routed through an IPv6-in-IPv4-tunnel 1.2.3.4 and 5.6.7.8 are tunnel endpoints (all addresses are examples) +--------------------------------------------------------------------------------+ |# tcpdump -t -n -i ppp0 -s 512 -vv ip6 or proto ipv6 | |tcpdump: listening on ppp0 | |1.2.3.4 > 5.6.7.8: 2002:ffff:f5f8::1 > 2001:0db8:100::1: icmp6: echo request | |¬ (len 64, hlim 64) (DF) (ttl 64, id 0, len 124) | |5.6.7.8 > 1.2.3.4: 2001:0db8:100::1 > 2002:ffff:f5f8::1: icmp6: echo reply (len | |¬ 64, hlim 61) (ttl 23, id 29887, len 124) | |1.2.3.4 > 5.6.7.8: 2002:ffff:f5f8::1 > 2001:0db8:100::1: icmp6: echo request | |¬ (len 64, hlim 64) (DF) (ttl 64, id 0, len 124) | |5.6.7.8 > 1.2.3.4: 2001:0db8:100::1 > 2002:ffff:f5f8::1: icmp6: echo reply (len | |¬ 64, hlim 61) (ttl 23, id 29919, len 124) | +--------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.4. IPv6-ready programs Current distributions already contain the most needed IPv6 enabled client and servers. See first on [http://www.bieringer.de/linux/IPv6/status/ IPv6+Linux-status-distributions.html] IPv6+Linux-Status-Distribution. If still not included, you can check [http://www.bieringer.de/linux/IPv6/status/ IPv6+Linux-status-apps.html] IPv6 & Linux - Current Status - Applications whether the program is already ported to IPv6 and usable with Linux. For common used programs there are some hints available at [http:// www.bieringer.de/linux/IPv6/IPv6-HOWTO/IPv6-HOWTO-3.html] IPv6 & Linux - HowTo - Part 3 and [http://www.bieringer.de/linux/IPv6/IPv6-HOWTO/ IPv6-HOWTO-4.html] IPv6 & Linux - HowTo - Part 4. ----------------------------------------------------------------------------- 4.5. IPv6-ready client programs (selection) To run the following shown tests, it's required that your system is IPv6 enabled, and some examples show addresses which only can be reached if a connection to the 6bone is available. ----------------------------------------------------------------------------- 4.5.1. Checking DNS for resolving IPv6 addresses Because of security updates in the last years every Domain Name System (DNS) server should run newer software which already understands the (intermediate) IPv6 address-type AAAA (the newer one named A6 isn't still common at the moment because only supported using BIND9 and newer and also the non-existent support of root domain IP6.ARPA). A simple test whether the used system can resolve IPv6 addresses is +---------------------------------------------------------------------------+ |# host -t AAAA www.join.uni-muenster.de | +---------------------------------------------------------------------------+ and should show something like following: +--------------------------------------------------------------------------------+ |www.join.uni-muenster.de. is an alias for tolot.join.uni-muenster.de. | |tolot.join.uni-muenster.de. has AAAA address 2001:638:500:101:2e0:81ff:fe24:37c6| +--------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 4.5.2. IPv6-ready telnet clients IPv6-ready telnet clients are available. A simple test can be done with +---------------------------------------------------------------------------+ |$ telnet 3ffe:400:100::1 80 | |Trying 3ffe:400:100::1... | |Connected to 3ffe:400:100::1. | |Escape character is '^]'. | |HEAD / HTTP/1.0 | | | |HTTP/1.1 200 OK | |Date: Sun, 16 Dec 2001 16:07:21 | |GMT Server: Apache/2.0.28 (Unix) | |Last-Modified: Wed, 01 Aug 2001 21:34:42 GMT | |ETag: "3f02-a4d-b1b3e080" | |Accept-Ranges: bytes | |Content-Length: 2637 | |Connection: close | |Content-Type: text/html; charset=ISO-8859-1 | | | |Connection closed by foreign host. | +---------------------------------------------------------------------------+ If the telnet client don't understand the IPv6 address and says something like ??cannot resolve hostname??, then it's not IPv6-enabled. ----------------------------------------------------------------------------- 4.5.3. IPv6-ready ssh clients 4.5.3.1. openssh Current versions of openssh are IPv6-ready. Depending on configuring before compiling it has two behavior.   * --without-ipv4-default: the client tries an IPv6 connect first automatically and fall back to IPv4 if not working   * --with-ipv4-default: default connection is IPv4, IPv6 connection must be force like following example shows +---------------------------------------------------------------------------+ |$ ssh -6 ::1 | |user@::1's password: ****** | |[user@ipv6host user]$ | +---------------------------------------------------------------------------+ If your ssh client doesn't understand the option ??-6?? then it's not IPv6-enabled, like most ssh version 1 packages. ----------------------------------------------------------------------------- 4.5.3.2. ssh.com SSH.com's SSH client and server is also IPv6 aware now and is free for all Linux and FreeBSD machine regardless if used for personal or commercial use. ----------------------------------------------------------------------------- 4.5.4. IPv6-ready web browsers A current status of IPv6 enabled web browsers is available at [http:// www.bieringer.de/linux/IPv6/status/IPv6+Linux-status-apps.html#HTTP] IPv6+Linux-status-apps.html#HTTP. Most of them have unresolved problems at the moment 1. If using an IPv4 only proxy in the settings, IPv6 requests will be sent to the proxy, but the proxy will fail to understand the request and the request fails. Solution: update proxy software (see later). 2. Automatic proxy settings (*.pac) cannot be extended to handle IPv6 requests differently (e.g. don't use proxy) because of their nature (written in Java-script and well hard coded in source like to be seen in Maxilla source code). Also older versions don't understand an URL with IPv6 encoded addresses like [http://[3ffe:400:100::1]/] http://[3ffe:400:100::1]/ (this given URL only works with an IPv6-enabled browser!). A short test is to try shown URL with a given browser and using no proxy. ----------------------------------------------------------------------------- 4.5.4.1. URLs for testing A good starting point for browsing using IPv6 is [http://www.kame.net/] http: //www.kame.net/. If the turtle on this page is animated, the connection is via IPv6, otherwise the turtle is static. ----------------------------------------------------------------------------- 4.6. IPv6-ready server programs In this part of this HOWTO, more client specific issues are mentioned. Therefore hints for IPv6-ready servers like sshd, httpd, telnetd, etc. are shown below in Hints for IPv6-enabled daemons. ----------------------------------------------------------------------------- 4.7. FAQ (IPv6-ready system check) 4.7.1. Using tools 4.7.1.1. Q: Cannot ping6 to link-local addresses Error message: "connect: Invalid argument" Kernel doesn't know, which physical or virtual link you want to use to send such ICMPv6 packets. Therefore it displays this error message. Solution: Specify interface like: ??ping6 -I eth0 fe80::2e0:18ff:fe90:9205??, see also program ping6 usage. ----------------------------------------------------------------------------- 4.7.1.2. Q: Cannot ping6 or traceroute6 as normal user Error message: ??icmp socket: Operation not permitted?? These utilities create special ICMPv6 packets and send them out. This is done by using raw sockets in the kernel. But raw sockets can only be used by the ??root?? user. Therefore normal users get such error message. Solution: If it's really needed that all users should be able to use these utilities, you can add the ??suid?? bit using ??chmod u+s /path/to/program??, see also program ping6 usage. If not all users should be able to, you can change the group of the program to e.g. ??wheel??, add these power users to this group and remove the execution bit for other users using ??chmod o-rwx / path/to/program??. Or configure ??sudo?? to enable your security policy. ----------------------------------------------------------------------------- Chapter 5. Configuring interfaces 5.1. Different network devices On a node, there exist different network devices. They can be collected in classes   * Physically bounded, like eth0, tr0   * Virtually existing, like ppp0, tun0, tap0, sit0, isdn0, ippp0 ----------------------------------------------------------------------------- 5.1.1. Physically bounded Physically bounded interfaces like Ethernet or Token-Ring are normal ones and need no special treatment. ----------------------------------------------------------------------------- 5.1.2. Virtually bounded Virtually bounded interfaces always need special support ----------------------------------------------------------------------------- 5.1.2.1. IPv6-in-IPv4 tunnel interfaces These interfaces are normally named sitx. The name sit is a shortcut for Simple Internet Transition. This device has the capability to encapsulate IPv6 packets into IPv4 ones and tunnel them to a foreign endpoint. sit0 has a special meaning and cannot be used for dedicated tunnels. ----------------------------------------------------------------------------- 5.1.2.2. PPP interfaces PPP interfaces get their IPv6 capability from an IPv6 enabled PPP daemon. ----------------------------------------------------------------------------- 5.1.2.3. ISDN HDLC interfaces IPv6 capability for HDLC with encapsulation ip is already built-in in the kernel ----------------------------------------------------------------------------- 5.1.2.4. ISDN PPP interfaces ISDN PPP interfaces (ippp) aren't IPv6 enabled by kernel. Also there are also no plans to do that because in kernel 2.5.+ they will be replaced by a more generic ppp interface layer. ----------------------------------------------------------------------------- 5.1.2.5. SLIP + PLIP Like mentioned earlier, this interfaces don't support IPv6 transport (sending is OK, but dispatching on receiving don't work). ----------------------------------------------------------------------------- 5.1.2.6. Ether-tap device Ether-tap devices are IPv6-enabled and also stateless configured. For use, the module ??ethertap?? has to be loaded before. ----------------------------------------------------------------------------- 5.1.2.7. tun devices Currently not tested by me. ----------------------------------------------------------------------------- 5.1.2.8. ATM 01/2002: Aren't currently supported by vanilla kernel, supported by USAGI extension ----------------------------------------------------------------------------- 5.1.2.9. Others Did I forget an interface?... ----------------------------------------------------------------------------- 5.2. Bringing interfaces up/down Two methods can be used to bring interfaces up or down. ----------------------------------------------------------------------------- 5.2.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# ip link set dev up | |# ip link set dev down | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# ip link set dev eth0 up | |# ip link set dev eth0 down | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 5.2.2. Using "ifconfig" Usage: +---------------------------------------------------------------------------+ |# /sbin/ifconfig up | |# /sbin/ifconfig down | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ifconfig eth0 up | |# /sbin/ifconfig eth0 down | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- Chapter 6. Configuring IPv6 addresses There are different ways to configure an IPv6 address on an interface. You can use use "ifconfig" or "ip". ----------------------------------------------------------------------------- 6.1. Displaying existing IPv6 addresses First you should check, whether and which IPv6 addresses are already configured (perhaps auto-magically during stateless auto-configuration). ----------------------------------------------------------------------------- 6.1.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr show dev | +---------------------------------------------------------------------------+ Example for a static configured host: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr show dev eth0 | |2: eth0: | +---------------------------------------------------------------------------+ Example (output filtered with grep to display only IPv6 addresses). Here you see different IPv6 addresses with different scopes. +---------------------------------------------------------------------------+ |# /sbin/ifconfig eth0 |grep "inet6 addr:" | |inet6 addr: fe80::210:a4ff:fee3:9566/10 Scope:Link | |inet6 addr: 2001:0db8:0:f101::1/64 Scope:Global | |inet6 addr: fec0:0:0:f101::1/64 Scope:Site | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 6.2. Add an IPv6 address Adding an IPv6 address is similar to the mechanism of "IP ALIAS" addresses in Linux IPv4 addressed interfaces. ----------------------------------------------------------------------------- 6.2.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr add / dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr add 2001:0db8:0:f101::1/64 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 6.2.2. Using "ifconfig" Usage: +---------------------------------------------------------------------------+ |# /sbin/ifconfig inet6 add / | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ifconfig eth0 inet6 add 2001:0db8:0:f101::1/64 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 6.3. Removing an IPv6 address Not so often needed, be carefully with removing non existent IPv6 address, sometimes using older kernels it results in a crash. ----------------------------------------------------------------------------- 6.3.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr del / dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 addr del 2001:0db8:0:f101::1/64 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 6.3.2. Using "ifconfig" Usage: +---------------------------------------------------------------------------+ |# /sbin/ifconfig inet6 del / | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ifconfig eth0 inet6 del 2001:0db8:0:f101::1/64 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- Chapter 7. Configuring normal IPv6 routes If you want to leave your link and want to send packets in the world wide IPv6-Internet, you need routing. If there is already an IPv6 enabled router on your link, it's possible enough to add IPv6 routes. ----------------------------------------------------------------------------- 7.1. Displaying existing IPv6 routes First you should check, whether and which IPv6 addresses are already configured (perhaps auto-magically during auto-configuration). ----------------------------------------------------------------------------- 7.1.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route show [dev ] | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route show dev eth0 | |2001:0db8:0:f101::/64 proto kernel metric 256 mtu 1500 advmss 1440 | |fe80::/10 proto kernel metric 256 mtu 1500 advmss 1440 | |ff00::/8 proto kernel metric 256 mtu 1500 advmss 1440 | |default proto kernel metric 256 mtu 1500 advmss 1440 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.1.2. Using "route" Usage: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 | +---------------------------------------------------------------------------+ Example (output is filtered for interface eth0). Here you see different IPv6 routes for different addresses on a single interface. +--------------------------------------------------------------------------------+ |# /sbin/route -A inet6 |grep -w "eth0" | |2001:0db8:0:f101 ::/64 :: UA 256 0 0 eth0 <- Interface route for global | |¬ address | |fe80::/10 :: UA 256 0 0 eth0 <- Interface route for link-local | |¬ address | |ff00::/8 :: UA 256 0 0 eth0 <- Interface route for all multicast | |¬ addresses | |::/0 :: UDA 256 0 0 eth0 <- Automatic default route | +--------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.2. Add an IPv6 route through a gateway Mostly needed to reach the outside with IPv6 using an IPv6-enabled router on your link. ----------------------------------------------------------------------------- 7.2.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route add / via | |¬ [dev ] | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route add 2000::/3 via 2001:0db8:0:f101::1 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.2.2. Using "route" Usage: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 add / gw | |¬ [dev ] | +---------------------------------------------------------------------------+ A device can be needed, too, if the IPv6 address of the gateway is a link local one. Following shown example adds a route for all currently global addresses (2000::/3) through gateway 2001:0db8:0:f101::1 +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 add 2000::/3 gw 2001:0db8:0:f101::1 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.3. Removing an IPv6 route through a gateway Not so often needed manually, mostly done by network configure scripts on shutdown (full or per interface) ----------------------------------------------------------------------------- 7.3.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route del / via | |¬ [dev ] | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route del 2000::/3 via 2001:0db8:0:f101::1 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.3.2. Using "route" Usage: +-----------------------------------------------------------------------------------+ |# /sbin/route -A inet6 del / gw [dev ]| +-----------------------------------------------------------------------------------+ Example for removing upper added route again: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 del 2000::/3 gw 2001:0db8:0:f101::1 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.4. Add an IPv6 route through an interface Not often needed, sometimes in cases of dedicated point-to-point links. ----------------------------------------------------------------------------- 7.4.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route add / dev | |¬ metric 1 | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route add 2000::/3 dev eth0 metric 1 | +---------------------------------------------------------------------------+ Metric ??1?? is used here to be compatible with the metric used by route, because the default metric on using ??ip?? is ??1024??. ----------------------------------------------------------------------------- 7.4.2. Using "route" Usage: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 add / dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 add 2000::/3 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.5. Removing an IPv6 route through an interface Not so often needed to use by hand, configuration scripts will use such on shutdown. ----------------------------------------------------------------------------- 7.5.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route del / dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 route del 2000::/3 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.5.2. Using "route" Usage: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 del / dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 del 2000::/3 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.6. FAQ for IPv6 routes 7.6.1. Support of an IPv6 default route One idea of IPv6 was a hierachical routing, therefore only less routing entries are needed in routers. There are some issues in current Linux kernels: ----------------------------------------------------------------------------- 7.6.1.1. Clients (not routing any packet!) Client can setup a default route like prefix ??::/0??, they also learn such route on autoconfiguration e.g. using radvd on the link like following example shows: +-------------------------------------------------------------------------------+ |# ip -6 route show | grep ^default | |default via fe80::212:34ff:fe12:3450 dev eth0 proto kernel metric 1024 expires | |¬ 29sec mtu 1500 advmss 1440 | +-------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 7.6.1.2. Routers in case of packet forwarding Older Linux kernel (at least <= 2.4.17) don't support default routes. You can set them up, but the route lookup fails when a packet should be forwarded (normal intention of a router). If you're still using such older kernel, ?? default routing?? can be setup using the currently used global address prefix ??2000::/3??. Note: take care about default routing without address filtering on edge routers. Otherwise unwanted multicast or site-local traffic can leave the edge. ----------------------------------------------------------------------------- Chapter 8. Neighbor Discovery Neighbor discovery was the IPv6 successor for the ARP (Address Resolution Protocol) in IPv4. You can retrieve information about the current neighbors, in addition you can set and delete entries. The kernel keeps tracking of successful neighbor detection (like ARP in IPv4). You can dig into the learnt table using ??ip??. ----------------------------------------------------------------------------- 8.1. Displaying neighbors using ??ip?? With following command you can display the learnt or configured IPv6 neighbors +---------------------------------------------------------------------------+ |# ip -6 neigh show [dev ] | +---------------------------------------------------------------------------+ The following example shows one neighbor, which is a reachable router +-------------------------------------------------------------------------------+ |# ip -6 neigh show | |fe80::201:23ff:fe45:6789 dev eth0 lladdr 00:01:23:45:67:89 router nud reachable| +-------------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 8.2. Manipulating neighbors table using ??ip?? 8.2.1. Manually add an entry With following command you are able to manually add an entry +---------------------------------------------------------------------------+ |# ip -6 neigh add lladdr dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# ip -6 neigh add fec0::1 lladdr 02:01:02:03:04:05 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 8.2.2. Manually delete an entry Like adding also an entry can be deleted: +---------------------------------------------------------------------------+ |# ip -6 neigh del lladdr dev | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# ip -6 neigh del fec0::1 lladdr 02:01:02:03:04:05 dev eth0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 8.2.3. More advanced settings The tool ??ip?? is less documentated, but very strong. See online ??help?? for more: +---------------------------------------------------------------------------+ |# ip -6 neigh help | |Usage: ip neigh { add | del | change | replace } { ADDR [ lladdr LLADDR ] | | [ nud { permanent | noarp | stale | reachable } ] | | | proxy ADDR } [ dev DEV ] | | ip neigh {show|flush} [ to PREFIX ] [ dev DEV ] [ nud STATE ] | +---------------------------------------------------------------------------+ Looks like some options are only for IPv4...if you can contribute information about flags and advanced usage, pls. send. ----------------------------------------------------------------------------- Chapter 9. Configuring IPv6-in-IPv4 tunnels If you want to leave your link you have no IPv6 capable network around you, you need IPv6-in-IPv4 tunneling to reach the world wide IPv6-Internet. There are some kind of tunnel mechanism and also some possibilities to setup tunnels. ----------------------------------------------------------------------------- 9.1. Types of tunnels There are more than one possibility to tunnel IPv6 packets over IPv4-only links. ----------------------------------------------------------------------------- 9.1.1. Static point-to-point tunneling: 6bone A point-to-point tunnel is a dedicated tunnel to an endpoint, which knows about your IPv6 network (for backward routing) and the IPv4 address of your tunnel endpoint and defined in [http://www.faqs.org/rfcs/rfc2893.html] RFC 2893 / Transition Mechanisms for IPv6 Hosts and Routers. Requirements:   * IPv4 address of your local tunnel endpoint must be static, global unique and reachable from the foreign tunnel endpoint   * A global IPv6 prefix assigned to you (see 6bone registry)   * A foreign tunnel endpoint which is capable to route your IPv6 prefix to your local tunnel endpoint (mostly remote manual configuration required) ----------------------------------------------------------------------------- 9.1.2. Automatically tunneling Automatic tunneling occurs, when a node directly connects another node gotten the IPv4 address of the other node before. ----------------------------------------------------------------------------- 9.1.3. 6to4-Tunneling 6to4 tunneling ([http://www.faqs.org/rfcs/rfc3056.html] RFC 3056 / Connection of IPv6 Domains via IPv4 Clouds) uses a simple mechanism to create automatic tunnels. Each node with a global unique IPv4 address is able to be a 6to4 tunnel endpoint (if no IPv4 firewall prohibits traffic). 6to4 tunneling is mostly not a one-to-one tunnel. This case of tunneling can be divided into upstream and downstream tunneling. Also, a special IPv6 address indicates that this node will use 6to4 tunneling for connecting the world-wide IPv6 network ----------------------------------------------------------------------------- 9.1.3.1. Generation of 6to4 prefix The 6to4 address is defined like following (schema is taken from [http:// www.faqs.org/rfcs/rfc3056.html] RFC 3056 / Connection of IPv6 Domains via IPv4 Clouds): +---------------------------------------------------------------------------+ || 3+13 | 32 | 16 | 64 bits | | |+---+------+-----------+--------+--------------------------------+ | || FP+TLA | V4ADDR | SLA ID | Interface ID | | || 0x2002 | | | | | |+---+------+-----------+--------+--------------------------------+ | +---------------------------------------------------------------------------+ FP and TLA together (16 bits) have the value 0x2002. V4ADDR is the node's global unique IPv4 address (in hexadecimal notation). SLA is the subnet identifier (65536 local subnets possible) and are usable to represent your local network structure. For gateways, such prefix is generated by normally using SLA ??0000?? and suffix ??::1?? (not a must, can be an arbitrary one with local-scope) and assigned to the 6to4 tunnel interface. Note that Microsoft Windows uses V4ADDR also for suffix. ----------------------------------------------------------------------------- 9.1.3.2. 6to4 upstream tunneling The node has to know to which foreign tunnel endpoint its in IPv4 packed IPv6 packets should be send to. In ??early?? days of 6to4 tunneling, dedicated upstream accepting routers were defined. See [http://www.kfu.com/~nsayer/6to4 /] NSayer's 6to4 information for a list of routers. Nowadays, 6to4 upstream routers can be found auto-magically using the anycast address 192.88.99.1. In the background routing protocols handle this, see [http://www.faqs.org/rfcs/rfc3068.html] RFC 3068 / An Anycast Prefix for 6to4 Relay Routers for details. ----------------------------------------------------------------------------- 9.1.3.3. 6to4 downstream tunneling The downstream (6bone -> your 6to4 enabled node) is not really fix and can vary from foreign host which originated packets were send to. There exist two possibilities:   * Foreign host uses 6to4 and sends packet direct back to your node (see below)   * Foreign host sends packets back to the world-wide IPv6 network and depending on the dynamic routing a relay router create a automatic tunnel back to your node. ----------------------------------------------------------------------------- 9.1.3.4. Possible 6to4 traffic   * from 6to4 to 6to4: is normally directly tunneled between the both 6to4 enabled hosts   * from 6to4 to non-6to4: is sent via upstream tunneling   * non-6to4 to 6to4: is sent via downstream tunneling ----------------------------------------------------------------------------- 9.2. Displaying existing tunnels 9.2.1. Using "ip" Usage: +---------------------------------------------------------------------------+ |# /sbin/ip -6 tunnel show [] | +---------------------------------------------------------------------------+ Example: +---------------------------------------------------------------------------+ |# /sbin/ip -6 tunnel show | |sit0: ipv6/ip remote any local any ttl 64 nopmtudisc | |sit1: ipv6/ip remote 195.226.187.50 local any ttl 64 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.2.2. Using "route" Usage: +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 | +---------------------------------------------------------------------------+ Example (output is filtered to display only tunnels through virtual interface sit0): +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 | grep "\Wsit0\W*$" | |::/96 :: U 256 2 0 sit0 | |2002::/16 :: UA 256 0 0 sit0 | |2000::/3 ::193.113.58.75 UG 1 0 0 sit0 | |fe80::/10 :: UA 256 0 0 sit0 | |ff00::/8 :: UA 256 0 0 sit0 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.3. Setup of point-to-point tunnel There are 3 possibilities to add or remove point-to-point tunnels. A good additional information about tunnel setup using ??ip?? is [http:// www.deepspace6.net/docs/iproute2tunnel-en.html] Configuring tunnels with iproute2 (article) ([http://mirrors.bieringer.de/www.deepspace6.net/docs/ iproute2tunnel-en.html] Mirror). ----------------------------------------------------------------------------- 9.3.1. Add point-to-point tunnels 9.3.1.1. Using "ip" Common method at the moment for a small amount of tunnels. Usage for creating a tunnel device (but it's not up afterward, also a TTL must be specified because the default value is 0). +---------------------------------------------------------------------------+ |# /sbin/ip tunnel add mode sit ttl remote | |¬ local | +---------------------------------------------------------------------------+ Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/ip tunnel add sit1 mode sit ttl remote | |¬ local | |# /sbin/ip link set dev sit1 up | |# /sbin/ip -6 route add dev sit1 metric 1 | | | |# /sbin/ip tunnel add sit2 mode sit ttl | |¬ local | |# /sbin/ip link set dev sit2 up | |# /sbin/ip -6 route add dev sit2 metric 1 | | | |# /sbin/ip tunnel add sit3 mode sit ttl | |¬ local | |# /sbin/ip link set dev sit3 up | |# /sbin/ip -6 route add dev sit3 metric 1 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.3.1.2. Using "ifconfig" and "route" (deprecated) This not very recommended way to add a tunnel because it's a little bit strange. No problem if adding only one, but if you setup more than one, you cannot easy shutdown the first ones and leave the others running. Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/ifconfig sit0 up | | | |# /sbin/ifconfig sit0 tunnel | |# /sbin/ifconfig sit1 up | |# /sbin/route -A inet6 add dev sit1 | | | |# /sbin/ifconfig sit0 tunnel | |# /sbin/ifconfig sit2 up | |# /sbin/route -A inet6 add dev sit2 | | | |# /sbin/ifconfig sit0 tunnel | |# /sbin/ifconfig sit3 up | |# /sbin/route -A inet6 add dev sit3 | +---------------------------------------------------------------------------+ Important: DON'T USE THIS, because this setup implicit enable "automatic tunneling" from anywhere in the Internet, this is a risk, and it should not be advocated. ----------------------------------------------------------------------------- 9.3.1.3. Using "route" only It's also possible to setup tunnels in Non Broadcast Multiple Access (NBMA) style, it's a easy way to add many tunnels at once. But none of the tunnel can be numbered (which is a not required feature). Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/ifconfig sit0 up | | | |# /sbin/route -A inet6 add gw | |¬ :: dev sit0 | |# /sbin/route -A inet6 add gw | |¬ :: dev sit0 | |# /sbin/route -A inet6 add gw | |¬ :: dev sit0 | +---------------------------------------------------------------------------+ Important: DON'T USE THIS, because this setup implicit enable "automatic tunneling" from anywhere in the Internet, this is a risk, and it should not be advocated. ----------------------------------------------------------------------------- 9.3.2. Removing point-to-point tunnels Manually not so often needed, but used by scripts for clean shutdown or restart of IPv6 configuration. ----------------------------------------------------------------------------- 9.3.2.1. Using "ip" Usage for removing a tunnel device: +---------------------------------------------------------------------------+ |# /sbin/ip tunnel del | +---------------------------------------------------------------------------+ Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/ip -6 route del dev sit1 | |# /sbin/ip link set sit1 down | |# /sbin/ip tunnel del sit1 | | | |# /sbin/ip -6 route del dev sit2 | |# /sbin/ip link set sit2 down | |# /sbin/ip tunnel del sit2 | | | |# /sbin/ip -6 route del dev sit3 | |# /sbin/ip link set sit3 down | |# /sbin/ip tunnel del sit3 | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.3.2.2. Using "ifconfig" and "route" (deprecated because not very funny) Not only the creation is strange, the shutdown also...you have to remove the tunnels in backorder, means the latest created must be removed first. Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 del dev sit3 | |# /sbin/ifconfig sit3 down | | | |# /sbin/route -A inet6 del dev sit2 | |# /sbin/ifconfig sit2 down | | | |# /sbin/route -A inet6 add dev sit1 | |# /sbin/ifconfig sit1 down | | | |# /sbin/ifconfig sit0 down | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.3.2.3. Using "route" This is like removing normal IPv6 routes. Usage (generic example for three tunnels): +---------------------------------------------------------------------------+ |# /sbin/route -A inet6 del gw | |¬ :: dev sit0 | |# /sbin/route -A inet6 del gw | |¬ :: dev sit0 | |# /sbin/route -A inet6 del gw | |¬ :: dev sit0 | | | |# /sbin/ifconfig sit0 down | +---------------------------------------------------------------------------+ ----------------------------------------------------------------------------- 9.3.3. Numbered point-to-point tunnels Sometimes it's needed to configure a point-to-point tunnel with IPv6 addresses like in IPv4 today. This is only possible with the first (ifconfig+route - deprecated) and third (ip+route) tunnel setup. In such cases, you