IPv6 (tutorial)

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:54, 27 October 2006 (edit)
Bjb (Talk | contribs)
(ping6 at dd-wrt v23)
← Previous diff
Revision as of 05:08, 31 October 2006 (edit) (undo)
Whiteboy (Talk | contribs)

Next diff →
Line 1: Line 1:
-__toc__+Internet Protocol version 6 (IPv6) is a network layer IP standard used by electronic devices to exchange data across a packet-switched internetwork. It follows IPv4 as the second version of the Internet Protocol to be formally adopted for general use.
-=Introduction=+There are too many devices in the world for 32-bit (2<sup>32</sup>, or 4,294,967,296) IP addresses to be sufficient.<br> The next version of the TCP/IP protocol, IPv6 offers 128-bit address space, or 2<sup>128</sup> (&asymp; 3.4 x 10<sup>38</sup>) IP addresses; this is approximately 5×1028 addresses for each of the roughly 6.5 billion people alive today, or about 57 billion addresses for each gram of matter in the Earth.
-There are too many devices in the world for 32-bit (2<sup>32</sup>, or 4,294,967,296) IP addresses to be sufficient.<br> The next version of the TCP/IP protocol, IPv6 offers 128-bit address space, or 2<sup>128</sup> (&asymp; 3.4 x 10<sup>38</sup>) IP addresses.+
-IPv6 is supported since DD-WRTv22 prefinal5.+IPv6 has been supported since v22 prefinal5.
=Prerequisites= =Prerequisites=
Line 14: Line 13:
=Setup= =Setup=
- +==Overview==
-==Automatic 6to4 Tunneling==+
- +
-===Overview===+
[http://en.wikipedia.org/wiki/6to4 6to4] is a mechanism which assigns a large block of IPv6 addresses to every IPv4 address on the Internet. You can use 6to4 with DD-WRT to give every computer on your network a globally-accessible IPv6 address without the need to configure explicit tunneling. [http://en.wikipedia.org/wiki/6to4 6to4] is a mechanism which assigns a large block of IPv6 addresses to every IPv4 address on the Internet. You can use 6to4 with DD-WRT to give every computer on your network a globally-accessible IPv6 address without the need to configure explicit tunneling.
Line 26: Line 22:
When using DD-WRT standard on a router with 4MB Flash, there is no space available for jffs. I've written this guide to rely only on nvram variables, so that '''jffs is not needed'''. When using DD-WRT standard on a router with 4MB Flash, there is no space available for jffs. I've written this guide to rely only on nvram variables, so that '''jffs is not needed'''.
-===Enabling IPv6 Support===+==Enabling IPv6 Support==
On the '''Administration>Management''' page, enable '''IPv6''' and '''radvd'''. On the '''Administration>Management''' page, enable '''IPv6''' and '''radvd'''.
-===Configuring Radvd===+==Configuring Radvd==
Radvd is similar to a DHCP server. It advertises your IPv6 prefix to the local network, so that a new client can generate its own IP address. This config tells radvd to get a 6to4 prefix from the WAN side (vlan1) and announce it to the LAN (br0) Radvd is similar to a DHCP server. It advertises your IPv6 prefix to the local network, so that a new client can generate its own IP address. This config tells radvd to get a 6to4 prefix from the WAN side (vlan1) and announce it to the LAN (br0)
Line 48: Line 44:
}; };
-===Startup Script===+==Startup Script==
This startup script acquires your current IPv4 address and uses it to calculate a 6to4 IPv6 address. It then creates the tunnel interface, configures a route, and assigns the address. Afterwards, it sends radvd a SIGHUP so that it will become aware that the prefix has changed. This startup script acquires your current IPv4 address and uses it to calculate a 6to4 IPv6 address. It then creates the tunnel interface, configures a route, and assigns the address. Afterwards, it sends radvd a SIGHUP so that it will become aware that the prefix has changed.
Line 80: Line 76:
kill -HUP $(cat /var/run/radvd.pid) kill -HUP $(cat /var/run/radvd.pid)
-===Performance Concerns===+==Performance Concerns==
When you send a packet from a 6to4 address to a native IPv6 address, it has to pass through a 6to4 gateway. [http://rfc.net/rfc3068.html RFC3068] established the special anycast address '''192.88.99.1''' which is supposed to lead you to the nearest gateway. However, some ISPs don't handle this properly, so you may find that all of your packets are crossing an ocean or two. When you send a packet from a 6to4 address to a native IPv6 address, it has to pass through a 6to4 gateway. [http://rfc.net/rfc3068.html RFC3068] established the special anycast address '''192.88.99.1''' which is supposed to lead you to the nearest gateway. However, some ISPs don't handle this properly, so you may find that all of your packets are crossing an ocean or two.
Line 87: Line 83:
Or you could bug your ISP about it, but they'll probably be like "IPvWHAT?" Or you could bug your ISP about it, but they'll probably be like "IPvWHAT?"
-==SixXS Tunnel Broker==+=SixXS Tunnel Broker=
-===Requesting a Tunnel/Subnet===+==Requesting a Tunnel/Subnet==
1. Create a 6bone handle at http://www.sixxs.net/signup/6bone/. (Skip this if you already have a NIC handle.)<br> 1. Create a 6bone handle at http://www.sixxs.net/signup/6bone/. (Skip this if you already have a NIC handle.)<br>
2. Sign up at http://www.sixxs.net/signup/ with your create handle. (Or use your existing one.)<br> 2. Sign up at http://www.sixxs.net/signup/ with your create handle. (Or use your existing one.)<br>
3. After your login at http://www.sixxs.net/home/ you can request a tunnel and later a subnet. 3. After your login at http://www.sixxs.net/home/ you can request a tunnel and later a subnet.
-===Static Tunnel===+==Static Tunnel==
The [http://sconk.se/dd-wrt_ipv6_guide/ sconk.se guide] offers some pretty nice instructions on how enable this feature starting out with obtaining an IPv6 address.<br> The [http://sconk.se/dd-wrt_ipv6_guide/ sconk.se guide] offers some pretty nice instructions on how enable this feature starting out with obtaining an IPv6 address.<br>
Line 102: Line 98:
-- Is it possible to copy'n'paste this guide into this wiki? -- -- Is it possible to copy'n'paste this guide into this wiki? --
-===Dynamic Tunnel===+==Dynamic Tunnel==
-====Install AICCU====+===Install AICCU===
1. Install AICCU using ipkg. 1. Install AICCU using ipkg.
# ipkg update # ipkg update
Line 132: Line 128:
# Automatic? # Automatic?
automatic true automatic true
-====Automatic start your Tunnel====+===Automatic start your Tunnel===
1. Create a .startup file and make it executable. 1. Create a .startup file and make it executable.
# vi /jffs/etc/config/aiccu.startup # vi /jffs/etc/config/aiccu.startup
Line 169: Line 165:
;; ;;
esac esac
-====Announce your Subnet with radvd====+ 
 +===Announce your Subnet with radvd===
1. Enable radvd at the webinterface of your router (Administration->Management->IPv6 Support)<br> 1. Enable radvd at the webinterface of your router (Administration->Management->IPv6 Support)<br>
2. Insert your radvd.conf into the form and save your settings.(You have use the /64 prefix even if you got a /48 subnet)<br> 2. Insert your radvd.conf into the form and save your settings.(You have use the /64 prefix even if you got a /48 subnet)<br>
Line 186: Line 183:
==Hurricane Electric's Tunnel Broker== ==Hurricane Electric's Tunnel Broker==
If you want to use Hurricane Electric's IPv6 Tunnel broker you can check out [http://solosoft.org:81/projects/ipv6/ this guide]. It has detailed instructions and is upto date. Sixx.net takes alot of work and requires you to sign up to alot more stuff then Hurricane Electric. This guide also requires no extra software and is great for people with limited memory on there router. (If someone wishes to paste the guide on this page they may) If you want to use Hurricane Electric's IPv6 Tunnel broker you can check out [http://solosoft.org:81/projects/ipv6/ this guide]. It has detailed instructions and is upto date. Sixx.net takes alot of work and requires you to sign up to alot more stuff then Hurricane Electric. This guide also requires no extra software and is great for people with limited memory on there router. (If someone wishes to paste the guide on this page they may)
- 
-==xs26.net tunnel broker== 
- 
-To be done ... But, it should be close to Hurricane Electric's configuration. 
=Notes= =Notes=
Line 224: Line 217:
*[http://prasys.spymac.com/page12/page12.html Setting up ipv6 using MyBSD/MANISV6 on DD-WRT v23] *[http://prasys.spymac.com/page12/page12.html Setting up ipv6 using MyBSD/MANISV6 on DD-WRT v23]
 +[[Category:English documentation]]
[[Category:advanced HOWTO]] [[Category:advanced HOWTO]]
- 
-[[Category:English documentation]] 

Revision as of 05:08, 31 October 2006

Internet Protocol version 6 (IPv6) is a network layer IP standard used by electronic devices to exchange data across a packet-switched internetwork. It follows IPv4 as the second version of the Internet Protocol to be formally adopted for general use.

There are too many devices in the world for 32-bit (232, or 4,294,967,296) IP addresses to be sufficient.
The next version of the TCP/IP protocol, IPv6 offers 128-bit address space, or 2128 (≈ 3.4 x 1038) IP addresses; this is approximately 5×1028 addresses for each of the roughly 6.5 billion people alive today, or about 57 billion addresses for each gram of matter in the Earth.

IPv6 has been supported since v22 prefinal5.

Contents

Prerequisites

- Knowledge about the Command Line
- Knowledge about the ip command
- 24/7 Internet Connection (dynamic dialup is ok)
- Enabled jffs would be helpful
- Enable IPv6 at your routers webinterface

Setup

Overview

6to4 is a mechanism which assigns a large block of IPv6 addresses to every IPv4 address on the Internet. You can use 6to4 with DD-WRT to give every computer on your network a globally-accessible IPv6 address without the need to configure explicit tunneling.

In order to use 6to4 tunneling, you need the Standard or VoIP version of DD-WRT, as these are currently the only ones which support both IPv6 and radvd.

This is targeted toward users with a basic DHCP connection. PPPoE will require replacing vlan1 with ppp0 in each instance. Other connection types will vary.

When using DD-WRT standard on a router with 4MB Flash, there is no space available for jffs. I've written this guide to rely only on nvram variables, so that jffs is not needed.

Enabling IPv6 Support

On the Administration>Management page, enable IPv6 and radvd.

Configuring Radvd

Radvd is similar to a DHCP server. It advertises your IPv6 prefix to the local network, so that a new client can generate its own IP address. This config tells radvd to get a 6to4 prefix from the WAN side (vlan1) and announce it to the LAN (br0)

Copy the following into your radvd settings box:

interface br0 {
   MinRtrAdvInterval 3;
   MaxRtrAdvInterval 10;
   AdvLinkMTU 1280;
   AdvSendAdvert on;
   prefix 0:0:0:1::/64 {
    AdvOnLink on;
    AdvAutonomous on;
    AdvValidLifetime 86400;
    AdvPreferredLifetime 86400;
    Base6to4Interface vlan1;
   };
};

Startup Script

This startup script acquires your current IPv4 address and uses it to calculate a 6to4 IPv6 address. It then creates the tunnel interface, configures a route, and assigns the address. Afterwards, it sends radvd a SIGHUP so that it will become aware that the prefix has changed.

Go to Administration>Diagnostics, copy the following into the big box, and hit "Save Startup".

sleep 5
WANIP=$(ip -4 addr show dev vlan1 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
if [ -n "$WANIP" ]
then
 V6PREFIX=$(printf '2002:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' '))
 ip tunnel add tun6to4 mode sit ttl 255 remote any local $WANIP
 ip link set tun6to4 mtu 1280
 ip link set tun6to4 up
 ip addr add $V6PREFIX:0::1/16 dev tun6to4
 ip addr add $V6PREFIX:1::1/64 dev br0
 ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4
 kill -HUP $(cat /var/run/radvd.pid)
fi

On v23, an alternate solution is to telnet the box and then copy the following :

export WANIP=$(ip -4 addr show dev vlan1 | grep 'inet ' | awk '{print $2}' | cut -d/ -f1)
export V6PREFIX=$(printf '2002:%02x%02x:%02x%02x' $(echo $WANIP | tr . ' '))
ip tunnel add tun6to4 mode sit ttl 255 remote any local $WANIP
ip link set tun6to4 mtu 1280
ip link set tun6to4 up
ip addr add $V6PREFIX:0::1/16 dev tun6to4
ip addr add $V6PREFIX:1::1/64 dev br0
ip -6 route add ::/96 dev tun6to4
ip -6 route add 2000::/3 via ::192.88.99.1 dev tun6to4
kill -HUP $(cat /var/run/radvd.pid)

Performance Concerns

When you send a packet from a 6to4 address to a native IPv6 address, it has to pass through a 6to4 gateway. RFC3068 established the special anycast address 192.88.99.1 which is supposed to lead you to the nearest gateway. However, some ISPs don't handle this properly, so you may find that all of your packets are crossing an ocean or two.

If this affects you, then you may need to do some detective work to locate a closer gateway. One possible approach is to use IPv4 Looking Glass tools to traceroute to 192.88.99.1 from various locations on the Internet and see where you end up.

Or you could bug your ISP about it, but they'll probably be like "IPvWHAT?"

SixXS Tunnel Broker

Requesting a Tunnel/Subnet

1. Create a 6bone handle at http://www.sixxs.net/signup/6bone/. (Skip this if you already have a NIC handle.)
2. Sign up at http://www.sixxs.net/signup/ with your create handle. (Or use your existing one.)
3. After your login at http://www.sixxs.net/home/ you can request a tunnel and later a subnet.

Static Tunnel

The sconk.se guide offers some pretty nice instructions on how enable this feature starting out with obtaining an IPv6 address.

There are instructions at Remoteroot.net with example scripts.

This wiki also offers an example IPv6 startup script

-- Is it possible to copy'n'paste this guide into this wiki? --

Dynamic Tunnel

Install AICCU

1. Install AICCU using ipkg.

 # ipkg update
 # ipkg install aiccu

2. Configure AICCU.

 # vi /jffs/etc/aiccu.conf
 # AICCU Configuration
 
 # Login information
 username <your nichandle/username>
 password <your password>
 
 # Interface names to use
 ipv4_interface vlan1
 ipv6_interface sixxs
 
 # The tunnel_id to use
 # (only required when there are multiple tunnels in the list)
 tunnel_id <your tunnel id>
 
 # Be verbose?
 verbose false
 
 # Daemonize?
 daemonize true
 
 # Automatic?
 automatic true

Automatic start your Tunnel

1. Create a .startup file and make it executable.

 # vi /jffs/etc/config/aiccu.startup
 #!/bin/sh
 
 /jffs/etc/init.d/S51aiccu start
 ip -6 addr add 2001:xxxx:xxx::/64 dev br0 # Edit to your assigned subnet settings. (You have to use /64 here)
 # chmod +x /jffs/etc/config/aiccu.startup

2. Adjust the AICCU init script.

 # vi /jffs/etc/init.d/S51aiccu
 #!/bin/sh
 
 case "$1" in
     start)
         ( while [ `date +%Y` -eq 1970 ]; do
             sleep 1
             done && /jffs/usr/sbin/aiccu start /jffs/etc/aiccu.conf ) &
         ;;
 
     stop)
         aiccu stop /jffs/etc/aiccu.conf
         aiccu stop /jffs/etc/aiccu.conf
         ;;
 
     restart)
         $0 stop
         $0 start
         ;;
     *)
         echo "Usage: $0 {start|stop|restart}"
         exit 1
         ;;
 esac

Announce your Subnet with radvd

1. Enable radvd at the webinterface of your router (Administration->Management->IPv6 Support)
2. Insert your radvd.conf into the form and save your settings.(You have use the /64 prefix even if you got a /48 subnet)

interface br0
{
AdvSendAdvert on;
prefix 2001:xxxx:xxxx::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
};

Hurricane Electric's Tunnel Broker

If you want to use Hurricane Electric's IPv6 Tunnel broker you can check out this guide. It has detailed instructions and is upto date. Sixx.net takes alot of work and requires you to sign up to alot more stuff then Hurricane Electric. This guide also requires no extra software and is great for people with limited memory on there router. (If someone wishes to paste the guide on this page they may)

Notes

Static IPv6 at WinXP

If you want to disable temporary IPv6 addresses at your WinXP try:

 cmd> ipv6 -p gpu UseTemporaryAddresses no

ping6 at dd-wrt v23

Try to install busybox from OpenWRT: http://downloads.openwrt.org/people/nico/testing/mipsel/packages/busybox_1.01-1_mipsel.content

 ~ # ipkg install http://downloads.openwrt.org/people/nico/testing/mipsel/packages/busybox_1.01-1_mipsel.ipk

The previous link is dead (404 not found), please correct the page if you know any alternative link.

Okay now you have to install uclibc (with -force-depends): http://downloads.openwrt.org/people/nico/testing/mipsel/packages/uclibc_0.9.27-6_mipsel.content

 ~ # ipkg -force-depends install http://downloads.openwrt.org/people/nico/testing/mipsel/packages/uclibc_0.9.27-6_mipsel.ipk

After installing these packages you have to change the priority of the /lib path in your shell environment:

 ~ # export LD_LIBRARY_PATH=/usr/lib:/jffs/lib:/jffs/usr/lib:/jffs/usr/local/lib:/lib

For the last step you have to change the ping6 symlink:

 ~ # rm /jffs/bin/ping6
 ~ # cd /jffs/bin
 ~ # ln -s /jffs/bin/busybox ping6

Now ping6 should work for the current xterm session.

External Links