A little while ago I shared some information on getting IPv6 at home, when all you have is a dynamic (but real/public) IP-address and a good old WRT54GL router with OpenWRT Backfire (brcm-2.4 edition).
I have now stabilized my configuration and I will share some details. You are presumed to
- be comfortable with editing configuration files manually (using vi, or some other editor in OpenWRT)
- use OpenWRT Backfire 10.03.1 on your router (which can probably be any router capable of running OpenWRT)
- have some understanding of what you are about to do and why
- have a public (but not necessarily static) IPv4 address
If you mess up your firewall rules, worst case you can not log in to your router or you expose your entire network to the world. Proceed at your own risk.
At some point you will start trying your IPv6 connectivity. I suggest using test-ipv6.com, ipv6-test.com and ipv6.google.com.
A good start is the OpenWRT IPv6 Article (it contains much information, but it is not very well structured). First follow the 6to4, 6rd instructions (down to the firewall rule, which is probably fine, but I dont need it).
You also need to enable IPv6 forwarding (which is described in the 6in4 section).
edit /etc/sysctl.conf:
net.ipv6.conf.all.forwarding=1
Then
/etc/init.d/sysctl restart
Now you should start testing what works and what does not. Run ifconfig both on the router and on your local machine (ipconfig on Wintendo). If you have a reasonably new OS, you should now at least have an IPv6-address, even if you cant ping6 or connect to anything.
Note: Your 6to4 IP should start with 2002: (both router and clients). Addresses starting with fe80: are private addresses and completely useless.
Firewall
You probably have a Masquerading firewall configured for IPv4, but if you bother with IPv6 at all you probably don’t want to do Masquerade for IPv6 (dont know if it is possible).
I wanted my IPv4 to work just normally. And I wanted all my LAN-computers to be real IPv6 members accessible from the IPv6 internet (and protected by firewall, as needed, of course). That means, all replies from Internet should be fine, but incoming traffic from Internet should be restricted. The most natural thing would be to use connection tracking, but I encountered problems.
This is what my firewall configuration looks like now:
/etc/config/firewall
config 'defaults'
option 'input' 'DROP'
option 'output' 'ACCEPT'
option 'forward' 'DROP'
option 'syn_flood' '1'
option 'drop_invalid' '1'
option 'disable_ipv6' '0'
config 'zone'
option 'name' 'lan'
option 'network' 'lan'
option 'input' 'ACCEPT'
option 'output' 'ACCEPT'
option 'forward' 'REJECT'
option 'mtu_fix' '1'
config 'zone'
option 'name' 'wan'
option 'network' 'wan'
option 'family' 'ipv4'
option 'masq' '1'
option 'output' 'ACCEPT'
option 'forward' 'DROP'
option 'input' 'DROP'
config 'zone'
option 'name' 'wan6'
option 'network' '6rd'
option 'family' 'ipv6'
# option 'conntrack' '1'
option 'output' 'ACCEPT'
option 'forward' 'DROP'
option 'input' 'DROP'
config 'forwarding'
option 'src' 'lan'
option 'dest' 'wan'
option 'family' 'ipv4'
config 'forwarding'
option 'src' 'lan'
option 'dest' 'wan6'
option 'family' 'ipv6'
config 'include'
option 'path' '/etc/firewall.user'
config 'rule'
option 'target' 'ACCEPT'
option '_name' 'IPv6 WRT54GL ICMP'
option 'src' 'wan6'
option 'proto' 'icmp'
option 'family' 'ipv6'
config 'rule'
option '_name' 'IPv6: Forward ICMP'
option 'target' 'ACCEPT'
option 'family' 'ipv6'
option 'src' 'wan6'
option 'dest' 'lan'
option 'proto' 'icmp'
config 'rule'
option '_name' 'IPv6: WRT54GL "reply" to 1024+'
option 'target' 'ACCEPT'
option 'family' 'ipv6'
option 'src' 'wan6'
option 'dest_port' '1024-65535'
option 'proto' 'tcp'
config 'rule'
option '_name' 'IPv6: Forward "reply" to 1024+'
option 'target' 'ACCEPT'
option 'family' 'ipv6'
option 'src' 'wan6'
option 'dest' 'lan'
option 'dest_port' '1024-65535'
option 'proto' 'tcp'
Some comments on this:
- I think it makes sense to think about IPv6 Internet as a separate wan6, not as part of wan
- Incoming traffic is forwarded, as long as it is to unpriviliged ports (1024+)
- ICMP works between everyone
- The firewall.user script contains nothing of interest for IPv6
- Masquerade is activated for wan, but conntrack (or masquerade) does not work for wan6
- I have not needed a rule to allow INPUT protocol 41 to the router itself (the 6to4 traffic over IPv4), perhaps it gets allowed as ESTABLISHED,RELATED
Bridging and Connection tracking problems
I believe my configuration is working properly. But something is not completely right. Loading the firewall…
root@OpenWrt:~# /etc/init.d/firewall restart
Loading defaults
ip6tables: No chain/target/match by that name.
ip6tables: No chain/target/match by that name.
ip6tables: No chain/target/match by that name.
ip6tables: No chain/target/match by that name.
ip6tables: No chain/target/match by that name.
ip6tables: No chain/target/match by that name.
Loading synflood protection
Adding custom chains
Loading zones
Loading forwardings
Loading redirects
Loading rules
Loading includes
Loading interfaces
ip6tables: No chain/target/match by that name.
In the end of OpenWRT IPv6 documentation:
Note: firewall v1 (e.g. still in Backfire 10.03.1-rc4 and up to r25353) has no default rules at all and ip6tables configuration needs to be done from scratch. Insert the rules below to make the packet filter function properly.
ip6tables -A FORWARD -i br-lan -j ACCEPT
ip6tables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
ip6tables -A FORWARD -j REJECT
Well, I should be on a more recent version (10.03.1) but the second line (with conntrack) gives the No chain/target/match by that name error. I don’t know why, and I don’t know how to fix.
Also, in the same document, under the heading Directly forward ISP’s NDP proxy address to LAN there are instructions for “firewalling on ipv6 even for bridged interfaces”. I believe that this is what I want to do, but the ebtables package/module seems to not be available for WRT54GL/Backfire 10.03.1/brcm-2.4, and it also seems to be known to cause performance problems.
Either:
- I messed something up when installing/configuring OpenWRT, and now I dont know how to fix it
- Something IPv6-related that I want to do is not fully supported on Backfire/brcm-2.4
- I am just trying to do the wrong thing, without understanding it
Other config files
In case it is helpful to anyone (and possibly myself in the future) I post a few of my configuration files.
/etc/sysctl.conf (there are more lines)
net.ipv6.conf.default.forwarding=1
net.ipv6.conf.all.forwarding=1
/etc/config/network (all file)
config 'switch' 'eth0'
option 'enable' '1'
config 'switch_vlan' 'eth0_0'
option 'device' 'eth0'
option 'vlan' '0'
option 'ports' '0 1 2 3 5'
config 'switch_vlan' 'eth0_1'
option 'device' 'eth0'
option 'vlan' '1'
option 'ports' '4 5'
config 'interface' 'loopback'
option 'ifname' 'lo'
option 'proto' 'static'
option 'ipaddr' '127.0.0.1'
option 'netmask' '255.0.0.0'
config 'interface' 'lan'
option 'type' 'bridge'
option 'ifname' 'eth0.0'
option 'proto' 'static'
option 'netmask' '255.255.255.0'
option 'ipaddr' '192.168.8.1'
config 'interface' 'wan'
option 'ifname' 'eth0.1'
option 'proto' 'dhcp'
config 'interface' '6rd'
option 'proto' '6to4'
option 'adv_subnet' '1'
option 'adv_interface' 'lan'
/etc/config/radvd (all other configs have option ignore 1)
config interface
option interface 'lan'
option AdvSendAdvert 1
option AdvManagedFlag 0
option AdvOtherConfigFlag 0
list client ''
option ignore 0
And a few packages that you should probably have installed in OpenWRT:
6to4
firewall
ip
ip6tables
kmod-ip6tables
kmod-ipv6
radvd
libip6tc
DHCP & DNS
I have not enabled any (IPv6) DHCP – autoconfigure works fine for me. I have also not configured anything DNS related. My normal DNS resolves IPv6-only hosts ok (i.e. ipv6.google.com).
The day I want to allow incoming traffic to just a few of my local/LAN machines I will have to think about it.
Troubleshooting
The following tools/strategies have proven useful for troubleshooting:
- ping6 between router and local/LAN machines
- ping6 to internet hosts (ipv6.google.com)
- Disable firewall or set policies to ACCEPT
- Send/receive TCP traffic using ncat (the best nc/netcat) version for OpenWRT.
- Test ping/ncat to/from an IPv6 host on a different network – I installed miredo on my Lubuntu netbook and let it connect to internet via my iPhone. That way it had no shortcut at all to my router and LAN.
- I find myself having more success when I unplug my router to restart it; just restarting makes it not come up properly.
ncat
In case you are not familiar with ncat:
On the router (start listening):
root@OpenWrt:~# ncat -6 -l -p 9999
On your local computer (send a message):
$ echo 6-TEST | nc 2002:????:????:1::1 9999
On the router (should have got message):
root@OpenWrt:~# ncat -6 -l -p 9999
6-TEST
This is useful all directions, and on different ports, to confirm that your firewall works as you expect.