4

I want to add lines to a working 01-netcfg-yaml file to automatically connect an interface to ppp using a script created by pppoeconf.

But I can't find any guides or examples.

I would much appreciate a "howto" help to do this.

Thanks in advance.

Robie Basak
  • 15,910
AndrewG
  • 49
  • 1
  • 4

2 Answers2

5

I've configured my PPPoE router running Ubuntu using netplan for the regular Ethernet interface and directly using systemd for the PPPoE interface.

For the PPP part, I left the PPPoE interface out of netplan entirely and created a /etc/systemd/system/ppp.service file as follows. ens7 is my interface that is connected to my PPPoE modem, which you'll need to change (every occurence) to your case. I'm also using baby jumbo frames by setting my MTU to 1508. If your NIC or ISP can't handle this, then you should remove that line:

[Unit]
BindsTo=sys-subsystem-net-devices-ens7.device
After=sys-subsystem-net-devices-ens7.device

[Service]
ExecStartPre=/sbin/ip link set mtu 1508 dev ens7
ExecStartPre=/sbin/ip link set up dev ens7
ExecStart=/usr/sbin/pppd call provider
Type=forking
SuccessExitStatus=5
PIDFile=/run/ppp-pppoe.pid

[Install]
WantedBy=sys-subsystem-net-devices-ens7.device

My /etc/ppp/peers/provider looks like this. Again, ens7 is my PPPoE interface; you'll need to change it to your own one below, along with my_username_with_my_isp. If your hardware (or ISP) can't handle baby jumbo frames and you deleted the mtu line above, then also change mtu and mru below to 1492. I'm also enabling ipv6 here. Add usepeerdns if you want your ISP's provided DNS servers to be used (instead of having them statically configured).

user my_username_with_my_isp
plugin rp-pppoe.so
ens7
noipdefault
defaultroute
hide-password
lcp-echo-interval 20
lcp-echo-failure 3
noauth
persist
maxfail 0
mtu 1500
mru 1500
noaccomp
default-asyncmap
+ipv6
linkname pppoe

My /etc/ppp/chap-secrets looks like this. You may need to use /etc/ppp/pap-secrets instead if your ISP doesn't support CHAP.

* * my_password_with_my_isp

To put it all together on 18.04:

  1. Install the ppp package.

  2. Create/edit /etc/systemd/system/ppp.service, /etc/ppp/peers/provider and /etc/ppp/chap-secrets as above.

  3. Run sudo systemctl daemon-reload, sudo systemctl enable ppp and then sudo systemctl start ppp.

  4. Use systemctl status ppp and view /var/log/syslog for PPP status.

Robie Basak
  • 15,910
2

There is an option if you're happy to do some tinkering. networkd-dispatcher can help you run your own scripts to do what you need, and roughly follows the syntax for scripts in /etc/network/.

https://github.com/craftyguy/networkd-dispatcher

Also, this is now accepted into Bionic (18.04) in the "universe" repository:

https://launchpad.net/ubuntu/+source/networkd-dispatcher/1.7-0ubuntu1

# Install
sudo apt install networkd-dispatcher

# Documentation
man networkd-dispatcher
dpb
  • 7,209