r/homelab•
Legogris

DIY router option for IPoE (6over4 / ipip6)

Solved

I am attempting to build my own router rather than using the suspicious box I've been offered to rent by the network provider.

I'm fairly confident in Linux sysadmin (networking with iproute and iptables is kind of my weak spot though).

My ISP (in Japan) only provides IPv6 connectivity in the uplink, and in order to get access to the IPv4 part of the Internet, I have to set up what they refer to as an "IPoE connection" on their "v6Direct" plan - the only guidance they provide is to Japanese routers already providing support for this protocol. Basically it's an IPv4-over-IPv4 tunnel, referred to as `ipip6` in Linux. After reading it seems to be the same, at least in principle, to the more well-known "DS-Lite" protocol. Not sure if they're doing proper DS-Lite or if there's something they're doing differently (or is DS-Lite just a synonym for ipip6?).

I bought a PC Engines APU4 kit that I am now attempting to set up.

After much toil and trouble, I just can't figure out how to get the tunneling set up on the router/firewall.

IPv6 connection works fine from what I can see.

What I tried:

  • pfSense: There are GRE and GIF tunneling interfaces. Can't get any of these working. No configuration allows me to ping the remote gateway, despite trying to route all IPv4 traffic through the tunnel in various configurations. First time I'm using pfSense and FreeBSD - maybe GRE/GIF are not compatible protocols here? DHCP6 RA seems broken as well due to a bug in radv 2.17 which was fixed in the upstream 2.18, which is not installable.
  • OpenWRT: Has a "dslite" package with a hardcoded IP which is different from the one I'm using. Found a modification that should work for the network I'm on, but the uci interface fails to start - logs just show "unknown error" and I found a couple of issues in the tracker related to this, so it seems to be broken in OpenWRT as of now, possibly due to some bug in the odhcpd package. Gave up on OpenWRT.
  • OPNsense: Didn't try yet but this issue put me off after the above. And looks like they're still on radvd 2.17 as well.
  • Connecting directly with my laptop running Arch: Working!

On Arch I can get it up using the following:

ip -6 tun add mytunnel mode ipip6 local $MY_IPV6_ADDRESS remote $GATEWAY_IPV6_ADDRESS dev $INTERFACE
ip a add dev mytunnel $PROVIDED_STATIC_IPV4/32
ip route add default dev mytunnel
ip link set dev mytunnel up

VyOS might work, but I've played with it before and just go nuts over how they're forcing every single parameter change to go through a single command in their CLI rather than allowing me to edit configuration files directly by hand...

At this point I'm considering giving up with all these router/firewall distros, install Debian and calling it a day... But can something so simple really be this hard?

Did anyone have success doing something similar with any of the above? Some other distro I should give a shot? Is IPFire worth it?

ISP graciously provides a sample config for Yamaha RTX1210, one of those domestic routers.

Posted Dec 10, 2019, 2:23 AM UTC

15
_kroy•

VyOS might work, but I’ve played with it before and just go nuts over how they’re forcing every single parameter change to go through a single command in their CLI rather than allowing me to edit configuration files directly by hand...

VyOS can easily do what you want, but if you are really wanting to edit files by hand, I think you sort of have your answer. I like it because it removes the hassle of maintaining a dozen different config files, and unifies it behind a single CLI.

You sound like the kind of person who isn’t scared of getting down and dirty, so I’d just go the Debian option.

1
Swedophone•

If Arch works then you should be able to use a similar configuration on Openwrt. You could add the tunnel device in /etc/rc.local see below. And after that configure an interface (static protocol) using mytunnel as physical interface, and add the IPv4 address.

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

ip -6 tun add mytunnel mode ipip6 local $MY_IPV6_ADDRESS remote $GATEWAY_IPV6_ADDRESS dev $INTERFACE
ip link set dev mytunnel up
exit 0
1
LegogrisOP•

I feel pretty silly now for not realizing this myself, I was somehow thinking that OpenWRT neeeded to create tunnels in order to play nicely with them. Works great - tack så mycket kompis!

Now I just have to figure out why my LAN clients can't get access to IPv6 internet, but that's probably just misconfiguration on my end :)

1
Swedophone•

Now I just have to figure out why my LAN clients can't get access to IPv6 internet, but that's probably just misconfiguration on my end :)

Unfortunately it may be that ISPs in Japan that don't provide IPv6 according to best current practice. I read about one which uses bridging instead of routing. I.e. The ipv6 prefix is on-link instead of routed which means you would need to use relays.

1
LegogrisOP•

It's weird - if I understand correctly I should have whole /64 range to myself.

​

When pinging an outside IPv6 address from the router, it works fine. Not from a LAN host.

Running tcpdump on the wan6 interface of the router, I see the outgoing ICMP packets, but there are no responses. They look identical to when I ping directly from the router (except the source IP is of course the one of the LAN host) - apart from that the flowlabel is always the same constant from the LAN host and different each time from the router.

​

Ping from router:

07:16:49.032336 IP6 (flowlabel 0x6d18b, hlim 64, next-header ICMPv6 (58) payload length: 64) xxxx:yyyy:zzzz:aaaa:ROUTERSUFFIX > 2606:4700:4700::1111: [icmp6 sum ok] ICMP6, echo request, seq 1
07:16:49.036013 IP6 (flowlabel 0xb1798, hlim 57, next-header ICMPv6 (58) payload length: 64) 2606:4700:4700::1111 > xxxx:yyyy:zzzz:aaaa:ROUTERSUFFIX: [icmp6 sum ok] ICMP6, echo reply, seq 1

Ping from LAN host:

07:18:32.039201 IP6 (flowlabel 0xa4c54, hlim 63, next-header ICMPv6 (58) payload length: 64) xxxx:yyyy:zzzz:aaaa:LANHOSTSUFFIX > 2606:4700:4700::1001: [icmp6 sum ok] ICMP6, echo request, seq 1

EDIT: Got it working! After setting all DHCPv6 options on LAN to relay and the following in /etc/config/dhcp the relaying works fine now:

​

config dhcp 'wan6'
        option dhcpv6 'relay'
        option ra 'relay'
        option ndp 'relay'
        option master '1'

Thanks again for the pointers :)

1