PPP

From Gentoo Wiki
Jump to:navigation Jump to:search
Resources

PPP (Point-to-Point Protocol) is commonly used in establishing a direct connection between two networking nodes. It can provide connection authentication, transmission encryption, and compression.

Installation

USE flags for net-dialup/ppp Point-to-Point Protocol (PPP)

activefilter Enables active filter support
atm Enables ATM (Asynchronous Transfer Mode) protocol support
dhcp Installs PPP DHCP client plugin for IP address allocation by a DHCP server (see http://www.netservers.co.uk/gpl/)
gtk Installs GTK+ password prompting program that can be used by passprompt.so PPP plugin for reading the password from a X11 input terminal
ipv6 Enables support for IP version 6
libressl Use dev-libs/libressl instead of dev-libs/openssl when applicable (see also the ssl useflag)
pam Add support for PAM (Pluggable Authentication Modules)DANGEROUS to arbitrarily flip
radius Enables RADIUS support

Portage has a USE flag ppp for enabling support for PPP for other packages.

Note
Enabling ppp USE flag will pull in net-dialup/ppp automatically
FILE /etc/portage/make.conf
USE="... ppp ..."

After setting global USE flags update your system to the changes take effect:

root #emerge --ask --changed-use --deep @world

Or emerge net-dialup/ppp package manually:

root #emerge --ask net-dialup/ppp

Kernel

Following kernel options need to be enabled, to support PPPoE, which is used in most cases.

Note
Using PPP compression is not suggested.
KERNEL
Device Drivers  --->
    [*] Network device support  --->
      <*>   PPP (point-to-point protocol) support
      < >     PPP BSD-Compress compression (NEW)
      < >     PPP Deflate compression (NEW)
      [ ]     PPP filtering (NEW)
      < >     PPP MPPE compression (encryption) (EXPERIMENTAL) (NEW)
      [ ]     PPP multilink support (EXPERIMENTAL) (NEW)
      <*>     PPP over Ethernet (EXPERIMENTAL)
      < >     PPP support for async serial ports (NEW)
      < >     PPP support for sync tty ports (NEW)
Optional PPP options
Option Driver Description
PPP BSD-Compress compression ppp_bsdcomp (Not recommended) Support for data compression. "PPP Deflate compression" is preferable.
PPP filtering - Support for packet filtering.
PPP MPPE compression (encryption) ppp_mppe Driver for Microsoft Point-to-Point Encryption.
PPP multilink support - Support for PPP multilink to combine serveral lines.
PPP over Ethernet pppoe Driver for PPPoE.
PPP support for sync tty ports ppp_sync_tty Support for synchronous devices.

Finally you need to rebuild linux, install and boot new kernel with PPP support.

Configuration

Provided eth0 following lines should be added for PPPoE connection:

FILE /etc/conf.d/netAdd:
...
config_ppp0="ppp"
link_ppp0="eth0" (Specify your ethernet interface)
plugins_ppp0="pppoe"
username_ppp0='user'
password_ppp0='password'
pppd_ppp0="
noauth
defaultroute
usepeerdns
mtu 9120 (Get the correct MTU (Jumbo frame) value from your eth0 Gigabit Ethernet card interface)
holdoff 3
child-timeout 60
lcp-echo-interval 15
lcp-echo-failure 3
noaccomp noccp nobsdcomp nodeflate nopcomp novj novjccomp"
...
rc_net_ppp0_need="net.eth0"

Create an init script for the PPP device by symlinking to net.lo:

root #ln -s /etc/init.d/net.lo /etc/init.d/net.ppp0
root #/etc/init.d/net.ppp0 start

Example setup with systemd and automatic connection

file: /etc/ppp/peers/provider

plugin pppoe.so
# network interface
enp41s0
# login name
name "you_login_to_ISP"
usepeerdns
persist
# Uncomment this if you want to enable dial on demand
#demand
#idle 180
defaultroute
defaultroute-metric 1023
hide-password
noauth
#linkname eth0
ifname eth0

enp41s0 is a network interface card to use, it can be found with "ip link" oir "ip address" command


note: if you use ppp of version less than 2.4.9 first line should be (rp- prefix):

plugin rp-pppoe.so


file /etc/ppp/chap-secrets:

# Secrets for authentication using CHAP
# client        server  secret                  IP addresses
your_login_to_ISP   *       your_secret_password


now we want this at startup:

add the following scripts in /etc/systemd/system/pppoe.service

[Unit]
Description=PPPoE connection
BindsTo=sys-subsystem-net-devices-enp41s0.device
After=sys-subsystem-net-devices-enp41s0.device

[Service]
Type=forking
PIDFile=/var/run/eth0.pid
#RemainAfterExit=true
ExecStart=/usr/sbin/pon
ExecStop=/usr/sbin/poff provider

[Install]
WantedBy=multi-user.target


here: sys-subsystem-net-devices-enp41s0.device is a network device via which practically pppoe will work. to find out the exact name you can use the following bash command

systemctl list-units | grep device | grep net


now we are almost here, but the interface will die if computer goes to sleep. On wake-up you should to reconnect. So create

/etc/systemd/system/pppoe-after-wakeup.service file:

[Install]
WantedBy=sleep.target

[Unit]
After=systemd-suspend.service systemd-hybrid-sleep.service systemd-hibernate.service

[Service]
Type=simple
ExecStart=/bin/systemctl restart pppoe


we are ready. Test it with

sudo systemctl start pppoe

sudo systemctl start pppoe-after-wakeup

commands and if it works as expected you can enable them on a permanent basis:

sudo systemctl enable pppoe

sudo systemctl enable pppoe-after-wakeup

See also