A couple of days ago, I got a new internet service provider, which provided a router capable of routing OR bridging, which means I can get a public IP address for my OpenWrt router. So, of course I had to set up my OpenWrt router as an IPv6 router, with an IPv6 tunnel so I could get to use all those cool IPv6 services out there on the big internet.

This was easier than I thought it would be, so I documented it all for everybody else to use. Enjoy.

Note: I am using a router running OpenWrt 10.03 (backfire), and I have a /64 subnet, provided by Hurricane Electric. This howto will reflect that.
First, log in to your router using SSH or TELNET and install some programs:

opkg install kmod-ipv6 radvd ip kmod-sit kmod-ip6tables ip6tables

Now we need to set up a IPv6 tunnel. First go to Hurricane Electrics tunnel settings site. Open the file /etc/init.d/he_ipv6 and fill in the necessary fields below:

#!/bin/sh /etc/rc.common
START=45

SERVER_v4=Server IPv4 address
SERVER_v6=Server IPv6 address
CLIENT_v4=Client IPv4 address
CLIENT_v6=Client IPv6 address
ROUTED_64=Routed /64:

start() {
        ip tunnel add henet mode sit remote $SERVER_v4 local $CLIENT_v4 ttl 255
        ip link set henet up
        ip -6 addr add $CLIENT_v6/64 dev henet
        ip -6 ro add default via $SERVER_v6 dev henet

        ip -6 addr add $ROUTED_64/64 dev br-lan
}
stop() {
        ip link set henet down
        ip tunnel del henet
        ip -6 addr delete $ROUTED_64/64 dev br-lan
}
restart() {
        stop
        start
}

Don’t forget to make it executable:

chmod +x /etc/init.d/he_ipv6

Now we should try testing the script. Run it, and then try pinging bredsaal.dk and an IPv6 address:

/etc/init.d/he_ipv6 start
ping6 -c4 bredsaal.dk
ping6 -c4 2607:f2f8:6500::2

Actually, if everything works, you don’t need to ping the IPv6 address, but if you can ping that address and not bredsaal.dk, the DNS you are using cannot resolve IPv6 addresses.

Alright, if everything worked, go on! If not, check that the script is correctly configured and try again.

Okay, make the script run on boot:

/etc/init.d/he_ipv6 enable

You should be all set. Now we only need to configure radvd – the Router Advertising Daemon!

Open the file /etc/config/radvdin your favourite editor, and make it look like this, of course with your own subnet.

config interface
option interface 'lan'
option AdvSendAdvert 1
option AdvManagedFlag 0
option AdvOtherConfigFlag 0
option ignore 0

config prefix
option interface 'lan'
option prefix '2001:0470:b00b:babe::/64' # or whatever your /64 is
option AdvOnLink 1
option AdvAutonomous 1
option AdvRouterAddr 1
option ignore 0

config rdnss
option interface 'lan'
option addr ''
option ignore 1

Restart radvd:

/etc/init.d/radvd restart

Your computer should now get an IPv6 address, and you should be able to connect to the outside world from your computer, using IPv6. Remember, that the outside world can also connect to your computer over IPv6 now, so go set up that IPv6 firewall.

Did it work for you? Do you have any questions, comments or anything else? Write a comment below. :-)

Related posts:

4 Comments on IPv6 home networking with OpenWrt

  1. cDR says:

    Thanks for this great howto, got it running in 5 minutes.

  2. daniel says:

    My ubuntu NO get an IPv6 address and WINDOWS get! WHY? any problem with that?

  3. Hi Daniel.

    I think you have to enable IPv6 networking in network settings. :-)

COMMENT POLICY

There is some simple rules you have to follow, if you want to comment on this page:

  • Write comments in the language of the post. I write in both Danish and English, and when I write in English I would appreciate comments in English only.
  • Either use your real name or make use of KeywordLuv AND still use your real name.
  • No comments less than 20 words (unless it's a REALLY good comment).
  • No comments will be approved without a real name. Don't use keywords for your name!
If these rules are not followed, I will probably delete your comment. If not, I might alter it in any way I see fit, including URL's and anchor texts!

Leave a Reply

*