July 1, 2015

IPv6 with over ADSL with PPP on Debian Linux using Internode

Filed under: Technical — Tags: , , , , , , , , — James Bunton @ 12:00 am

Many years ago Internode started offering IPv6. This is proper dual stack IPv6 with a /56 block of addresses. I get 256 subnets, each with 2^64 addresses. Awesome! I signed on for the trial immediately and got it working without too much difficulty. The documentation wasn’t great though, so here’s how I my setup works today.

Overview

Internode gives you just one measly IPv6 address over the PPP link. You must use DHCPv6 (wide-dhcp-client) to enable routing to one of the subnets on your static /56 allocation. I only use one /64 for my home network. You also need radvd to advertise the route and network address to everything on your LAN.

I use systemd services ppp, radvd and dhcp6c. This gives me automatic service monitoring with auto-restart awesomeness. Previously I needed a cronjob running every 5min to restart these. They always seemed to die eventually and I was sick of sshing to my router to restart them manually. Thanks systemd! :)

sysctl configuration

Turn on IPv4 and IPv6 forwarding. I also turn on IPv6 ‘temporary’ addresses, these offer some privacy benefit by not exposing your MAC address to all websites that you visit. I think this should be the default, I enable this on all my other computers too.

/etc/sysctl.d/my-networking

net.ipv4.ip_forward = 1
net.ipv6.conf.all.forwarding = 1
net.ipv6.conf.all.use_tempaddr = 2
net.ipv6.conf.default.use_tempaddr = 2

ppp configuration

I’m not using /etc/network/interfaces for ppp. As I mentioned earlier starting it with systemd is more reliable. I stole the unit file from Arch Linux, but it’s pretty straightforward.

/etc/systemd/system/ppp@.service

[Unit]
Description=PPP connection for %I
Before=network.target

[Service]
ExecStart=/usr/sbin/pppd call %I nodetach nolog

[Install]
WantedBy=multi-user.target

/etc/ppp/options

lock
noauth
persist

lcp-echo-interval 1
lcp-echo-failure 10
maxfail 0
holdoff 5

/etc/ppp/peers/adsl

user "@internode.on.net"

plugin rp-pppoe.so
eth1
unit 0

noipdefault
defaultroute
ipv6 ,

/etc/ppp/chap-secrets

"@internode.on.net"     *       ""

Now you can enable and start the service.

systemctl enable ppp@adsl
systemctl start ppp@adsl

# watch the logs
journalctl -u ppp@adsl -f

DHCPv6

dhcp6c.service

[Unit]
Description=WIDE-DHCPv6 Client
After=network.target
Requires=network.target

[Service]
EnvironmentFile=/etc/default/wide-dhcpv6-client
ExecStart=/usr/sbin/dhcp6c -c /etc/wide-dhcpv6/dhcp6c.conf -f $INTERFACES
Restart=on-failure
RestartSec=60s
StartLimitInterval=0

[Install]
WantedBy=multi-user.target

/etc/wide-dhcpv6/dhcp6c.conf

interface ppp0 {
    send ia-pd 0;
};

id-assoc pd {
    prefix-interface eth0 {
        sla-id 0;
        sla-len 8;
    };
};

Now enable the service and grab your IPv6 /64 subnet.

systemctl enable dhcp6c
systemctl start dhcp6c
ip addr show dev eth0

Also we need to run dhcp6c each time the PPP session is established.
/etc/ppp/ipv6-up.d/dhcp6c

#!/bin/sh

ip -6 route add default dev ppp0
sleep 5 # bit of a hack...
systemctl restart dhcp6c

You should see an address something like 2001:44b8:316b:d900:208:74ff:fe9a:d2e7/64. The network portion of the address is the first half, in this case: 2001:44b8:316b:d900::/64.

Route advertisements

The final step is to advertise these routes to everything on your network.

/etc/radvd.conf

interface eth0
{
   AdvSendAdvert on;
   prefix 2001:44b8:316b:d900::/64
   {
   };
};   

Now enable radvd:

systemctl enable radvd
systemctl start radvd

2 comments

Winston Sorfleet says:

Now you can enable and start the service.
systemd enable ppp@adsl
systemd start ppp@adsl

I think you mean “systemctl”.

John Tate says:

Dec 18 22:40:52 gateway.home systemd[1]: Started WIDE-DHCPv6 Client.
Dec 18 22:40:52 gateway.home dhcp6c[12221]: gethwid: found an interface eth0 for DUID
Dec 18 22:40:52 gateway.home dhcp6c[12221]: get_duid: generated a new DUID: 00:01:00:01:25:8d:67:74:b8:27:eb:96:8f:f0
Dec 18 22:40:52 gateway.home dhcp6c[12221]: Dec/18/2019 22:40:52: dhcp6_ctl_init: bind(control sock): Address already in u
Dec 18 22:40:52 gateway.home dhcp6c[12221]: Dec/18/2019 22:40:52: client6_init: failed to initialize control channel
Dec 18 22:40:52 gateway.home dhcp6c[12221]: get_duid: saved generated DUID to /var/lib/dhcpv6/dhcp6c_duid
Dec 18 22:40:52 gateway.home systemd[1]: dhcp6c.service: Main process exited, code=exited, status=1/FAILURE
Dec 18 22:40:52 gateway.home systemd[1]: dhcp6c.service: Failed with result ‘exit-code’.

Comments are closed.