Enable IPv6 on OpenWRT

This guide describes how you can enable IPv6 on OpenWRT. This guide assumes that your ISP does not provide a native IPv6 address. We’ll make use of the 6to4 relay servers. No account is required to start using the service. The howto assumes you have OpenWRT running on your router. OpenWRT Backfire 10.03.1 has been installed on my Netgear WNDR3800.

Install the required packages.

This can be done by the HTTP GUI or CLI. Below you find the commands to execute when installing the packages using CLI.

opkg update
opkg install kmod-ipv6 ip6tables radvd ip 6to4

Configure a new interface

Configure an extra interface that will have your IPv6 address. This can be done by adding the below lines to /etc/config/network

config 'interface' '6rd'
   option 'proto' '6to4'
   option 'adv_subnet' '1'
   option 'adv_interface' 'lan'

Add new interface to WAN zone

Open /etc/config/firewall and locate configuration for the ‘wan’ zone.

config 'zone'
   option 'name' 'wan'

One of the configuration settings lists the attached networks. Add ‘6rd’ to the list.

   option 'network' '6rd wan'

Configure Router Advertisement Daemon

Radvd is the daemon that announces the ipv6 router on the internal network. IPv6 clients will listen for Router Advertisements (RA) to configure their interfaces with an IPv6 address. This process is called StateLess Address AutoConfiguration. (SLAAC)
To enable radvd, edit ‘/etc/config/radvd’ and change the ‘ignore’ to ‘0’

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

Enable IPv6 forwarding

Add the following to /etc/sysctl.conf

# enable ipv6 forwarding
net.ipv6.conf.all.forwarding=1

Reboot your router

This one is pretty easy. Just run the below command and wait.

reboot<enter>

Test

First try to ping my server using its IPv6 address. Run the following command on your router. This will verify of your router can access IPv6 addresses.

ping6 -c 4 2001:470:7071:1::6

If this works, you can proceed with the following tests. Try to browse to the following URL with one of the PC within the LAN of your router. As you can see the URL contains an IPv6 address.

http://[2a01:4f8:a0:9261::7]/

If you were able to access the above URL, your PC has IPv6 connectivity. Now, let’s test if you can resolve AAAA records. Try the following URL.

http://ipv6.rivy.org

If this was successful, you should be able to browse any IPv6 enabled website on the internet.

Questions or feedback

Feel free to contact me via the comments section if you have questions. Any feedback is appreciated.

9 thoughts on “Enable IPv6 on OpenWRT

  1. CarbonLifeForm

    It’s always nice to see another IPv6 OpenWRT user. I’ve had mine connected natively through my ISP’s beta IPv6 service. Before that I used gogo6 and he.net tunnels. I’m only now getting all the needed services going, for ages I was using ipv4 DNS resolution but now I have unbound doing dedicated IPv6 resolution through my ISP’s IPv6 enabled resolvers.

    Reply
    1. Thomas Post author

      Indeed. My ISP (cable provider telenet.be) doessn’t support any IPv6 yet. They’re planning on rolling it out in 2013. Interesting to see that you visited my site also over IPv6.

      Reply
  2. Fred

    Hi Thomas,

    Came across your post while trying to set up 6to4 on my openWRT installation (ATTITUDE ADJUSTMENT 12.09, r36088) – I have added opkg install 6to4 . I’m trying something different and hope to set it up on a separate test device that I have placed behind my NAT-device (DIR-825). Still struggling though 😉 May I trouble you with a few questions?! First off, is this possible provided that I manage to do port forwarding in my DIR-825? Secondly, once i have entered the configuration into /etc/config/network, shouldn’t I be able to see the interface using ifconfig? Final question, how do I add the necessary IPv6 default route?

    Thx, fully understand if you don’t have time to answer!

    Reply
  3. Fred

    I figured it out. The tunnelinterface (henet in my example) looked to be down as implied previously (not listed in an ifconfig). I reinstalled the 6to4 package and it all started working. The ifstatus henet command was very useful 🙂

    Reply
  4. Gio

    These instruction worked perfectly, thank you!!!
    Much easier to follow than the openwrt wiki documentation… 🙂

    However, ip 2a01:4f8:a0:9261::7 that you suggest to ping as a test does not seem to be working, while http://ipv6.rivy.org/ works well.

    Reply
  5. davidcano

    Hi,

    I have follow your intructions to get ipv6 on my OpenWRT Backfire, but it does not work fine..

    When i try to ping6 2001:470:7071:1::6 i ge (and the same when i try ping ::1) t:

    PING 2001:470:7071:1::6 (2001:470:7071:1::6): 56 data bytes
    ping6: can’t create raw socket: Address family not supported by protocol

    I guess that if it would work propertly when i do ifconfig i would get ‘6rd’ interface, is it true? I can not see 6rd interface when i execute ifconfig command.

    Thanks =)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *