IPv6 for DSL dialup on FreeBSD
Setting up IPv6 seems to be a big mystery sometimes. There are various ways ISPs realize it. This article describes how to do I did it for my setup. It might give you some hints what to look at.
You should know a bit how IPv6 generally works and it probably makes sense, if you know networking concepts.
I've successfully set up IPv6 for my home network. It's really hard to find instructions to configure it as a DSL router setup, I noticed. I found some useful information on the web, but it wasn't complete. I noticed that my ISP works with stateless configuration (SLAAC). But the problem with SLAAC is that you only get a
/64 prefix and won't be able to delegate it. I needed a long time to understand that it's better to use DHCPv6 for the ISP network and use SLAAC only internally.
I have PPPoE running on modem-side network that creates a
tun0 interface when connected and gets a link local address assigned from the provider. To have this, you need to enable IPv6 in ppp.conf. Something like
enable lqr echo ipcp ipv6cp should be in your configuration. This enables the router to make internet connections, but doesn't allow forwarding routed traffic. The port net/dhcp6 to the rescue. I started it in debug mode first
dhcp6c -dDf and in the output, I could see that I get a
/56 prefix. Great!
To get to this step it took me several hours because I didn't notice that my firewall was completely blocking
ffe8:: traffic on the
tun0 interface. I found it by accident, because I mixed up the interfaces while using tcpdump. Suddenly, I could see that I indeed get an answer, but it wasn't logged in the debug output of
One notable thing is that the
/56 prefix needs to be assigned to the interface facing to the local network (LAN-side) and not on
tun0 (WAN-side)! There is a sample configuration and this post that mentions the essential
sla-len setting that needs to be configured to the value
8 in my case. In the output you can see
dhcp6c complaining about
56 + 16 + 64 being wrong. The
16 is the default
sla-len setting that I did not consider first. Correct sum needs to be
128 here (bit length of an IPv6 address). Hence the value
8 in the sum
56 + 8 + 64 = 128!
The rest was correcting
pf.conf and starting
rtadvd on the local network (LAN-side).
One last hint for
pf.conf. Use tagging to avoid specifying dynamic prefixes often used by ISPs. Tag the outbound traffic on the local interface and allow only tagged traffic to go out via
tun0 (the PPPoE interface).
Here an example:
# Pass outgoing connections from hosts in LAN
pass quick on $iflan all keep state tag fromlan
pass quick on $ifwan all keep state tagged fromlan
With these hints above, you should be able to configure DSL with IPv6, if you use a "dumb" modem (in contrast to a off-the-shelf router) and use a full-featured self-hosted router.