Difference between pages "Lenovo Thinkpad T420" and "IPv6 Networking"

From Funtoo
(Difference between pages)
Jump to: navigation, search
(Installing Grub onto the Drive(Everyone))
 
(ISPs who currently have IPv6 enabled for residential customers)
 
Line 1: Line 1:
+
= Introduction =
== Introduction ==
+
Throughout, this article will assume the following:
+
* You have installed Gentoo or Funtoo in the past.
+
** If you haven't, this article will still serve you well, but please have either the official funtoo, or gentoo install guides open. We move through non-machine-specific bits with little elaboration.
+
* Have a T420 or similar machine.
+
  
Even if you do not have a T420, you may find this guide useful for:
+
[[wikipedia:IPv6|IPv6]] is an redesigned and improved version of the IPv4 protocol, and is intended to start replacing IPv4 in 2011 and beyond as the [[wikipedia:IPv4_address_exhaustion|IPv4 global address space becomes exhausted]]. IPv6 includes a number of improvements over IPv4, including most notably 128-bit addressing, simplified protocol header, integrated IPSec and Multicast implementations, improved discovery, flexibility and router interaction, and improved facilities for auto-configuration. IPv6 also marks the end of [[wikipedia:Network_address_translation|Network Address Translation]] (NAT), which is not recommended or necessary with IPv6. While it's possible to use non-routable addresses with IPv6, this is not a requirement and it is possible for any IPv6 device to have its own globally routable IP address if desired.
* Nvidia Optimus Cards.
+
* Power management.
+
* General setup.
+
  
This installation assumes (For now) that the install is starting from an MS-Windows installation. If you are not on Windows, please add your favourite choice of steps, keep the emphasis on ease of understanding.
+
== Addressing ==
  
== Getting Started ==
+
IPv6 addresses consist of 128 bits. The first 64 bits are used for the network and subnet portion of the address, while the remaining 64 bits are used for the host portion of the address. For more information on how to represent IPv6 addresses, please see the Presentation section of the [[wikipedia:IPv6_address|IPv6 address]] page on Wikipedia.  
You'll want to get yourself running off a LiveCD or LiveUSB to start. This guide will assume liveUSB, since some users find them more difficult to prepare, this is usually due to boot flag issues.
+
(Note: ''Live USB restore drives are nice to have in general! The author keeps one in his college binder.'')
+
  
==== Windows ====
+
=== Network Masks ===
We can use LiLi for this, it provides a nice, simple interface and is fairly reliable: [http://www.linuxliveusb.com/en/download LiLi Download]
+
  
=== SysrescueCD ===
+
IPv6 addresses also have an associated network mask, which is typically written as a trailing "/64" or "/48" at the end of the address, which specifies what bits of the address are used for network and subnet parts. For example, a "/48" mask specifies that addresses use a 48-bit network part, followed by a 16-bit subnet part (allowing for 2^16 subnets), followed by a 64-bit host part (allowing for up to 2<sup>64</sup> hosts for each of the 2<sup>16</sup> subnets to be specified.) In contrast, a "/64" mask specifies that addresses use a 64-bit network part, no subnet part, and a 64-bit host part (allowing up to 2<sup>64</sup> hosts total to be specified.) This means that if you are issued a "/64" set of addresses, you will not be able to define any subnets, but if you are issued a "/48" set of addresses, you will be able to define up to 2<sup>16</sup> subnets.
Grab the version that Suites your needs here: [http://www.sysresccd.org/Download Sysrescue Download]
+
Next use LiLi (Or whatever you happen to be using) to flash the image or burn your CD. Reboot, change your boot device, and you'll find yourself at a grub menu.
+
  
Since the T series are all 64-bit laptops, make sure to boot the 64-bit kernel, as the default is 32-bit.
+
=== Address Space and Security ===
  
''But Why?: If we pick 32-bit, later on we won't be able to chroot into our Funtoo's 64-bit stage 3.''
+
IPv6 also uses a global, flat address space. IPv6 is designed so that any device that needs to communicate on the Internet is able to have a unique globally-routable address. With IPv6, there is no need for using [[wikipedia:Network_address_translation|Network Address Translation]] (NAT). With IPv4, NAT is often used as a means of protecting systems from being accessed by malicious users. With IPv6, firewalls are typically used instead of NAT for restricting access to systems. With IPv6, it is normal for all machines on your home network to have "globally routable" addresses, the equivalent of a "public IP" in the world of IPv4. It is important to understand that this is the way that IPv6 is intended to be used for the majority of users, and that an IPv6-enabled router will no longer be performing NAT for you.
  
You should see a fairly verbose boot as sysrescueCD scans for modules it requires and starts up. It is safe to simply accept prompt defaults here, unless they are errors.
+
=== Using IPv6 ===
  
When you are greeted by the interactive command prompt, enter 'wizard' as prompted, and accept the default entry in the dialogue. This will give us a functioning XFCE desktop environment.
+
There are several ways to use IPv6 with Funtoo Linux. Here are some possibilities:
  
== Partitioning ==
+
* Participating in an existing IPv6 network
Partitioning is the only step of this install which provides real risk to data on other operating systems. Be extremely careful if there is something you do not wish to loose. These steps are not foolproof and may result in lost data.
+
* Creating a local IPv6 over IPv4 tunnel
 +
* Enabling IPv6 on your router, possibly via a tunnel (several ISP uses '''6rd'''...)
 +
* Unique Local IPv6 Unicast Addresses (site local)
  
Please be aware that MBR disks only support '''4''' primary partitions. You can solve this by creating an 'extended' partition and adding logical partitions to it. If you are feeling particularly brave try GPT on your disk.
+
==== Participating in IPv6 Network ====
  
So lets start:
+
The first approach is an option if your Funtoo Linux system happens to be on an IPv6 network, or you desire to set up an IPv6 network. In this case, the Funtoo Linux system simply needs to be configured to participate in this IPv6 network -- and can also participate in an IPv4 network simultaneously. If you will be configuring an IPv6-compatible router, then you will simply configure your Funtoo Linux system to participate in this network.
First open up gparted. You should see it on the taskbar if you're using systemrescueCD. It will scan available drives and show you the partition table. Most users will likely find one of the following to their liking:
+
  
==== Pure Funtoo ====
+
==== Local IPv6 over IPv4 Tunnel ====
You'll likely want:
+
 
<pre>
+
Another approach for using IPv6 is to configure an IPv6 over IPv4 tunnel locally on your Funtoo Linux system, in cooperation with a tunnel provider. This will allow you to use an existing IPv4 network to connect a single Funtoo Linux system to IPv6. It is also possible to configure this system to serve as an IPv6 router.
/boot      :: EXT2      :: 100mb-500mb
+
 
    ''Note: We choose EXT2 because there is really no good use for a journalled boot partition, but feel free to use EXT4 instead!''
+
==== Enabling IPv6 on Your Router ====
/          :: EXT4      :: 60gb (suggested floor value) - 500+
+
 
swap        :: linux-swap :: Your RAM Value (Optional, allows for hibernation)
+
If you have a router that is capable of supporting IPv6, then it is possible to configure your router so that an IPv6 network is available, at which point you can simply configure your Funtoo Linux system to participate in it. Note that many popular home/office routers can be configured to use an IPv6 over IPv4 tunnel, which provides a convenient option for home networks or smaller organizations to participate in IPv6. Using this approach, your computer systems behind the router are simply configured to participate in an IPv6 network, and your router handles tunneling the IPv6 traffic back and forth between your tunnel provider. This is typically the most flexible option for exploring IPv6 as it allows you to have multiple computer systems in your home or office to participate in an IPv6 network while your router takes care of everything transparently.
</pre>
+
 
You may wish for a separate /home, which is perfectly legitimate, or any number of other partitions.  
+
==== Using Unique Local IPv6 Unicast Addresses ====
 +
 
 +
If you don't have public IPv6 connectivity or you don't wish to open an IPv6 tunnel over an IPv4 network, you can use a mechanism similar to IPv4 private addresses ranges. This mechanism consists of concatenating the prefix FC00::/7 with a globally unique identifier and a subnet identifier to form the upper 64 bits of the IPv6 address. Details of the mechanisms to forge a unique local IPv6 unicast address are documented in [http://tools.ietf.org/html/rfc4193 RFC 4193], however unique local IPv6 unicast addresses are made of the following components:
  
==== Dual Boot with Windows ====
 
If dual booting with Windows, it is advisable to have Windows installed '''first''' since it will muck with the MBR and possibly want to create it's own boot partition.
 
You'll likely want:
 
 
<pre>
 
<pre>
System Reserved    :: NTFS      :: Whatever windows chooses.
+
      | 7 bits |1|  40 bits  |  16 bits  |          64 bits          |
Windows            :: NTFS      :: >100gb (If you plan on doing any serious work on windows)
+
      +--------+-+------------+-----------+----------------------------+
/boot              :: EXT2      :: 100mb-500mb
+
      | Prefix |L| Global ID  | Subnet ID |        Interface ID        |
Extended Partition -
+
      +--------+-+------------+-----------+----------------------------+
  /                :: EXT4      :: Whatever is left.
+
  swap            :: linux-swap:: Your RAM value. (Optional, allows for hibernation)
+
 
</pre>
 
</pre>
You may also want a separate /home, etc. These will fit into your extended partition without contributing to MBR's 4 partition limit.
 
  
== Starting the  (actual) Install ==
+
* Prefix (7 bits): always FC00::/7
Up until now everything we've done has just been foreplay. Finally we can mount our partitions and get started on the installation!
+
* L (1 bits): must be set to 1 (1 = prefix is locally assigned, 0 is undefined so far and must not be used)
 +
* Global ID: A random identifier (see [http://tools.ietf.org/html/rfc4193 RFC 4193] for details about the generation algorithm
 +
* Interface ID: Host interface ID as defined in [http://tools.ietf.org/html/rfc3513 RFC 3513]
  
==== Mounting ====
+
{{fancynote|Just like with private IPv4 addresses, an IPv6 router must not route a unique local IPv6 unicast address outside the organization local network.}}
First, lets mount all of our partitions.
+
* Make a directory for root. Lets assume '''/mnt/funtoo'''
+
<console>
+
###i## mkdir /mnt/funtoo
+
</console>
+
* Mount your '/' partition to /mnt/funtoo
+
<console>
+
###i## mount /dev/sd## /mnt/funtoo
+
</console>
+
* Make a directory for your boot partition.
+
<console>
+
###i## mkdir /mnt/funtoo/boot
+
</console>
+
* Mount your boot partition.
+
<console>
+
###i## mount /dev/sd## /mnt/funtoo/boot
+
</console>
+
* Mount anything else you may have made and need. (Not swap)
+
  
==== Checking the Date ====
+
= Requirements =
Although this may seem super un-important, if you want to avoid lots of spammy warning messages later, checking your date is beneficial.
+
<console>
+
###i## date
+
</console>
+
If it needs to be set, you'll want something like:
+
<console>
+
###i## date 071620002011
+
#Fri Jul 16 20:00:00 UTC 2011
+
</console>
+
  
==== Fetch a Stage 3 ====
+
IPv6 requires CONFIG_IPV6 to be enabled in your kernel (either compiled in or as a module). If compiled as a module (e.g. if your kernel was compiled by genkernel), ensure the module is loaded.
Next we need to fetch a tarball containing a barebones stage. We will download the core-i7 architecture version, if you have a core i5 or i3, don't worry, it's all the same.
+
 
<console>
 
<console>
###i## cd /mnt/funtoo
+
###i## lsmod | grep ipv6
###i## wget http://ftp.osuosl.org/pub/funtoo/funtoo-current/x86-64bit/corei7/stage3-current.tar.xz
+
 
</console>
 
</console>
  
Next let's unpack with:
+
If this returns nothing, load the module with:
 
<console>
 
<console>
###i## tar xJpf stage3-current.tar.xz
+
###i## modprobe ipv6
 
</console>
 
</console>
{{Note}} ''Seriously, don't forget the 'p' option.''
 
  
If you run 'ls' now, you should see the <code>/mnt/funtoo</code> is fully populated with folders such as lib, home, and proc.
+
= Commands =
  
==== Chroot'ing ====
+
; ping6
Now we need to change the ''apparent root'' of our system to our fledgling Funtoo system.
+
: IPv6 ping command
<console>
+
; route -6
###i## cd /mnt/funtoo
+
: show IPv6 routes
###i## mount --bind /proc ./proc
+
; ip -6 neigh show
###i## mount --bind /dev ./dev
+
: show all IPv6 neighbors on the local LAN
###i## cp /etc/resolv.conf ./etc
+
###i## env -i HOME=/root TERM=$TERM chroot /mnt/funtoo /bin/bash --login
+
</console>
+
  
==== Getting the Portage Tree ====
+
= Configuration =
Funtoo (Unlike Gentoo) uses a git based portage tree, however if you're coming from Gentoo, you'll be glad to know we sync with the Gentoo tree once every 12 hours.
+
<console>
+
###i## emerge --sync
+
</console>
+
''You can ignore most of the errors that might be spat out at this stage, however if they do not disappear on subsequent merges, talk to us in #funtoo.''
+
Your first sync will take significantly longer then subsequent syncs, as the whole tree must be synced.
+
  
==== A Configuration Celebration ====
+
== Participating in an Existing IPv6 Network ==
Now that we have our portage tree cloned, we need to do some initial setup on some files before doing anything else with portage.
+
  
'''Fstab'''
+
If your local network already supports IPv6, then you can simply configure Funtoo Linux to participate in this IPv6 network. Here is a sample configuration that might be used to configure an ethernet interface (netif.eth0) to participate in both an IPv4 and IPv6 network:
  
<console>
 
###i## nano /etc/fstab
 
</console>
 
 
You'll want something like this: (Replace the dev values with what you are using)
 
 
{{File
 
{{File
|/etc/fstab|<pre>
+
|/etc/netif.d/netif.eth0|<pre>
# <fs> <mountpoint> <type> <opts>         <dump/pass>
+
template="interface"
 
+
ipaddr="10.0.1.200/24 2001:470:d:c2c:218:51ff:feea:ee21/64"
/dev/sda1 /boot ext2 noauto,noatime  1 2
+
gateway="10.0.1.1"
/dev/sda3 none swap sw         0 0
+
nameservers="10.0.1.1 2001:470:20::2"
/dev/sda4 / ext4 noatime         0 1
+
domain="funtoo.org"
/dev/cdrom /mnt/cdrom auto noauto,ro         0 0
+
multicast="yes"
 +
routes="2000::/3 via fe80::daa2:5eff:fe7a:83de dev eth0"
 
</pre>}}
 
</pre>}}
  
'''Localtime'''
+
Above, we use the <tt>interface</tt> template, and specify both an IPv4 and IPv6 address (with network mask) for <tt>ipaddr</tt>. In addition, an IPv4 and IPv6 nameserver is specified. For routing, we use the <tt>gateway</tt> command to specify an IPv4 gateway, while we use the <tt>routes</tt> command to specify a route to our router, which in this case has address <tt>fe80::daa2:5eff:fe7a:83de</tt> and is reachable on device eth0.
  
Lets remove the default localtime, and create a symbolic link to the proper time zone. (You probably will want something other then Vancouver)
+
Note that we specify a route for "2000::/3" rather than "::/0" or "default", and this is a bit unusual. This is to work around a bug in many Linux kernels that prevents the default route from being handled properly. "2000::/3" maps to all routable IP addresses and has the benefit of being compatible with all Linux kernels.
<console>
+
###i## rm /etc/localtime
+
###i## ln -s /usr/share/zoneinfo/America/Vancouver /etc/localtime
+
</console>
+
  
''' Hostname '''
+
=== Many Addresses and Stateless Autoconfiguration ===
Set your host name:
+
<console>
+
###i## nano /etc/conf.d/hostname
+
</console>
+
  
'''Hwclock'''
+
Also note that if we did not specify an IPv6 address in the <tt>ipaddr</tt> variable, then eth0 would still get at least one IPv6 address anyway. First, it would get a link-local address, starting in <tt>fe80::/16</tt>, and it would also automatically use ''stateless autoconfiguration'' to grab an unused IPv6 address from the range used by your IPv6 router. This works similarly to the way a DHCP client works with IPv4, but is built-in to the IPv6 protocol and does not require a DHCP server to function. It works because with IPv6, routers send out ICMP packets to advertise themselves to systems on your network, and your Funtoo Linux system can use this information to automatically grab an unused address. It is important to understand this behavior because it means that by default, your Funtoo Linux system will grab a globally-routable ("public") IPv6 address from your router with no steps necessary on your part and thus may be accessible from the Internet if no firewall is in place. However, in most cases the default IPv6 route must be specified in the <tt>routes</tt> variable for IPv6 to function properly, so this auto-configuration isn't completely automatic at this time.
  
If you're using a dual boot system, you'll want to change this. Otherwise it's entirely optional.
+
== Local IPv6 over IPv4 Tunnelling ==
<console>
+
###i## nano /etc/conf.d/hwclock
+
</console>
+
  
If you're on windows you'll want:
+
Tunnelling is the process of encapsulating IPv6 packets within an IPv4 packet so that it can be transmitted over an IPv4 network. This process happens at a local ''tunnel entry point'', which can be a Linux machine or a router, such as an Apple AirPort. The packet then traverses the IPv4 network, until reaches the ''tunnel endpoint'', which ''de-encapsulates'' the packet and places it on an IPv6 network. There are several different types of IPv6 tunnels. There are also several IPv6 tunnel providers that offer free tunnelling services, making it convenient to start using IPv6, even on your home network.
<console>
+
###i## clock="local"
+
</console>
+
  
'''Make.conf'''
+
Note that if you want configure an IPv6 over IPv4 tunnel on your router, such as an Apple AirPort, then you will simply need to sign up with one of the tunnel providers and use their instructions to configure your router. At this point, your router will be IPv6 enabled and you can then configure your Funtoo Linux system to participate in an existing IPv6 network using the instructions in the previous section. If this is not an option for you, then it is also possible to set up the IPv6 over IPv4 tunnel directly on your Funtoo Linux system. This means that only your Funtoo Linux system will be able to participate in IPv6, at least to start (later, you could configure your Funtoo Linux system to route IPv6 for other machines on your network) Follow the instructions in this section to set up local tunneling on your Funtoo Linux system.
Important enough that it deserves it's own article. A template make.conf for the T420 will be forthcoming.
+
  
For now:
+
=== Tunnel providers ===
If you have an i5 or i3 you will want
+
; [http://gogonet.gogo6.com/page/freenet6-tunnelbroker freenet6]
{{File
+
: Supports anonymous tunnels and works behind NAT. You can connect to with your login or as anonymous from anywhere. This can be configured under Funtoo Linux by emerging the '''net-misc/gogoc''' ebuild.
|/etc/portage/make.conf|<pre>
+
; [http://tunnelbroker.net/ Hurricane Electric]
MAKEOPTS="-j3"
+
: Configured '''6in4''' tunnel, with support for dynamic IPv4 addresses, and Apple AirPorts can be configured to use this tunnel - see [http://www.nedprod.com/Niall_stuff/addingIPv6toyourhome.html this link]. Also see [http://ipv6.he.net/certification/faq.php ipv6.he.net FAQ] You can setup this tunnel with ifconfig and iproute2, or configure your router to be the tunnel entry point  -- the point at which IPv6 traffic is encapsulated/de-encapsulated.
</pre>}}
+
; [http://en.wikipedia.org/wiki/Teredo_tunneling Teredo]/[http://www.remlab.net/miredo/ Miredo]
If you have an i7 you'll probably want:
+
: [http://tools.ietf.org/html/rfc4380 RFC4380] mandated transition mechanism. Works behind NAT. Assigns one "/128" per host.
{{File
+
|/etc/portage/make.conf|<pre>
+
MAKEOPTS="-j5"
+
</pre>}}
+
  
''But I have Hyperthreading! Why only -j3?''
+
=== Getting Started with gogoc ===
Hyperthreading and compiling don't play well together. You'll have the same (or better) performance with -j3 as -j5 with a dual core hyper threaded processor.
+
  
== Stop, Kernel time! ==
+
Freenet6 is a free IPv6 access service provided by gogo6 via the [http://en.wikipedia.org/wiki/Tunnel_Setup_Protocol TSP tunnelling protocol].
''For this guide we'll be using some pre-found config options that I will be adding later.''
+
<code>gogoc</code> supports any TSP tunnel; perhaps one is provided by your ISP. We will focus on an anonymous tunnel via freenet6.
  
* Networking:
+
You need ipv6 to be enabled in your kernel as well as the TUN module.
** iwlwifi and auxilary
+
** Unknown intel ethernet adapter. Selected several.
+
* GPU
+
** Intel available default.
+
** nvidia will be dealt with later
+
  
Install:
+
You can quickly get started by emerging {{Package|net-misc/gogoc}}, adding <code>gogoc</code> to your startup scripts and starting it.
* wpa_supplicant
+
{{Package|net-misc/gogoc}} is currently keyworded unstable (on some architectures, see [https://bugs.gentoo.org/362549 gentoo bug #362549]). If you are running stable Funtoo, you may want to put an entry into your package.keywords/package.accept_keywords file.
* iwl6000-ucode
+
* wireless-tools
+
 
+
 
+
== Bootloader Setup ==
+
In funtoo the setup of grub is extremely simplified.
+
 
<console>
 
<console>
###i## emerge -vqat boot-update
+
###i## emerge gogoc
 +
###i## bzcat /usr/share/doc/gogoc-*/gogoc.conf.sample.bz2 >/etc/gogoc/gogoc.conf
 +
###i## rc-update add gogoc default
 +
###i## /etc/init.d/gogoc start
 
</console>
 
</console>
''Q: What are those options? A: We'll get to them later, lets get the system booted first, okay? ''
 
Boot-update is a tool that will allow for very simple configuration of grub similar to older versions (But nicer still).
 
  
You will now edit the file <code>/etc/boot.conf</code>:
+
{{Note}}By default, <code>gogoc</code> will use an anonymous tunnel. If you wish to authenticate yourself, read and edit <code>/etc/gogoc/gogoc.conf</code>.
{{File
+
|/etc/boot.conf|<pre>
+
boot {
+
        generate grub
+
        default "Funtoo Linux genkernel"
+
        timeout 3
+
}
+
  
"Funtoo Linux" {
+
=== Getting started with Teredo ===
        kernel bzImage[-v]
+
        # params += nomodeset
+
}
+
  
"Funtoo Linux genkernel" {
+
While this mechanism is officially called Teredo, the implementation of the Teredo service we will be using is called Miredo.
        kernel kernel[-v]
+
{{Note}}{{Package|net-misc/miredo}} is currently keyworded unstable. If you are running stable Funtoo, you may want to put an entry into your package.keywords/package.accept_keywords file.}}
        initrd initramfs[-v]
+
        params += real_root=auto
+
        # params += nomodeset
+
}  
+
</pre>}}
+
This can be configured (We'll touch on this later. We need to make sure the kernel is booting and working before we start tweaking) with options for the kernel.
+
  
==== Dual-Booters Only ====
+
Emerge <tt>net-misc/miredo</tt> and start it up (you can add it to your default runlevel if you wish):
If you want to dual boot with windows you'll need to add an entry here:
+
{{File
+
|/etc/boot.conf|<pre>
+
<pre>
+
"Windows 7" {
+
    type win7
+
    params root=/dev/sda1
+
}
+
</pre>}}
+
==== Installing Grub onto the Drive(Everyone) ====
+
Next we can install grub onto the drive.
+
 
<console>
 
<console>
###i## grub-install --no-floppy /dev/sda
+
###i## emerge net-misc/miredo
###i## boot-update
+
###i## /etc/init.d/miredo start
 
</console>
 
</console>
No errors means we should be good to go!
 
  
== Tidy up and go. ==
+
{{Note}}Miredo requires <code>CONFIG_TUN</code> enabled in your kernel. If it is compiled as a module, ensure the <tt>tun</tt> module is loaded.
Just a few more things!
+
  
Lets set a root password.
+
If all goes well, you can check the assignment of an IPv6 address using <tt>/sbin/ip</tt>, for example:
 
<console>
 
<console>
###i## passwd
+
###i## /sbin/ip addr show dev teredo
 +
4: teredo: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc pfifo_fast state UNKNOWN qlen 500
 +
    link/none
 +
    inet6 2001:0:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/32 scope global
 +
      valid_lft forever preferred_lft forever
 +
    inet6 fe80::ffff:ffff:ffff/64 scope link
 +
      valid_lft forever preferred_lft forever
 
</console>
 
</console>
  
It is advisable to exit the chroot and umount all the relevant install drives. Or at least just exit the chroot, but you can just simply reboot from here.
+
=== Tunnelling 6to4 ===
<console>
+
###i## exit
+
###i## cd /
+
###i## umount /mnt/funtoo/boot /mnt/funtoo/dev /mnt/funtoo/proc /mnt/funtoo
+
###i## reboot
+
</console>
+
  
== Configuring the New System ==
+
6to4 is an Internet transition mechanism for migrating from IPv4 to IPv6, a system that allows IPv6 packets to be transmitted over an IPv4 network (generally the IPv4 Internet) without the need to configure explicit tunnels.
Welcome to funtoo! You should be greeted by a bunch of spammy text that scrolls by reasonably fast and then a couple penguins and openrc. Login to your root user and lets start playing.
+
When using 6to4 your IPv6 golablly addressable IP is generated from you IPv4 IP address.
  
A note, this part of the guide is meant to be much more of a dialogue between us.
+
The anycast address of 192.88.99.1 has been allocated for the purpose of sending packets to a 6to4 relay router. Note that when converted to a 6to4 IPv6 address with the subnet and hosts fields set to zero this IPv4 address (192.88.99.1) becomes the IPv6 address 2002:c058:6301::.
  
==== Getting up the (wired) network ====
+
To use the funtoo network template method, write the config file for the interface /etc/conf.d/netif.6to4 (which will also handle the converting of your IPv4 address to your IPv6 address). Make sure you change "WAN" to your correct internet facing interface.
If you're gifted with a wired network connect, use it! The initial setup is much more convenient and quick.
+
<pre>
 +
template=ipv6-tunnel
 +
WAN="eth0"
 +
MTU="1280"
 +
ipv4=`ifconfig $WAN | sed -ne 's/[[:space:]]*inet addr:\([0-9.]*\).*/\1/p'`
 +
ipv6=`printf "2002:%02x%02x:%02x%02x::1" \`echo $ipv4 | tr "." " "\``
 +
remote=192.88.99.1
 +
local="$ipv4/24"
 +
ipaddr="$ipv6/48"
 +
routes="2000::/3 via 2002:c058:6301:: dev $WAN"
 +
</pre>
  
Quickly set up the network with
+
Then create the netif.6to4 symlink and add it to the default runlevel
 
<console>
 
<console>
###i## /etc/init.d/dhcpcd start
+
###i## ln -s /etc/init.d/netif.tmpl /etc/init.d/netif.6to4
 +
###i## rc-update add netif.6to4 default
 +
###i## /etc/init.d/netif.6to4 start
 
</console>
 
</console>
Now check to see if our wired adapter is listed with ifconfig.
+
 
 +
You should now be capable of connecting via IPv6:
 
<console>
 
<console>
###i## ifconfig
+
###i## ping6 ipv6.google.com
#  (or)
+
###i## ping google.com
+
 
</console>
 
</console>
If you see it listed with a description, we're good to go!
 
  
==== Editing the make.conf ====
+
To allow this host to be a router, a modified template is required:
Before we start merging into our tree everything under the sun, lets do some system planning.
+
 
+
You can use this as a starting point:
+
 
{{File
 
{{File
|/etc/portage/make.conf|<pre>
+
|/etc/netif.d/ipv6-tunnel|<pre>
# These settings were set by the metro build script that automatically built this stage.
+
#!/bin/sh
# Please consult /etc/make.conf.example for a more detailed example.
+
  
ACCEPT_KEYWORDS="~amd64"
+
netif_pre_up() {
CHOST="x86_64-pc-linux-gnu"
+
        require local remote
CFLAGS="-march=corei7 -O2 -pipe"
+
        try ip tunnel add $interface mode sit remote $remote local $local ttl 255
CXXFLAGS="-march=corei7 -O2 -pipe"
+
        try ip addr add $ipaddr dev $interface
SYNC="git://github.com/funtoo/ports-2012.git"
+
        try ip addr add $ipaddr4 dev $interface
 +
}
  
# -j3 :: Have make use 3 threads by default.
+
netif_post_up() {
MAKEOPTS="-j3"
+
        try ip route add ::/0 dev $interface
#  Setup emerge's default options:
+
}
#    --ask    :: Double check before merging.
+
#    --verbose :: Show use flags etc.
+
#    --quiet  :: Don't show me make spam.
+
#    --tree    :: Use nice dependancy graphs.
+
EMERGE_DEFAULT_OPTS="--ask --verbose --quiet --tree"
+
  
# Portage Features
+
netif_pre_down() {
#    TODO: Descriptions
+
        ip route del ::/0 dev $interface
FEATURES="mini-manifest parallel-fetch userfetch parallel-install sandbox fixpackages collision-protect"
+
}
  
#  We might use binary packages later. Lets set that up just in case.
+
netif_post_down() {
PORTAGE_BINHOST=/usr/portage/packages
+
        ip tunnel del $interface
 +
}
 +
</pre>}}
  
 
+
Then add the following line to <tt>/etc/conf.d/netif.6to4</tt>:
# CCache
+
{{File
#  This is not going to be done by default.
+
|/etc/conf.d/netif.6to4|<pre>
#  Why? It's only wortwhile if you plan on compiling packages multiple
+
ipaddr4="$ipv4/24"
#  times per version, which the average user will not.
+
#CCACHE_SIZE="5G"
+
#CCACHE_DIR="/var/cache/ccache"
+
 
+
# Licenses
+
#  By default we're just going to accept everything.
+
ACCEPT_LICENSE="*"
+
 
+
 
+
# Device Specific Settings
+
#    INPUT_DEVICES :: A list of input devices you'll be wanting. This is needed for xorg and not much else.
+
INPUT_DEVICES="evdev synaptics"
+
#    VIDEO CARDS  :: A list of video cards. Optimus users beware here.
+
VIDEO_CARDS="intel i915 i965 nvidia"
+
 
+
# Use flags.
+
#  Application specific flags should be migrated to /etc/portage/package.use (which can be a folder with multiple files!)
+
#  To look at the user flags for an application use "equery uses FOOPKG"
+
USE="
+
acpi alsa /
+
bash-completition /
+
curl /
+
dvdr /
+
ithreads /
+
ncurses networkmanager/
+
policykit /
+
ssl sse sse2 sse3 sse4 /
+
threads /
+
udev /
+
vim-syntax /
+
zsh-completion /
+
"
+
 
</pre>}}
 
</pre>}}
  
=== Installing an Editor ===
+
After restarting the 6to4 interface radvd can be started:
Well, first things first lets get ourselves an editor. The author prefers vim, but you may like emacs or something else... Feel free to disregard this and explore! If you plan to have multiple users however, this will often be expected by experienced linux users.
+
 
+
 
<console>
 
<console>
###i## emerge vim
+
###i## /etc/init.d/netif.6to4 restart
 +
###i## /etc/init.d/radvd start
 
</console>
 
</console>
Check that your USE flags look reasonable (see above) and feel free to do any fine tweaking in /etc/portage/package.use.
 
Consult your output after merge! You may want to follow some of it's advice.
 
  
You can find multiple good guides on google for vim configurations and setups.
+
== Optimization ==
Funtoo also provides a very nice base configuration in /etc/vim/vimrc.
+
  
==== Boot Parameters ====
+
=== Prefer IPv4 over IPv6 ===
The T420 has a number of boot parameters that can be set to conserve power. On a laptop these options are generally reasonable:
+
<pre>
+
$ cat /etc/boot.conf
+
boot {
+
generate grub
+
default "Funtoo Linux"
+
timeout 15
+
}
+
  
"Funtoo Linux" {
+
Generally if your IPv6 connection is through a tunnel, it will be slower than an IPv4 connection. For this reason, if you are using an IPv6 tunnel, it can be best to configure your systems to ''prefer'' IPv4 if an IPv4 version of the site is available, and use IPv6 only when necessary. This way, you will avoid unnecessary encapsulation and de-encapsulation of IPv4 traffic. Here's how to do this for a number of operating systems:
kernel bzImage[-v]
+
#  Force PCIE Active State Power Management on.
+
params += pcie_aspm=force
+
#  TODO (Range 1..15)
+
params += epb=7
+
#  TODO
+
params += hpet=force
+
#  i915 Enable rc6 sleep state (?)
+
params += i915.i915_enable_rc6=1
+
#  TODO (Framebuffer?)
+
params += i915.i915_enable_fbc=1
+
#  Downclock the lvds screen (60hz -> 50hz)
+
params += i915.lvds_downclock=1
+
        #  Quiet some of the excessively verbose kernel boot
+
        params += quiet
+
}
+
  
"Windows 7" {
+
==== Linux ====
        type win7
+
        params root=/dev/sda1
+
}
+
  
#"Funtoo Linux genkernel" {
+
Linux will prefer IPv6 if IPv6 support is enabled in the kernel. To prefer IPv4, edit <tt>/etc/gai.conf</tt> and add this line:
# kernel kernel[-v]
+
{{File
# initrd initramfs[-v]
+
|/etc/gai.conf|<pre>
# params += real_root=auto
+
precedence ::ffff:0:0/96 100
#}
+
</pre>}}
</pre>
+
  
When you're done, update grub with
+
==== Windows 7, Server 2008, Vista ====
<pre>
+
boot-update
+
</pre>
+
  
==== Power Saving Local Scripts ====
+
These operating systems prefer IPv6 by default. See [http://msdn.microsoft.com/en-us/library/bb756941.aspx this link]. To prefer IPv4, use the following steps:
Next we're going to set up a script that runs at default runlevel for the machine. This will echo several options to various dev files. Most distros would do this via /etc/rc.local or something of the like.
+
  
With Funtoo (and Gentoo) this is accomplished via
+
# Start <tt>regedit</tt>.
<pre>
+
# Navigate to <tt>HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP6\Parameters</tt>.
/etc/local.d
+
# Create a new DWORD named <tt>DisabledComponents</tt>. Edit this new DWORD and set it to HEX value of <tt>20</tt> or a DECIMAL value of <tt>32</tt>.
</pre>
+
# Restart your computer.
Consult the README (in directory) for more information.
+
  
<pre>
+
== ISPs who currently have IPv6 enabled for residential customers ==
$ cat /etc/local.d/power-saving.start
+
# /bin/bash
+
#
+
echo 1 > /sys/modules/snd_hda_intel/parameters/power_save
+
for i in /sys/bus/usb/devices/*/power/autosuspend; do
+
    echo 1 > $i
+
done
+
for i in /sys/class/scsi_host/host*/link_power_management_policy; do
+
    echo min_power > $i
+
done
+
</pre>
+
If you copy this wholesale remember to chmod -x the file!
+
  
==== rc.conf ====
+
* Canada:
rc.conf lets us change some options to do with open RC.
+
** '''Videotron''': Videotron has a [http://support.videotron.com/residential/internet/ipv6/videotron-ipv6 beta-program] for residential customers who want to test IPv6 (no official technical support, it is possible they don't have enabled it in your area so check first before investing in new hardware). Although  at date of writing, a large part of their networks are IPv6, '''you must go through a 6rd tunnel''' because they still need to upgrade some of their equipments and '''your router must support the 6rd protocol''' (this requirement is documented). Videotron sells you a D-Link DIR-825 with a modified firmware however this model has a weird gotcha: it does not support IPv6 firewalling.''' This is not a Videotron specific issue''' (even the genuine firmwares coming  from the manufacturer has no support for IPv6 firewalling as of June 2011). A good alternative to recommend is the CISCO/LinkSYS E4200, more expensive (MSRP ~$180 US/CDN) but has IPv6 firewalling support.  Once the E4200 firmware has been upgraded go in Setup/IPv6 Setup disable "IPv6 - Automatic" (you should then see an IPv6 address in the DUID field) and leave "automatic" for the 6rd configuration. You should be in business and see all of the hosts on your network with an IPv6 stack enabled being assigned a public IPv6 address starting with 2607:f048.
 +
** '''Teksavvy''' : TekSavvy has a [http://teksavvy.com/ipv6 IPv6 beta-program] for residential customers who use their DSL service (no statement found for cable connections). Just ask them to enable IPv6 to your subscription and it should be available within the next 24 hours. Their IPv6 connectivity is native so you don't need to setup a tunnel.
 +
** '''Shaw''' (?)
 +
** '''Cogeco cable''' (?)
 +
** '''Telus''' (?)
 +
** '''Bell''' : Bell appears to have an official IPv6 support especially for its business subscribers (See http://ipv6.bell.ca) via a toolkit and various web pages on the subject.
  
First, lets set rc_sys to it's default, this will suppress a warning message at boot.
+
* France
<pre>
+
** '''Free'''
rc_sys=""
+
** '''Nerim'''
</pre>
+
** '''the French Data Network (FDN)'''
 +
* United States:
 +
** '''Comcast''' (limited pilot in some areas only)
  
Next, we can turn on rc_parallel to get a bit of speedup on boot.
+
== Home routers compatible with IPv6 ==
<pre>
+
rc_parallel="YES"
+
</pre>
+
If you get errors or problems with services on boot, try turning this off.
+
 
+
== Making it Usable ==
+
Next we'll be setting up a normal user and installing the venerable Xorg.
+
 
+
==== Mouse in framebuffer ====
+
Right now we should be looking at a framebuffer'd console.
+
<pre>
+
/etc/init.d/gpm start
+
</pre>
+
gpm is a daemon that allows us to use our mouse (trackpad/trackpoint) on console. Give it a try! If you want to keep it on across boots, add it to your init.
+
<pre>
+
rc-update add gpm default
+
</pre>
+
 
+
==== Making a New User =====
+
Lets use superadduser to make the task ever so much easier (Though, it is already easy)
+
<pre>
+
emerge superadduser
+
superadduser
+
</pre>
+
 
+
Walk through the prompts and set up your user how you choose.
+
 
+
==== Sudo Make Me a Sandwich ====
+
Next lets merge in sudo, and set up our new user to be able to use sudo.
+
<pre>
+
emerge sudo
+
</pre>
+
Now edit the config with
+
<pre>
+
visudo
+
</pre>
+
You'll probably want to uncomment out one of the two options:
+
<pre>
+
## Uncomment to allow members of group wheel to execute any command
+
# %wheel ALL=(ALL) ALL
+
 
+
## Same thing without a password
+
# %wheel ALL=(ALL) NOPASSWD: ALL
+
</pre>
+
 
+
Now just add your user to the 'wheel' group.
+
<pre>
+
gpasswd -a foouser wheel
+
exit
+
</pre>
+
Now re-login as your user, and you should be good to go!
+
 
+
==== Tmux ====
+
Before we emerge xorg, lets get tmux working so we can easily scroll through output and look at USE flags etc.
+
<pre>
+
emerge tmux
+
</pre>
+
The default config will suffice for now. You may find it beneficial to learn to use tmux ''properly'' sometime, but for now we'll hold hands.
+
 
+
<pre>
+
tmux
+
</pre>
+
Now we can scroll through output with CTRL+B [ and the up and down arrows.
+
 
+
== Xorg ==
+
Xorg is a large topic in and on itself. We'll focus on getting a working xorg and a simple window manager.
+
 
+
<pre>
+
# (in tmux)
+
sudo emerge xorg-server
+
</pre>
+
Once again use CTRL+B [ to start scrolling (escape to exit) and look through your use flags, adding anything you might want.
+
  
== A note on Gnome ==
+
A few residential routers have support for IPv6 at date of writing and many more home networking devices will have robust IPv6 support in a more or less near futures. The following does not pretend to be exhaustive:
Want to get rid of that awful lock screen on wake from suspend?
+
* '''D-Link DIR-825 rev. 1B''' (June 2011): Has IPv6 support out of the box, however for somewhat reason the router has no support for IPv6 firewalling even with teh 2.05N revision of the firmware. Consequence for you is you have to deploy an IPv6 firewall on each of hosts concerned with a public IPv6 connectivity. The canadian ISP Videotron is selling a DIR-825 with a customized firmware as unfortunately, like with the genuine manufacturer firmware, no IPv6 firewalling possible :( .
<pre>gsettings set org.gnome.desktop.lockdown disable-lock-screen 'true'</pre>
+
* '''CISCO/LinkSys E4200''' (June 2011): Advertised as being IPv6 compatible with a firmware update (available as of June 14th 2011 -> check for the version tagged 1.0.02 build 13 or later on the manufacturer website). The device supports native IPv6 and IPv6 through a 6rd tunnel (no support for any other tunneling protocol).
  
 +
== Resources ==
 +
*[http://ipv6.he.net/certification/cert-main.php free ipv6 certification program]
 +
*[http://ipv6-test.com/ Test ipv6 (ipv6-test.com)]
 +
*[http://test-ipv6.com/ Test ipv6 (test-ipv6.com)]
 +
*[http://www.comcast6.net/ Comcast's IPv6 page]
 +
*[http://tunnelbroker.net/ Hurricane Electric Tunnel Broker ]
 +
*[http://www.gentoo-wiki.info/HOWTO_IPv6 Gentoo Wiki IPv6 ]
 +
*[http://www.gentoo.org/doc/en/ipv6.xml Gentoo IPv6 Guide]
 +
with Apple airport extreme, etc:
 +
*[http://www.tunnelbroker.net/forums/index.php?topic=680.0 tunnelbroker.net forums post - airport config ]
 +
*[http://www.nedprod.com/Niall_stuff/addingIPv6toyourhome.html Adding IPv6 Support To Your Home]
 +
*[http://www.tunnelbroker.net/forums/index.php?topic=273.0 tunnelbroker.net forums post - Gentoo config (won't work in Funtoo)]
 +
Nice Overview over IPv6
 +
* [http://www.linux.com/learn/tutorials/428331-ipv6-crash-course-for-linux IPv6 Crash Course for Linux] and page 2 [http://www.linux.com/learn/tutorials/432537:another-ipv6-crash-course-for-linux-real-ipv6-addresses-routing-name-services IPv6 Crash Course for routing name services]
 +
* [http://livre.g6.asso.fr/index.php/Accueil IPv6 Théorie et Pratique (in french only)] revised online version of the O'Reilly book published in 2005 by a collective researchers and IT actors.
 
[[Category:HOWTO]]
 
[[Category:HOWTO]]
[[Category:HWLaptop]]
+
[[Category:Networking]]
[[Category:Hardware Compatibility]]
+
[[Category:Featured]]

Revision as of 17:08, 24 January 2014

Contents

Introduction

IPv6 is an redesigned and improved version of the IPv4 protocol, and is intended to start replacing IPv4 in 2011 and beyond as the IPv4 global address space becomes exhausted. IPv6 includes a number of improvements over IPv4, including most notably 128-bit addressing, simplified protocol header, integrated IPSec and Multicast implementations, improved discovery, flexibility and router interaction, and improved facilities for auto-configuration. IPv6 also marks the end of Network Address Translation (NAT), which is not recommended or necessary with IPv6. While it's possible to use non-routable addresses with IPv6, this is not a requirement and it is possible for any IPv6 device to have its own globally routable IP address if desired.

Addressing

IPv6 addresses consist of 128 bits. The first 64 bits are used for the network and subnet portion of the address, while the remaining 64 bits are used for the host portion of the address. For more information on how to represent IPv6 addresses, please see the Presentation section of the IPv6 address page on Wikipedia.

Network Masks

IPv6 addresses also have an associated network mask, which is typically written as a trailing "/64" or "/48" at the end of the address, which specifies what bits of the address are used for network and subnet parts. For example, a "/48" mask specifies that addresses use a 48-bit network part, followed by a 16-bit subnet part (allowing for 2^16 subnets), followed by a 64-bit host part (allowing for up to 264 hosts for each of the 216 subnets to be specified.) In contrast, a "/64" mask specifies that addresses use a 64-bit network part, no subnet part, and a 64-bit host part (allowing up to 264 hosts total to be specified.) This means that if you are issued a "/64" set of addresses, you will not be able to define any subnets, but if you are issued a "/48" set of addresses, you will be able to define up to 216 subnets.

Address Space and Security

IPv6 also uses a global, flat address space. IPv6 is designed so that any device that needs to communicate on the Internet is able to have a unique globally-routable address. With IPv6, there is no need for using Network Address Translation (NAT). With IPv4, NAT is often used as a means of protecting systems from being accessed by malicious users. With IPv6, firewalls are typically used instead of NAT for restricting access to systems. With IPv6, it is normal for all machines on your home network to have "globally routable" addresses, the equivalent of a "public IP" in the world of IPv4. It is important to understand that this is the way that IPv6 is intended to be used for the majority of users, and that an IPv6-enabled router will no longer be performing NAT for you.

Using IPv6

There are several ways to use IPv6 with Funtoo Linux. Here are some possibilities:

  • Participating in an existing IPv6 network
  • Creating a local IPv6 over IPv4 tunnel
  • Enabling IPv6 on your router, possibly via a tunnel (several ISP uses 6rd...)
  • Unique Local IPv6 Unicast Addresses (site local)

Participating in IPv6 Network

The first approach is an option if your Funtoo Linux system happens to be on an IPv6 network, or you desire to set up an IPv6 network. In this case, the Funtoo Linux system simply needs to be configured to participate in this IPv6 network -- and can also participate in an IPv4 network simultaneously. If you will be configuring an IPv6-compatible router, then you will simply configure your Funtoo Linux system to participate in this network.

Local IPv6 over IPv4 Tunnel

Another approach for using IPv6 is to configure an IPv6 over IPv4 tunnel locally on your Funtoo Linux system, in cooperation with a tunnel provider. This will allow you to use an existing IPv4 network to connect a single Funtoo Linux system to IPv6. It is also possible to configure this system to serve as an IPv6 router.

Enabling IPv6 on Your Router

If you have a router that is capable of supporting IPv6, then it is possible to configure your router so that an IPv6 network is available, at which point you can simply configure your Funtoo Linux system to participate in it. Note that many popular home/office routers can be configured to use an IPv6 over IPv4 tunnel, which provides a convenient option for home networks or smaller organizations to participate in IPv6. Using this approach, your computer systems behind the router are simply configured to participate in an IPv6 network, and your router handles tunneling the IPv6 traffic back and forth between your tunnel provider. This is typically the most flexible option for exploring IPv6 as it allows you to have multiple computer systems in your home or office to participate in an IPv6 network while your router takes care of everything transparently.

Using Unique Local IPv6 Unicast Addresses

If you don't have public IPv6 connectivity or you don't wish to open an IPv6 tunnel over an IPv4 network, you can use a mechanism similar to IPv4 private addresses ranges. This mechanism consists of concatenating the prefix FC00::/7 with a globally unique identifier and a subnet identifier to form the upper 64 bits of the IPv6 address. Details of the mechanisms to forge a unique local IPv6 unicast address are documented in RFC 4193, however unique local IPv6 unicast addresses are made of the following components:

       | 7 bits |1|  40 bits   |  16 bits  |          64 bits           |
       +--------+-+------------+-----------+----------------------------+
       | Prefix |L| Global ID  | Subnet ID |        Interface ID        |
       +--------+-+------------+-----------+----------------------------+
  • Prefix (7 bits): always FC00::/7
  • L (1 bits): must be set to 1 (1 = prefix is locally assigned, 0 is undefined so far and must not be used)
  • Global ID: A random identifier (see RFC 4193 for details about the generation algorithm
  • Interface ID: Host interface ID as defined in RFC 3513
Note: Just like with private IPv4 addresses, an IPv6 router must not route a unique local IPv6 unicast address outside the organization local network.

Requirements

IPv6 requires CONFIG_IPV6 to be enabled in your kernel (either compiled in or as a module). If compiled as a module (e.g. if your kernel was compiled by genkernel), ensure the module is loaded.

# lsmod | grep ipv6

If this returns nothing, load the module with:

# modprobe ipv6

Commands

ping6
IPv6 ping command
route -6
show IPv6 routes
ip -6 neigh show
show all IPv6 neighbors on the local LAN

Configuration

Participating in an Existing IPv6 Network

If your local network already supports IPv6, then you can simply configure Funtoo Linux to participate in this IPv6 network. Here is a sample configuration that might be used to configure an ethernet interface (netif.eth0) to participate in both an IPv4 and IPv6 network:

template="interface"
ipaddr="10.0.1.200/24 2001:470:d:c2c:218:51ff:feea:ee21/64"
gateway="10.0.1.1"
nameservers="10.0.1.1 2001:470:20::2"
domain="funtoo.org"
multicast="yes"
routes="2000::/3 via fe80::daa2:5eff:fe7a:83de dev eth0"

Above, we use the interface template, and specify both an IPv4 and IPv6 address (with network mask) for ipaddr. In addition, an IPv4 and IPv6 nameserver is specified. For routing, we use the gateway command to specify an IPv4 gateway, while we use the routes command to specify a route to our router, which in this case has address fe80::daa2:5eff:fe7a:83de and is reachable on device eth0.

Note that we specify a route for "2000::/3" rather than "::/0" or "default", and this is a bit unusual. This is to work around a bug in many Linux kernels that prevents the default route from being handled properly. "2000::/3" maps to all routable IP addresses and has the benefit of being compatible with all Linux kernels.

Many Addresses and Stateless Autoconfiguration

Also note that if we did not specify an IPv6 address in the ipaddr variable, then eth0 would still get at least one IPv6 address anyway. First, it would get a link-local address, starting in fe80::/16, and it would also automatically use stateless autoconfiguration to grab an unused IPv6 address from the range used by your IPv6 router. This works similarly to the way a DHCP client works with IPv4, but is built-in to the IPv6 protocol and does not require a DHCP server to function. It works because with IPv6, routers send out ICMP packets to advertise themselves to systems on your network, and your Funtoo Linux system can use this information to automatically grab an unused address. It is important to understand this behavior because it means that by default, your Funtoo Linux system will grab a globally-routable ("public") IPv6 address from your router with no steps necessary on your part and thus may be accessible from the Internet if no firewall is in place. However, in most cases the default IPv6 route must be specified in the routes variable for IPv6 to function properly, so this auto-configuration isn't completely automatic at this time.

Local IPv6 over IPv4 Tunnelling

Tunnelling is the process of encapsulating IPv6 packets within an IPv4 packet so that it can be transmitted over an IPv4 network. This process happens at a local tunnel entry point, which can be a Linux machine or a router, such as an Apple AirPort. The packet then traverses the IPv4 network, until reaches the tunnel endpoint, which de-encapsulates the packet and places it on an IPv6 network. There are several different types of IPv6 tunnels. There are also several IPv6 tunnel providers that offer free tunnelling services, making it convenient to start using IPv6, even on your home network.

Note that if you want configure an IPv6 over IPv4 tunnel on your router, such as an Apple AirPort, then you will simply need to sign up with one of the tunnel providers and use their instructions to configure your router. At this point, your router will be IPv6 enabled and you can then configure your Funtoo Linux system to participate in an existing IPv6 network using the instructions in the previous section. If this is not an option for you, then it is also possible to set up the IPv6 over IPv4 tunnel directly on your Funtoo Linux system. This means that only your Funtoo Linux system will be able to participate in IPv6, at least to start (later, you could configure your Funtoo Linux system to route IPv6 for other machines on your network) Follow the instructions in this section to set up local tunneling on your Funtoo Linux system.

Tunnel providers

freenet6
Supports anonymous tunnels and works behind NAT. You can connect to with your login or as anonymous from anywhere. This can be configured under Funtoo Linux by emerging the net-misc/gogoc ebuild.
Hurricane Electric
Configured 6in4 tunnel, with support for dynamic IPv4 addresses, and Apple AirPorts can be configured to use this tunnel - see this link. Also see ipv6.he.net FAQ You can setup this tunnel with ifconfig and iproute2, or configure your router to be the tunnel entry point -- the point at which IPv6 traffic is encapsulated/de-encapsulated.
Teredo/Miredo
RFC4380 mandated transition mechanism. Works behind NAT. Assigns one "/128" per host.

Getting Started with gogoc

Freenet6 is a free IPv6 access service provided by gogo6 via the TSP tunnelling protocol. gogoc supports any TSP tunnel; perhaps one is provided by your ISP. We will focus on an anonymous tunnel via freenet6.

You need ipv6 to be enabled in your kernel as well as the TUN module.

You can quickly get started by emerging net-misc/gogoc, adding gogoc to your startup scripts and starting it. net-misc/gogoc is currently keyworded unstable (on some architectures, see gentoo bug #362549). If you are running stable Funtoo, you may want to put an entry into your package.keywords/package.accept_keywords file.

# emerge gogoc
# bzcat /usr/share/doc/gogoc-*/gogoc.conf.sample.bz2 >/etc/gogoc/gogoc.conf
# rc-update add gogoc default
# /etc/init.d/gogoc start

Note Note: By default, gogoc will use an anonymous tunnel. If you wish to authenticate yourself, read and edit /etc/gogoc/gogoc.conf.

Getting started with Teredo

While this mechanism is officially called Teredo, the implementation of the Teredo service we will be using is called Miredo. Note Note: net-misc/miredo is currently keyworded unstable. If you are running stable Funtoo, you may want to put an entry into your package.keywords/package.accept_keywords file.}}

Emerge net-misc/miredo and start it up (you can add it to your default runlevel if you wish):

# emerge net-misc/miredo
# /etc/init.d/miredo start

Note Note: Miredo requires CONFIG_TUN enabled in your kernel. If it is compiled as a module, ensure the tun module is loaded.

If all goes well, you can check the assignment of an IPv6 address using /sbin/ip, for example:

# /sbin/ip addr show dev teredo
4: teredo: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1280 qdisc pfifo_fast state UNKNOWN qlen 500
    link/none 
    inet6 2001:0:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx/32 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::ffff:ffff:ffff/64 scope link 
       valid_lft forever preferred_lft forever

Tunnelling 6to4

6to4 is an Internet transition mechanism for migrating from IPv4 to IPv6, a system that allows IPv6 packets to be transmitted over an IPv4 network (generally the IPv4 Internet) without the need to configure explicit tunnels. When using 6to4 your IPv6 golablly addressable IP is generated from you IPv4 IP address.

The anycast address of 192.88.99.1 has been allocated for the purpose of sending packets to a 6to4 relay router. Note that when converted to a 6to4 IPv6 address with the subnet and hosts fields set to zero this IPv4 address (192.88.99.1) becomes the IPv6 address 2002:c058:6301::.

To use the funtoo network template method, write the config file for the interface /etc/conf.d/netif.6to4 (which will also handle the converting of your IPv4 address to your IPv6 address). Make sure you change "WAN" to your correct internet facing interface.

template=ipv6-tunnel
WAN="eth0"
MTU="1280" 
ipv4=`ifconfig $WAN | sed -ne 's/[[:space:]]*inet addr:\([0-9.]*\).*/\1/p'`
ipv6=`printf "2002:%02x%02x:%02x%02x::1" \`echo $ipv4 | tr "." " "\``
remote=192.88.99.1
local="$ipv4/24"
ipaddr="$ipv6/48"
routes="2000::/3 via 2002:c058:6301:: dev $WAN"

Then create the netif.6to4 symlink and add it to the default runlevel

# ln -s /etc/init.d/netif.tmpl /etc/init.d/netif.6to4
# rc-update add netif.6to4 default
# /etc/init.d/netif.6to4 start

You should now be capable of connecting via IPv6:

# ping6 ipv6.google.com

To allow this host to be a router, a modified template is required:

#!/bin/sh

netif_pre_up() {
        require local remote
        try ip tunnel add $interface mode sit remote $remote local $local ttl 255
        try ip addr add $ipaddr dev $interface
        try ip addr add $ipaddr4 dev $interface
}

netif_post_up() {
        try ip route add ::/0 dev $interface
}

netif_pre_down() {
        ip route del ::/0 dev $interface
}

netif_post_down() {
        ip tunnel del $interface
}

Then add the following line to /etc/conf.d/netif.6to4:

ipaddr4="$ipv4/24"

After restarting the 6to4 interface radvd can be started:

# /etc/init.d/netif.6to4 restart
# /etc/init.d/radvd start

Optimization

Prefer IPv4 over IPv6

Generally if your IPv6 connection is through a tunnel, it will be slower than an IPv4 connection. For this reason, if you are using an IPv6 tunnel, it can be best to configure your systems to prefer IPv4 if an IPv4 version of the site is available, and use IPv6 only when necessary. This way, you will avoid unnecessary encapsulation and de-encapsulation of IPv4 traffic. Here's how to do this for a number of operating systems:

Linux

Linux will prefer IPv6 if IPv6 support is enabled in the kernel. To prefer IPv4, edit /etc/gai.conf and add this line:

precedence ::ffff:0:0/96 100

Windows 7, Server 2008, Vista

These operating systems prefer IPv6 by default. See this link. To prefer IPv4, use the following steps:

  1. Start regedit.
  2. Navigate to HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\TCPIP6\Parameters.
  3. Create a new DWORD named DisabledComponents. Edit this new DWORD and set it to HEX value of 20 or a DECIMAL value of 32.
  4. Restart your computer.

ISPs who currently have IPv6 enabled for residential customers

  • Canada:
    • Videotron: Videotron has a beta-program for residential customers who want to test IPv6 (no official technical support, it is possible they don't have enabled it in your area so check first before investing in new hardware). Although at date of writing, a large part of their networks are IPv6, you must go through a 6rd tunnel because they still need to upgrade some of their equipments and your router must support the 6rd protocol (this requirement is documented). Videotron sells you a D-Link DIR-825 with a modified firmware however this model has a weird gotcha: it does not support IPv6 firewalling. This is not a Videotron specific issue (even the genuine firmwares coming from the manufacturer has no support for IPv6 firewalling as of June 2011). A good alternative to recommend is the CISCO/LinkSYS E4200, more expensive (MSRP ~$180 US/CDN) but has IPv6 firewalling support. Once the E4200 firmware has been upgraded go in Setup/IPv6 Setup disable "IPv6 - Automatic" (you should then see an IPv6 address in the DUID field) and leave "automatic" for the 6rd configuration. You should be in business and see all of the hosts on your network with an IPv6 stack enabled being assigned a public IPv6 address starting with 2607:f048.
    • Teksavvy : TekSavvy has a IPv6 beta-program for residential customers who use their DSL service (no statement found for cable connections). Just ask them to enable IPv6 to your subscription and it should be available within the next 24 hours. Their IPv6 connectivity is native so you don't need to setup a tunnel.
    • Shaw (?)
    • Cogeco cable (?)
    • Telus (?)
    • Bell : Bell appears to have an official IPv6 support especially for its business subscribers (See http://ipv6.bell.ca) via a toolkit and various web pages on the subject.
  • France
    • Free
    • Nerim
    • the French Data Network (FDN)
  • United States:
    • Comcast (limited pilot in some areas only)

Home routers compatible with IPv6

A few residential routers have support for IPv6 at date of writing and many more home networking devices will have robust IPv6 support in a more or less near futures. The following does not pretend to be exhaustive:

  • D-Link DIR-825 rev. 1B (June 2011): Has IPv6 support out of the box, however for somewhat reason the router has no support for IPv6 firewalling even with teh 2.05N revision of the firmware. Consequence for you is you have to deploy an IPv6 firewall on each of hosts concerned with a public IPv6 connectivity. The canadian ISP Videotron is selling a DIR-825 with a customized firmware as unfortunately, like with the genuine manufacturer firmware, no IPv6 firewalling possible :( .
  • CISCO/LinkSys E4200 (June 2011): Advertised as being IPv6 compatible with a firmware update (available as of June 14th 2011 -> check for the version tagged 1.0.02 build 13 or later on the manufacturer website). The device supports native IPv6 and IPv6 through a 6rd tunnel (no support for any other tunneling protocol).

Resources

with Apple airport extreme, etc:

Nice Overview over IPv6