PPPoE on linux with BT and Vigor130
I’m one of those weird people that still runs a “Linux router”. This means I have a PCEngines APU2 board and use a Draytek 130 modem. The reason I do this is because I like the control it gives me, and I can run things like dnsdist, powerdns in combination with DHCP. It gives me nice hostnames, so I can access my webcam via nice URL’s. I also run this blog on the machine, as well as my nextcloud instance.
Setting this up on Debian buster was fairly easy with the help of Richard Burtons’ blog post. Here are my notes.
Installation
Let’s first install the right software packages
sudo apt install ppp pppoe
Configs
Chap secrets is always the same, so the below is my actual /etc/ppp/chap-secrets
file:
# Secrets for authentication using CHAP
# client server secret IP addresses
"bthomehub@btbroadband.com" * "password"
My /etc/ppp/peers/bt
file:
#BT Broadband
# Use the pppoe kernel module.
plugin rp-pppoe.so enp3s0
# Name this connection as ppp0.
unit 0
user bthomehub@btbroadband.com
# No default IP; allocated dynamically by ISP.
noipdefault
# Try to get name servers from ISP.
# usepeerdns
# Use this connection as the default route.
defaultroute
# Replace the default route if already present
replacedefaultroute
# There is an 8 byte overhead for PPPoE; however,
# we are using baby jumbo frames of 1508 on eth0
# to account for the extra 8 byte overhead.
mtu 1500
mru 1500
# Exclude password string when logging packet contents.
hide-password
noauth
# Try to reopen the connection if it is terminated.
persist
+ipv6
ipv6 ,
The last two options are for IPv6 support. I do not ask for a DNS server from the provider, as I run dnsdist and have my /etc/resolv.conf
pointing to it.
Within the /etc/network/interfaces
file, I use enp3s0
to connect to the DrayTek modem. Because the MTU is set to 1500 in the /etc/ppp/peers/bt
file, we need to add MTU here for some encapsulation. I therefor update it in the /etc/network/interfaces
file. The IP address here is actually not used for anything.
auto enp3s0
iface enp3s0 inet static
mtu 1508
address 192.168.3.1
netmask 255.255.255.0
Connecting
After this all setup, you can run sudo pon bt
and it should should connect. This should produce a ppp0
device.
IPv6
It turns out, IPv6 works as well. You’ll need to request the address separately via DHCP.
$ sudo apt install dhcpcd5
The config file for the dhcpcd is in /etc/dhcpcd.conf
and for me looks like:
hostname
duid
option rapid_commit
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
require dhcp_server_identifier
nohook lookup-hostname
# Globally disabling router solicitation as requesting
# # prefix delegation
ipv6only
noipv6rs
# Configure IPv6 on bt and accept router solicitations
interface ppp0
ipv6only
ipv6rs
# Request a prefix for lan. Using sla_id 0 resulted in the full /56
# being assigned to lan, whereas sla_id 1 results in a /64.
ia_pd 1 ppp0/10 enp3s0/3 enp2s0/2 enp1s0/1
The last line of the config is important, as it indicates which interfaces should receive a IPv6 /64 range.
radvd
The IPv6 addresses can also be assigned to machines behind the linux router. To do this, you’ll have to setup radvd:
|
|
My config file looks like this:
interface enp2s0 {
AdvSendAdvert on;
AdvManagedFlag on;
AdvOtherConfigFlag on;
prefix 2a00:23c5:82d:1602::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
clients {
fe80::357c:16aa:5300:8e7e;
fe80::c2ee:fbff:fee0:6e72;
fe80::78e1:dad9:e97f:cec;
};
};