add pppoe support to systemd-networkd · Issue #481 · systemd/systemd

I would like to share my PPPoE configuration, hope that helps.

/etc/systemd/system/pppoe-client@.service:

[Unit]
Description=PPPoE Client on %I
Requires=sys-devices-virtual-net-%i.device
After=sys-devices-virtual-net-%i.device

[Service]
Type=simple
ExecStart=/usr/sbin/pppd call pppoe-client-%i
Restart=always
StandardOutput=null

[Install]
WantedBy=multi-user.target

/etc/ppp/peers/pppoe-client-YOUR_ETHERNET_INTERFACE_HERE:

plugin rp-pppoe.so
noauth
nodetach
noipdefault
noproxyarp
noremoteip
persist
nic-YOUR_ETHERNET_INTERFACE_HERE
ifname YOUR_PPP_INTERFACE_HERE
user YOUR_USERNAME_HERE
password YOUR_PASSWORD_HERE
defaultroute
usepeerdns
+ipv6

I don't use NetworkManager, resolvconf, etc. So I disabled the hook script included in my distro chmod -x /etc/ppp/ip-up.d/0000usepeerdns and write my own to tell systemd-resolved about the DNS server on link.

/etc/ppp/ip-up.d/0001usepeerdns:

#!/bin/sh -e

# this variable is only set if the usepeerdns pppd option is being used
[ "$USEPEERDNS" ] || exit 0

if [ "${DNS1}" ]; then
	if [ "${DNS2}" ]; then
		/usr/bin/resolvectl dns "${IFNAME}" "${DNS1}" "${DNS2}"
	else
		/usr/bin/resolvectl dns "${IFNAME}" "${DNS1}"
	fi
fi

exit 0

And ln -sf /dev/null /etc/ppp/resolv.conf to avoid pppd tampering filesystem.

EDIT: resolvectl dns does not survive across networkd restarts. Now I prefer to compose a drop-in .network configuration at /run/systemd/network/foo.network.d/bar.conf, touch original foo.network to workaround issue 15521 (fixed in v246) and call networkctl reload.