1.\" $OpenBSD: pppoe.4,v 1.36 2022/05/27 15:45:02 jmc Exp $ 2.\" $NetBSD: pppoe.4,v 1.26 2003/10/02 07:06:36 wiz Exp $ 3.\" 4.\" Copyright (c) 2002 The NetBSD Foundation, Inc. 5.\" All rights reserved. 6.\" 7.\" This code is derived from software contributed to The NetBSD Foundation 8.\" by Martin Husemann <martin@NetBSD.org>. 9.\" 10.\" Redistribution and use in source and binary forms, with or without 11.\" modification, are permitted provided that the following conditions 12.\" are met: 13.\" 1. Redistributions of source code must retain the above copyright 14.\" notice, this list of conditions and the following disclaimer. 15.\" 2. Redistributions in binary form must reproduce the above copyright 16.\" notice, this list of conditions and the following disclaimer in the 17.\" documentation and/or other materials provided with the distribution. 18.\" 19.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 21.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 23.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 24.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 25.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29.\" POSSIBILITY OF SUCH DAMAGE. 30.\" 31.Dd $Mdocdate: May 27 2022 $ 32.Dt PPPOE 4 33.Os 34.Sh NAME 35.Nm pppoe 36.Nd PPP Over Ethernet protocol network interface 37.Sh SYNOPSIS 38.Cd "pseudo-device pppoe" 39.Sh DESCRIPTION 40The 41.Nm 42interface encapsulates 43.Em Point-to-Point Protocol (PPP) 44packets inside Ethernet frames as defined by RFC 2516. 45.Pp 46This is often used to connect a router via a DSL modem to 47an access concentrator. 48The 49.Nm 50interface does not by itself transmit or receive frames, 51but needs an Ethernet interface to do so. 52This Ethernet interface is connected to the 53.Nm 54interface via 55.Xr ifconfig 8 . 56The Ethernet interface needs to be marked UP, but does not need to have an 57IP address. 58.Pp 59There are two basic modes of operation, controlled via the 60.Em link1 61switch. 62The default mode, 63.Em link1 64not being set, tries to keep the configured session open all the 65time. 66If the session is disconnected, a new connection attempt is started 67immediately. 68The 69.Dq dial on demand 70mode, selected by setting 71.Em link1 , 72only establishes a connection when data is being sent to the interface. 73.Pp 74Before a 75.Nm 76interface is usable, it needs to be configured. 77The following steps are necessary: 78.Bl -bullet 79.It 80Create the interface. 81.It 82Connect an Ethernet interface. 83This interface is used for the physical communication. 84As noted above it must be marked UP, but need not have an IP address. 85.It 86Configure authentication. 87The PPP session needs to identify the client to the peer. 88For more details on the available options see 89.Xr ifconfig 8 . 90.It 91If using IPv6, configure a link-local address. 92.El 93.Pp 94This all is typically accomplished using an 95.Pa /etc/hostname.pppoe0 96file. 97A typical file looks like this: 98.Bd -literal -offset indent 99inet 0.0.0.0 255.255.255.255 NONE \e 100 pppoedev em0 authproto pap \e 101 authname 'testcaller' authkey 'donttell' up 102dest 0.0.0.1 103inet6 eui64 104!/sbin/route add default -ifp pppoe0 0.0.0.1 105!/sbin/route add -inet6 default -ifp pppoe0 fe80::%pppoe0 106.Ed 107.Pp 108The physical interface must also be marked 109.Ql up : 110.Bd -literal -offset indent 111# echo "up" > /etc/hostname.em0 112.Ed 113.Pp 114Since this is a PPP interface, the addresses assigned to the interface 115may change during PPP negotiation. 116In the above example, 0.0.0.0 and 0.0.0.1 serve as placeholders for 117dynamic address configuration. 118.Pp 119If the local address is set to wildcard address 0.0.0.0, it will 120be changed to an address suggested by the peer. 121.Pp 122If the destination address is set to a wildcard address in the range 123from 0.0.0.1 to 0.0.0.255, it will be changed to an address suggested 124by the peer, and if a default route which uses this interface exists 125the gateway will be changed to the suggested address as well. 126.Pp 127Otherwise, PPP negotiation will only agree to exactly the IPv4 addresses 128which are configured on the interface. 129.Sh KERNEL OPTIONS 130.Nm 131does not interfere with other PPPoE implementations 132running on the same machine. 133However under some circumstances 134(such as after a crash or power failure) 135the peer device might initially refuse to 136reestablish a new PPPoE connection 137because there is already an open session. 138This would be indicated by the client sending a high number of PADI packets 139before successfully connecting. 140The 141.Nm 142driver can be told to kill all unknown PPPoE sessions 143by sending a PADT packet to explicitly terminate the old session. 144Add the following to the kernel config file: 145.Pp 146.Dl option PPPOE_TERM_UNKNOWN_SESSIONS 147.Sh PPPOE AND MTU/MSS 148PPPoE has an 8-byte header. 149When run over a network interface with the 150standard Ethernet maximum transmission unit (MTU) of 1500 bytes, 151this reduces the maximum available MTU to 1492. 152.Nm 153sets the default MTU to this value. 154Unfortunately issues can occur when the path between 155the two endpoints of a TCP connection are not able to carry 156same sized packets, 157leading to possible packet fragmentation and sometimes packet loss. 158In that case the maximum packet size can be set using the 159.Cm max-mss 160option in 161.Xr pf.conf 5 . 162For example: 163.Pp 164.Dl match on pppoe0 scrub (max-mss 1440) 165.Sh MTU/MSS NEGOTIATION 166When using a PPPoE device configured for a higher MTU ("jumbo frames"), 167the MTU for the 168.Nm 169device can also be raised. 170In this case 171.Nm 172attempts to negotiate the higher size with the other PPPoE endpoint 173using the RFC 4638 protocol. 174This can allow standard Ethernet packet sizes (1500 bytes) 175to be carried over PPPoE. 176For example, in 177.Pa /etc/hostname.pppoe0 : 178.Bd -literal -offset indent 179inet 0.0.0.0 255.255.255.255 NONE mtu 1500 \e 180 pppoedev em0 authproto pap \e 181 authname 'testcaller' authkey 'donttell' up 182dest 0.0.0.1 183!/sbin/route add default -ifp pppoe0 0.0.0.1 184.Ed 185.Pp 186The physical interface would also have to be configured correspondingly: 187.Bd -literal -offset indent 188# echo "up mtu 1508" > /etc/hostname.em0 189.Ed 190.Pp 191However, RFC 4638 negotiation only takes into account the MTU configured 192on the endpoints, not the maximum MTU supported on the path between them. 193If the path cannot pass the larger Ethernet frames, negotiation will succeed 194but the larger frames will be dropped. 195For this reason it is important to test the connection with large packets 196when enabling a higher MTU. 197.Sh SEE ALSO 198.Xr sppp 4 , 199.Xr hostname.if 5 , 200.Xr pf.conf 5 , 201.Xr ifconfig 8 202.Sh STANDARDS 203.Rs 204.%A L. Mamakos 205.%A K. Lidl 206.%A J. Evarts 207.%A D. Carrel 208.%A D. Simone 209.%A R. Wheeler 210.%D February 1999 211.%R RFC 2516 212.%T A Method for Transmitting PPP Over Ethernet (PPPoE) 213.Re 214.Pp 215.Rs 216.%A P. Arberg 217.%A D. Kourkouzelis 218.%A M. Duckett 219.%A T. Anschutz 220.%A J. Moisand 221.%D September 2006 222.%R RFC 4638 223.%T Accommodating a Maximum Transit Unit/Maximum Receive Unit (MTU/MRU) Greater Than 1492 in the Point-to-Point Protocol over Ethernet (PPPoE) 224.Re 225.Sh HISTORY 226The 227.Nm 228device first appeared in 229.Ox 3.7 . 230.Sh BUGS 231This implementation is client side only. 232.Pp 233It is important to specify 234.Dq Li netmask 255.255.255.255 235to 236.Xr ifconfig 8 . 237If the netmask is unspecified, it will be set to 8 when 0.0.0.0 is 238configured to the interface, and it will persist after negotiation. 239.Pp 240The presence of a 241.Xr mygate 5 242file will interfere with the routing table. 243Make sure this file is either empty or does not exist. 244.Pp 245Two 246.Nm 247interfaces configured with the same wildcard destination address 248cannot share a routing table. 249