Ubuntu PPPoE Server 架設

網路上找到的範例都有缺, 主要是缺 pppoe kernel module 的部份, 也不會很難, 在 Ubuntu 18.04 下需要上個 patch 修掉 compile bug.

以下假設各位用 root 跑 (我好懶)

Download RP-PPPoE

$ apt-get remove pppoe
$ apt-get install ppp ppp-dev pppoeconf
$ wget https://www.roaringpenguin.com/files/download/rp-pppoe-3.12.tar.gz
$ tar zxvf rp-pppoe-3.12.tar.gz
$ cd rp-pppoe-3.12/src

Apply Patch

依照下面的文字 patch rp-pppoe 的 source code

--- a/pppd/plugins/rp-pppoe/plugin.c	2016-11-29 15:39:09.289843383 +0530
+++ b/pppd/plugins/rp-pppoe/plugin.c	2016-11-29 15:39:22.659843111 +0530
@@ -49,6 +49,8 @@
 #include <net/ethernet.h>
 #include <net/if_arp.h>
 #include <linux/ppp_defs.h>
+#define _LINUX_IN_H
+#define _LINUX_IN6_H
 #include <linux/if_pppox.h>
 
 #ifndef _ROOT_PATH

Compile rp-pppoe and install

$ ./configure
$ make
$ make rp-pppoe.so
$ make install

 

Configure file /etc/ppp/pppoe-server-options

# PPP options for the PPPoE server
# LIC: GPL
require-pap
#login
auth
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 192.168.1.254
logfile /var/log/pppd.log
 
plugin /etc/ppp/plugins/rp-pppoe.so

 

Password file /etc/ppp/chap-secrets

# Secrets for authentication using CHAP
# client server  secret         IP addresses
"user1"  *         "123456"    *

 

Setting NAT

$ echo 1 > /proc/sys/net/ipv4/ip_forward
$ iptables -A POSTROUTING -t nat -o ens33 -j MASQUERADE

Running PPPoE Server

example

$ pppoe-server -I ens34 -L 10.10.10.1 -R 10.10.10.100 -N 100

-I interface name
-L client’s gateway ip。
-R client start ip address
-N allow users

In syslog file, it should have rp-pppoe.so loaded keyword

Jun 29 00:21:01 TEST1804-1 pppoe[2106]: read (asyncReadFromPPP): Session 1: Input/output error
Jun 29 00:21:24 TEST1804-1 pppoe-server[5992]: Session 1 created for client 02:0f:b7:81:00:01 (10.10.10.100) on ens34 using Service-Name ''
Jun 29 00:21:24 TEST1804-1 pppd[5992]: Plugin /etc/ppp/plugins/rp-pppoe.so loaded.
Jun 29 00:21:24 TEST1804-1 pppd[5992]: RP-PPPoE plugin version 3.12 compiled against pppd 2.4.7
Jun 29 00:21:24 TEST1804-1 pppd[5992]: pppd 2.4.7 started by richliu, uid 0
Jun 29 00:21:24 TEST1804-1 pppd[5992]: Using interface ppp0
Jun 29 00:21:24 TEST1804-1 pppd[5992]: Connect: ppp0 <--> /dev/pts/4
Jun 29 00:21:24 TEST1804-1 systemd-udevd[5995]: link_config: autonegotiation is unset or enabled, the speed and duplex are not writable.
Jun 29 00:21:27 TEST1804-1 pppd[5992]: PAP peer authentication succeeded for user1

ref.
[SOLVED] Conflict between kernel and glibc headers when compiling PPP
Set up PPPoE Server on Ubuntu
Ubuntu pppoe server

On this day..

Related Posts

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>