Subject: Setting up IPv6 on your Linksys WRT54G/WRT54GS Routers
To: Vancouver Unix User Group <Vanlug@gweep.ca>
From: Bruno Saverio Delbono <bruno.s.delbono@mail.ac>
List: current-users
Date: 01/15/2005 12:29:11
Hi,

Looks like there is not much information on the net on setting IPv6 on 
your linksys router. I have struggled for about 5 hours since yesterday 
on figuring this out and I think I should contribute to the community. 
I'll probably write this up on my web page 
(http://www.mail.ac/users/bruno/) once I get sometime.

Note: This requires you to flash your firmware to an unofficial firmware 
which voids your warranty. You're on your own. But don't worry, if you 
flash your router properly, everything should go ok.

What's needed:

Firmware - You must have the sveasoft firmware installed on your router. 
  I'm currently using WRT54G_Wolf_W42_Alchemy_6rc1 which can be found at 
http://wrt54g.thermoman.de/ or here's the ed2k link: 
http://tinyurl.com/5vxkh

[ Note: You can also run the openwrt firmware. I'm running sveasoft and 
which is why I'll focus on setting up IPv6 with this firmware. There 
already are other howtos for openwrt ]

There are a few firmware's listed there and I chose the latest one with 
IPv6 enabled.

If you're interested to read up on the GPL licensing issues and 
sveasoft, please read the website above or visit it's forums.

IPv6 Tunnel Broker - Goto http://tunnelbroker.net/ and set yourself an 
account + a /64 allocation. You can also visit www.hs247.com for reading 
up more on IPv6. Once setup, your tunnel should be activated within 24 
hours (Hint - If you give the right information at registration, it 
takes even less time).

Background on ports on the linksys router:

 From the point view of CPU or OS:

    1. the wireless interface acts as eth1
    2. the VLAN0 acts as eth0.
    3. bridge br0 slaves eth0 and eth1

 From the point view of Switch Controller:

    1. 4 LAN ports and the Internal port form VLAN0
    2. WAN port form and the Internal port form VLAN1
    3. VLAN0 and VLAN1 share the Internal interface

Therefor, the IPv6 tunnel to your tunnel broker should be setup for 
vlan1 and your radvd should advertise on br0 for your local network.

Setup:

Install the firmware. Once installed, your router should be reset and 
setup again. While you're here, you can also change your Xmit Power to 
something like 54 - 61 (safe) to 82 (high, but safe enough). This should 
give you a considerable boost in signal. The through the Administration 
page, open either the telnet or the ssh port for the router. This should 
allow you to telnet/ssh into your router respectively.

lucifer:~$ telnet 192.168.2.1
Trying 192.168.2.1...
Connected to 192.168.2.1.
Escape character is '^]'.

VPN login: root
Password:
------------------------------------------

Welcome to the Sveasoft WRT54G/GS Firmware

   Alchemy-6.0-RC1.w42 contributor build
           version v2.04.4.8sv

USE OF THIS FIRMWARE IS AT YOUR OWN RISK

      http://www.sveasoft.com

------------------------------------------


BusyBox v1.00-rc3 (2004.09.17-13:23+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # uname -a
Linux VPN 2.4.20 #56 Sun Nov 7 05:34:08 EST 2004 mips unknown


Now enable IPv6 and radvd:

~# nvram set ipv6_enable=1
~# nvram set radvd_enable=1
~# nvram set radvd_conf=/tmp/radvd.conf

Now commit your changes and reboot

~# nvram commit
nvram_commit(): start
nvram_commit(): end


Once rebooted, you should have the sit0 interface in your ifconfig and 
ipv6 loaded in lsmod:

br0       Link encap:Ethernet  HWaddr 00:0F:66:44:22:26
           inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0      Link encap:Ethernet  HWaddr 00:0F:66:44:22:26
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:100
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
           Interrupt:5 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0F:66:44:22:28
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:100
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
           Interrupt:4 Base address:0x1000

imq0      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           NOARP  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:30
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

imq1      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           NOARP  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:30
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           UP LOOPBACK RUNNING MULTICAST  MTU:16436  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sit0      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           UP RUNNING MULTICAST  MTU:1480  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

sixbone   Link encap:UNSPEC  HWaddr 
18-55-BF-E1-00-00-00-00-00-00-00-00-00-00-00-00
           UP POINTOPOINT RUNNING MULTICAST  MTU:1480  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

teql0     Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
           NOARP  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:100
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vlan0     Link encap:Ethernet  HWaddr 00:0F:66:44:22:26
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

vlan1     Link encap:Ethernet  HWaddr 00:0F:66:44:22:27
           inet addr:24.85.191.225  Bcast:24.85.191.255  Mask:255.255.252.0
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)


~ # lsmod
Module                  Size  Used by    Tainted: P
ip_nat_proto_gre        1920   0 (unused)
ip_nat_pptp             2620   0 (unused)
ip_conntrack_pptp       3420   1
ip_conntrack_proto_gre    2712   0 [ip_nat_pptp ip_conntrack_pptp]
ipv6                  181648  -1
adm6996                30304   0 (unused)
wl                    401592   0 (unused)
et                     22336   0 (unused)


Now to setting it all up:

- Using the example configs option in the tunnelbroker site, choose 
Linux-route2 and click show config. This should give you an ouput 
something like this:

modprobe ipv6
ip tunnel add sixbone mode sit remote 64.71.128.82 local 24.85.191.225 
ttl 255
ip link set sixbone up
ip addr add 2001:470:1F00:FFFF::45B/127 dev sixbone
ip route add ::/0 dev sixbone
ip -f inet6 addr


IGNORE the first and the last line and create a simple file such as 
(PLEASE note the changes needed for your local IP):

---------------------cut-here--------------------------------
# File to setup Linksys WRT54GS router with ipv6
# by Bruno Saverio Delbono <bruno.s.delbono@mail.ac>
# Adapted from Martin Hicks mort at bork.org's script
# made specifically for openwrt
# License - BSD.
#!/bin/sh

echo "1" > /proc/sys/net/ipv6/conf/all/forwarding

extif=vlan1
intif=br0
tundev=sixbone

# This doesn't work the busytools implementation of
# sveasoft firmware. So please ignore.
#ipv4=`ifconfig $extif | grep inet | grep -v inet6 | \
#       awk '{print $2}' | sed -e 's/addr://g'`
#ipv6=`printf "%02x%02x:%02x%02x" \`echo $ipv4 | tr . ' '\``

echo "bringing up sixbone tunnel"

# NOTE, NOTE, NOTE: PLEASE CHANGE YOUR IP to local <YOUR IP>
ip tunnel add sixbone mode sit remote 64.71.128.82 local 24.85.191.225 
ttl 255
ip link set sixbone up
ip addr add 2001:470:1F00:FFFF::45B/127 dev sixbone
ip route add ::/0 dev sixbone
ip route add default dev sixbone

echo ip -6 route add 2001:470:1F00:657::/64 dev $intif
ip -6 route add 2001:470:1F00:657::/64 dev $intif
echo ip -6 addr add 2001:470:1F00:657::1 dev $intif
ip -6 addr add 2001:470:1F00:657::1 dev $intif

echo "bringing up router advertisment daemon"
/sbin/radvd -C /tmp/radvd.conf
---------------------cut-here--------------------------------

Also create a a file radvd_conf such as:

# conffile is from radvd package found on:
# http://openwrt.org/ipkg/
# For more examples, see the radvd documentation.

interface br0
{
         AdvSendAdvert on;

         #
         # These settings cause advertisements to be sent every 3-10 
seconds.  This
         # range is good for 6to4 with a dynamic IPv4 address, but can 
be greatly
         # increased when not using 6to4 prefixes.
         #

         MinRtrAdvInterval 3;
         MaxRtrAdvInterval 10;

         #
         # Disable Mobile IPv6 support
         #
         AdvHomeAgentFlag off;

         #
         # example of a standard prefix
         #
         prefix 2001:470:1F00:657::/64
         {
                 AdvOnLink on;
                 AdvAutonomous on;
                 AdvRouterAddr on;
         };

};

~# cp radvd_conf > /tmp/radvd.conf

Run the script above "AFTER" you've modified the settings to include 
your IP. Once done you can issue a command such as:

1: lo: <LOOPBACK,MULTICAST,UP> mtu 16436 qdisc noqueue
     link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
     inet 127.0.0.1/8 brd 127.255.255.255 scope host lo
     inet6 ::1/128 scope host
2: teql0: <NOARP> mtu 1500 qdisc noop qlen 100
     link/void
3: imq0: <NOARP> mtu 1500 qdisc noop qlen 30
     link/void
4: imq1: <NOARP> mtu 1500 qdisc noop qlen 30
     link/void
5: eth0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 100
     link/ether 00:0f:66:44:22:26 brd ff:ff:ff:ff:ff:ff
     inet6 fe80::20f:66ff:fe44:2226/10 scope link
6: eth1: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc pfifo_fast qlen 100
     link/ether 00:0f:66:44:22:28 brd ff:ff:ff:ff:ff:ff
     inet6 fe80::20f:66ff:fe44:2228/10 scope link
7: vlan0: <BROADCAST,MULTICAST,PROMISC,UP> mtu 1500 qdisc noqueue
     link/ether 00:0f:66:44:22:26 brd ff:ff:ff:ff:ff:ff
     inet6 fe80::20f:66ff:fe44:2226/10 scope link
8: vlan1: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
     link/ether 00:0f:66:44:22:27 brd ff:ff:ff:ff:ff:ff
     inet 24.85.191.225/22 brd 24.85.191.255 scope global vlan1
     inet6 fe80::20f:66ff:fe44:2227/10 scope link
9: sit0@NONE: <MULTICAST,UP> mtu 1480 qdisc noqueue
     link/sit 0.0.0.0 brd 0.0.0.0
15: br0: <BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
     link/ether 00:0f:66:44:22:26 brd ff:ff:ff:ff:ff:ff
     inet 192.168.2.1/24 brd 192.168.2.255 scope global br0
     inet6 fe80::200:ff:fe00:0/10 scope link
     inet6 2001:470:1f00:657::1/128 scope global
16: sixbone@NONE: <POINTOPOINT,MULTICAST,UP> mtu 1480 qdisc noqueue
     link/sit 24.85.191.225 peer 64.71.128.82
     inet6 fe80::1855:bfe1/128 scope link
     inet6 2001:470:1f00:ffff::45b/127 scope global

which should show that your IPv6 is all setup. Also check to make sure 
that radvd is running:

~ # ps -ef | grep rad
17178 root        352 S   radvd -C /tmp/radvd.conf

That's it folks. Setup your local clients to include IPv6 support. In 
windows XP/2003 this means going to your network neighbourhood icon, 
selecting properties, choosing your link and adding Protocol -> 
Microsoft IPv6 and hitting ok. Once done, you should simply check to see 
if you have ipv6 running by starting the command prompt and running ipv6 
if. This should give you an output such as:

Interface 10: Ethernet: InBuilt-Wifi
   Guid {AC2D697B-3753-42C4-BC0F-F2954DD7BB26}
   uses Neighbor Discovery
   uses Router Discovery
   link-layer address: 00-0e-9b-55-00-e4
     preferred global 2001:470:1f00:657:49a5:42db:7bb3:344e, life 
6d23h27m8s/23h2
3m28s (temporary)
     preferred global 2001:470:1f00:657:20e:9bff:fe55:e4, life 
29d23h59m58s/6d23h
59m58s (public)
     preferred link-local fe80::20e:9bff:fe55:e4, life infinite
     multicast interface-local ff01::1, 1 refs, not reportable
     multicast link-local ff02::1, 1 refs, not reportable
     multicast link-local ff02::1:ff55:e4, 2 refs, last reporter
     multicast link-local ff02::1:ffb3:344e, 1 refs, last reporter
   link MTU 1500 (true link MTU 1500)
   current hop limit 64
   reachable time 41000ms (base 30000ms)
   retransmission interval 1000ms
   DAD transmits 1
   default site prefix length 48

Let's ping some IPv6 enabled host to see if it's all working:

C:\>ping6 ftp.netbsd.org

Pinging ftp.netbsd.org [2001:4f8:4:7:2e0:81ff:fe21:6563]
from 2001:470:1f00:657:49a5:42db:7bb3:344e with 32 bytes of data:

Reply from 2001:4f8:4:7:2e0:81ff:fe21:6563: bytes=32 time=63ms
Reply from 2001:4f8:4:7:2e0:81ff:fe21:6563: bytes=32 time=59ms
Reply from 2001:4f8:4:7:2e0:81ff:fe21:6563: bytes=32 time=63ms
Reply from 2001:4f8:4:7:2e0:81ff:fe21:6563: bytes=32 time=85ms

Ping statistics for 2001:4f8:4:7:2e0:81ff:fe21:6563:
     Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
     Minimum = 59ms, Maximum = 85ms, Average = 67ms


To setup IPv6 in solaris:

touch /etc/hostname6.hme0 (or your NIC interface) and reboot. 
Alternatively you can also setup IPv6 by running sys-unconfig. Solaris 
should just work easily.

On Linux:

modprobe ipv6 and nic should just the ipv6 address from the router 
advertising daemon.

On BSD:

Aw..come on, do I have to explain to all this :)..If you're running 
*BSD, you should simply check the excellent man pages :P


I hope I've explained on how all of this works and setup. If you have 
any problems, re-read this and check google to see if your question has 
  been answered. Alternatively, if you're going to bug me..please 
understand that I may or may not respond back in time.

Have fun.

--
Bruno Delbono
Systems Engineer - Open-Systems Group
http://www.mail.ac/ http://www.open-systems.org
Personal Homepage: http://www.mail.ac/users/bruno/