Ubuntu 14.04 上的 PPPoE 服务器无法正常工作 - Peer XXX 未通过 CHAP 会话验证

Ubuntu 14.04 上的 PPPoE 服务器无法正常工作 - Peer XXX 未通过 CHAP 会话验证

我正在尝试在我的 ubuntu 14.04 系统中设置 PPPoE 服务器以进行测试。服务器和客户端都安装了 Ubuntu 14.04。我按照此网站的指南设置了服务器。

http://www.howtodoityourself.org/pppoe-server-how-to-do-it-yourself.html

这是我的接口文件:

# The loopback network interface
auto lo
iface lo inet loopback

# The WAN network interface
auto eth0


# The LAN network interface
auto eth1
iface eth1 inet static
        address 192.168.1.254
        netmask 255.255.255.0

我的名称服务器:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
nameserver 8.8.8.8
nameserver 8.8.4.4

chap秘密文件:

# Secrets for authentication using CHAP
# client    server  secret          IP addresses
"russo"     *   "1234"          192.168.1.1

PPPoE 服务器选项文件:

# PPP options for the PPPoE server
# LIC: GPL
require-chap
login
lcp-echo-interval 10
lcp-echo-failure 2
ms-dns 8.8.8.8
ms-dns 8.8.4.4
netmask 255.255.255.0
defaultroute
noipdefault
usepeerdns

IP 地址池文件:

192.168.1.1-20

然后,当我通过执行以下命令运行 PPPoE 服务器时:

sudo pppoe-server -C isp -L 192.168.1.254 -p /etc/ppp/allip -I eth1

并设置 NAT

sudo iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE

然后我使用命令连接我的客户端

sudo pppoeconf

在服务器端,我的 netstat 如下所示:

mr@OptiPlex-760:~$ netstat -pr
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags   MSS Fenster irtt Iface
default         router          0.0.0.0         UG        0 0          0 eth0
link-local      *               255.255.0.0     U         0 0          0 eth1
192.168.1.0     *               255.255.255.0   U         0 0          0 eth1
192.168.88.0    *               255.255.255.0   U         0 0          0 eth0

这是系统日志文件的一部分:

Jul 10 08:54:35 OptiPlex-760 NetworkManager[987]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring...
Jul 10 08:54:35 OptiPlex-760 pppd[4644]: Using interface ppp0
Jul 10 08:54:35 OptiPlex-760 pppd[4644]: Connect: ppp0 <--> /dev/pts/0
Jul 10 08:55:06 OptiPlex-760 pppd[4644]: Peer russo failed CHAP Session verification
Jul 10 08:55:06 OptiPlex-760 pppd[4644]: Connection terminated.
Jul 10 08:55:06 OptiPlex-760 NetworkManager[987]:    SCPlugin-Ifupdown: devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Jul 10 08:55:06 OptiPlex-760 pppoe[4647]: read (asyncReadFromPPP): Session 7: Input/output error
Jul 10 08:55:06 OptiPlex-760 pppd[4644]: Exit.
Jul 10 08:55:06 OptiPlex-760 pppoe-server[4315]: Session 7 closed for client 68:b5:99:f2:b8:bc (192.168.1.7) on eth1
Jul 10 08:55:06 OptiPlex-760 pppoe-server[4315]: Sent PADT
Jul 10 08:55:24 OptiPlex-760 pppoe-server[4695]: Session 1 created for client 68:b5:99:f2:b8:bc (192.168.1.1) on eth1 using Service-Name ''
Jul 10 08:55:24 OptiPlex-760 pppd[4695]: pppd 2.4.5 started by root, uid 0
Jul 10 08:55:24 OptiPlex-760 pppd[4695]: Using interface ppp0
Jul 10 08:55:24 OptiPlex-760 pppd[4695]: Connect: ppp0 <--> /dev/pts/0
Jul 10 08:55:24 OptiPlex-760 NetworkManager[987]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0)
Jul 10 08:55:24 OptiPlex-760 NetworkManager[987]:    SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found.
Jul 10 08:55:24 OptiPlex-760 NetworkManager[987]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring...
Jul 10 08:55:37 OptiPlex-760 pppoe-server[4707]: Session 3 created for client 68:b5:99:f2:b8:bc (192.168.1.3) on eth1 using Service-Name ''
Jul 10 08:55:37 OptiPlex-760 pppd[4707]: pppd 2.4.5 started by root, uid 0
Jul 10 08:55:37 OptiPlex-760 NetworkManager[987]:    SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp1, iface: ppp1)
Jul 10 08:55:37 OptiPlex-760 NetworkManager[987]:    SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp1, iface: ppp1): no ifupdown configuration found.
Jul 10 08:55:37 OptiPlex-760 NetworkManager[987]: <warn> /sys/devices/virtual/net/ppp1: couldn't determine device driver; ignoring...
Jul 10 08:55:37 OptiPlex-760 pppd[4707]: Using interface ppp1
Jul 10 08:55:37 OptiPlex-760 pppd[4707]: Connect: ppp1 <--> /dev/pts/11
mr@OptiPlex-760:~$ 

在我的客户端,如果我检查 plog,我会看到:

muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ plog
Jul 10 08:44:15 wm-HP-EliteBook-2540p pppd[5366]: PPP session is 1
Jul 10 08:44:15 wm-HP-EliteBook-2540p pppd[5366]: Connected to 60:e3:27:05:37:78 via interface eth0
Jul 10 08:44:15 wm-HP-EliteBook-2540p pppd[5366]: Using interface ppp0
Jul 10 08:44:15 wm-HP-EliteBook-2540p pppd[5366]: Connect: ppp0 <--> eth0
Jul 10 08:44:18 wm-HP-EliteBook-2540p pppd[5366]: CHAP authentication succeeded: Access granted
Jul 10 08:44:18 wm-HP-EliteBook-2540p pppd[5366]: CHAP authentication succeeded
Jul 10 08:44:18 wm-HP-EliteBook-2540p pppd[5366]: peer from calling number 60:E3:27:05:37:78 authorized
muhammadarifurrahman@wm-HP-EliteBook

这是我的 netstat -pr:

muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ netstat -pr
Kernel-IP-Routentabelle
Ziel            Router          Genmask         Flags   MSS Fenster irtt Iface
muhammadarifurrahman@wm-HP-EliteBook-2540p:~$

我不确定我做错了什么。任何建议都非常感谢。

这是服务器端的 ifconfig -a 结果(在开始处):

    mr@OptiPlex-760:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:23:ae:7d:f1:07  
          inet addr:192.168.88.249  Bcast:192.168.88.255  Mask:255.255.255.0
          inet6 addr: fe80::223:aeff:fe7d:f107/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:669 errors:0 dropped:0 overruns:0 frame:0
          TX packets:758 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:205085 (205.0 KB)  TX bytes:104319 (104.3 KB)
          Interrupt:21 Memory:febe0000-fec00000 

eth1      Link encap:Ethernet  HWaddr 60:e3:27:05:37:78  
          inet addr:192.168.1.254  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::62e3:27ff:fe05:3778/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:72 errors:0 dropped:3 overruns:0 frame:0
          TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:6967 (6.9 KB)  TX bytes:6664 (6.6 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:387 errors:0 dropped:0 overruns:0 frame:0
          TX packets:387 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:32845 (32.8 KB)  TX bytes:32845 (32.8 KB)

ppp0      Link encap:Point-to-Point Protocol  
          POINTOPOINT NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:66 (66.0 B)  TX bytes:0 (0.0 B)

ppp1      Link encap:Point-to-Point Protocol  
          POINTOPOINT NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:1 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:22 (22.0 B)  TX bytes:0 (0.0 B)

mr@OptiPlex-760:~$ 

然后我在服务器端运行 plog 并看到:

mr@OptiPlex-760:~$ plog
Jul 10 11:23:23 OptiPlex-760 pppd[2774]: Peer russo failed CHAP Session verification
Jul 10 11:23:23 OptiPlex-760 pppd[2774]: Connection terminated.
Jul 10 11:23:23 OptiPlex-760 pppd[2774]: Exit.

然后再次运行 ifconfig -a:

mr@OptiPlex-760:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:23:ae:7d:f1:07  
          inet addr:192.168.88.249  Bcast:192.168.88.255  Mask:255.255.255.0
          inet6 addr: fe80::223:aeff:fe7d:f107/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:685 errors:0 dropped:0 overruns:0 frame:0
          TX packets:782 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:206458 (206.4 KB)  TX bytes:106269 (106.2 KB)
          Interrupt:21 Memory:febe0000-fec00000 

eth1      Link encap:Ethernet  HWaddr 60:e3:27:05:37:78  
          inet addr:192.168.1.254  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::62e3:27ff:fe05:3778/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:106 errors:0 dropped:4 overruns:0 frame:0
          TX packets:87 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9081 (9.0 KB)  TX bytes:7945 (7.9 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:409 errors:0 dropped:0 overruns:0 frame:0
          TX packets:409 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:34067 (34.0 KB)  TX bytes:34067 (34.0 KB)

mr@OptiPlex-760:~$

这是客户端的 ifconfig -a 结果:

    muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 68:b5:99:f2:b8:bc  
          inet addr:192.168.88.250  Bcast:192.168.88.255  Mask:255.255.255.0
          inet6 addr: fe80::6ab5:99ff:fef2:b8bc/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:98 errors:0 dropped:0 overruns:0 frame:0
          TX packets:212 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10413 (10.4 KB)  TX bytes:24738 (24.7 KB)
          Interrupt:20 Memory:d4700000-d4720000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:194 errors:0 dropped:0 overruns:0 frame:0
          TX packets:194 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:27708 (27.7 KB)  TX bytes:27708 (27.7 KB)

ppp0      Link encap:Point-to-Point Protocol  
          POINTOPOINT NOARP MULTICAST  MTU:1492  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:0 (0.0 B)  TX bytes:22 (22.0 B)

wlan0     Link encap:Ethernet  HWaddr 58:94:6b:55:15:04  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ 

我刚刚注意到了这一点:

当我在服务器上启动 PPPoE,然后从客户端连接时,

在服务端我得到:

mr@OptiPlex-760:~$ plog
Jul 10 11:33:05 OptiPlex-760 pppd[3257]: pppd 2.4.5 started by root, uid 0
Jul 10 11:33:05 OptiPlex-760 pppd[3257]: Using interface ppp0
Jul 10 11:33:05 OptiPlex-760 pppd[3257]: Connect: ppp0 <--> /dev/pts/10

在客户端我得到:

muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ plog
Jul 10 11:21:59 wm-HP-EliteBook-2540p pppd[4258]: CHAP authentication succeeded: Access granted
Jul 10 11:21:59 wm-HP-EliteBook-2540p pppd[4258]: CHAP authentication succeeded
Jul 10 11:21:59 wm-HP-EliteBook-2540p pppd[4258]: peer from calling number 60:E3:27:05:37:78 authorized

然后 2-3 秒后,在服务器端我得到:

mr@OptiPlex-760:~$ plog
Jul 10 11:33:18 OptiPlex-760 pppd[3257]: Peer russo failed CHAP Session verification
Jul 10 11:33:18 OptiPlex-760 pppd[3257]: Connection terminated.
Jul 10 11:33:18 OptiPlex-760 pppd[3257]: Exit.
mr@OptiPlex-760:~$

在客户端:

Jul 10 11:22:09 wm-HP-EliteBook-2540p pppd[4258]: LCP terminated by peer (Authentication failed)
Jul 10 11:22:09 wm-HP-EliteBook-2540p pppd[4258]: Modem hangup
Jul 10 11:22:09 wm-HP-EliteBook-2540p pppd[4258]: Connection terminated.
Jul 10 11:22:09 wm-HP-EliteBook-2540p pppd[4258]: Failed to disconnect PPPoE socket: 114 Operation already in progress
muhammadarifurrahman@wm-HP-EliteBook-2540p:~$ 

答案1

好的,我已通过修改 PPoE 服务器选项文件解决了该问题。现在它看起来是这样的:

auth
lcp-echo-failure 3
lcp-echo-interval 60
mtu 1482
mru 1482
require-chap
ms-dns 8.8.8.8
ms-dns 8.8.4.4
netmask 255.255.255.0
defaultroute
noipdefault
usepeerdns

并且一切都运行正常。

答案2

这是您的错误:“7 月 10 日 08:55:06 OptiPlex-760 pppd[4644]: Peer russo 未通过 CHAP 会话验证” - 客户端上的用户/密码设置正确吗?您在服务器名称中输入了什么吗?您应该有一个 *,这样它就可以连接到任何服务器。

相关内容