Ubuntu

無法連接到 PPTP VPN

  • March 15, 2016

我在閒置的備用 Ubuntu 15.10 桌面上使用 PPTPD 設置了一個 PPTP VPN 伺服器(不安全,我知道,但這項工作主要是一種學習體驗),但無法從 Linux 或 Windows 連接到它。當我嘗試從 Antergos 機器連接時,我從網路管理器獲得以下輸出:

Mar 15 10:21:14 mblasco-XPS NetworkManager[377]: <info>  Starting VPN service 'pptp'...
Mar 15 10:21:14 mblasco-XPS NetworkManager[377]: <info>  VPN service 'pptp' started (org.freedesktop.NetworkManager.pptp), PID 2903
Mar 15 10:21:14 mblasco-XPS NetworkManager[377]: <info>  VPN service 'pptp' appeared; activating connections
Mar 15 10:21:14 mblasco-XPS NetworkManager[377]: <info>  VPN plugin state changed: init (1)
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: <info>  VPN connection 'HawkHouse' (ConnectInteractive) reply received.
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: <info>  VPN plugin state changed: starting (3)
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: ** Message: pppd started with pid 2910
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: <info>  VPN connection 'HawkHouse' (Connect) reply received.
Mar 15 10:21:15 mblasco-XPS pppd[2910]: Plugin /usr/lib/pppd/2.4.7/nm-pptp-pppd-plugin.so loaded.
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: Plugin /usr/lib/pppd/2.4.7/nm-pptp-pppd-plugin.so loaded.
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (plugin_init): initializing
Mar 15 10:21:15 mblasco-XPS pppd[2910]: pppd 2.4.7 started by root, uid 0
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection'
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: <info>  (ppp0): new Generic device (carrier: UNKNOWN, driver: 'unknown', ifindex: 16)
Mar 15 10:21:15 mblasco-XPS pppd[2910]: Using interface ppp0
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: Using interface ppp0
Mar 15 10:21:15 mblasco-XPS pppd[2910]: Connect: ppp0 <--> /dev/pts/1
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: Connect: ppp0 <--> /dev/pts/1
Mar 15 10:21:15 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 5 / phase 'establish'
Mar 15 10:21:15 mblasco-XPS pptp[2912]: nm-pptp-service-2903 log[main:pptp.c:333]: The synchronous pptp option is NOT activated
Mar 15 10:21:15 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_rep:pptp_ctrl.c:258]: Sent control packet type is 1 'Start-Control-Connection-Request'
Mar 15 10:21:15 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_disp:pptp_ctrl.c:758]: Received Start Control Connection Reply
Mar 15 10:21:15 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_disp:pptp_ctrl.c:792]: Client connection established.
Mar 15 10:21:16 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_rep:pptp_ctrl.c:258]: Sent control packet type is 7 'Outgoing-Call-Request'
Mar 15 10:21:16 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_disp:pptp_ctrl.c:877]: Received Outgoing Call Reply.
Mar 15 10:21:16 mblasco-XPS pptp[2922]: nm-pptp-service-2903 log[ctrlp_disp:pptp_ctrl.c:916]: Outgoing call established (call ID 0, peer's call ID 11).
Mar 15 10:21:16 mblasco-XPS pppd[2910]: Modem hangup
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: Modem hangup
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect'
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: Connection terminated.
Mar 15 10:21:16 mblasco-XPS pppd[2910]: Connection terminated.
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <warn>  (ppp0): failed to disable userspace IPv6LL address handling
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <warn>  VPN plugin failed: connect-failed (1)
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (nm_phasechange): status 1 / phase 'dead'
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: ** Message: nm-pptp-ppp-plugin: (nm_exit_notify): cleaning up
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: ** (nm-pptp-service:2903): WARNING **: pppd exited with error code 16
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <warn>  VPN plugin failed: connect-failed (1)
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <warn>  VPN plugin failed: connect-failed (1)
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <info>  VPN plugin state changed: stopped (6)
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <info>  VPN plugin state change reason: unknown (0)
Mar 15 10:21:16 mblasco-XPS NetworkManager[377]: <warn>  error disconnecting VPN: Could not process the request because no VPN connection was active.

我以前在 Antergos 機器上使用相同的配置,但我似乎無法讓它在 Ubuntu 下執行。

我將路由器配置為將埠 1723 轉發到 Ubuntu 桌面,從上面的連接日誌中可以看出,它確實通過並開始與伺服器通信,但隨後斷開連接。

以下是託管 VPN 的 Ubuntu 伺服器上的 iptables 規則:

Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     gre  --  anywhere             anywhere            
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:1723 state NEW

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
TCPMSS     tcp  --  192.168.1.0/24       anywhere             tcp flags:SYN,RST/SYN TCPMSS clamp to PMTU
ACCEPT     gre  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination

有什麼見解嗎?提前致謝!

至少不能在 Ubuntu 15.04 上開箱即用

Mar 15 22:02:24 ubuntu1504 pptpd[5517]: /usr/sbin/pppd: Plugin /usr/lib/pptpd/pptpd-logwtmp.so is for pppd version 2.4.5, this is 2.4.6
Mar 15 22:02:24 ubuntu1504 pppd[5524]: Plugin /usr/lib/pptpd/pptpd-logwtmp.so is for pppd version 2.4.5, this is 2.4.6
Mar 15 22:02:24 ubuntu1504 pptpd[5523]: GRE: read(fd=6,buffer=55c41d7ed4a0,len=8196) from PTY failed: status = -1 error = Input/output error, usually caused by unexpected termination of pppd, check option syntax and pppd logs
Mar 15 22:02:24 ubuntu1504 pptpd[5523]: CTRL: PTY read or GRE write failed (pty,gre)=(6,7)
Mar 15 22:02:24 ubuntu1504 pptpd[5523]: CTRL: Reaping child PPP[5524]
Mar 15 22:02:24 ubuntu1504 pptpd[5523]: CTRL: Client 192.168.1.7 control connection finished
Mar 15 22:02:24 ubuntu1504 pptpd[5523]: CTRL: Exiting now

也許您應該在 /etc/pptpd.conf 中註釋行logwtmp並重新啟動服務。

# systemctl restart pptpd

從 VPN 伺服器登錄

Mar 15 22:08:05 ubuntu1504 pptpd[5650]: MGR: Manager process started
Mar 15 22:08:05 ubuntu1504 pptpd[5650]: MGR: Maximum of 41 connections available
Mar 15 22:08:11 ubuntu1504 pptpd[5652]: CTRL: Client 192.168.1.7 control connection started
Mar 15 22:08:11 ubuntu1504 pptpd[5652]: CTRL: Starting call (launching pppd, opening GRE)
Mar 15 22:08:11 ubuntu1504 pppd[5653]: pppd 2.4.6 started by root, uid 0
Mar 15 22:08:11 ubuntu1504 pppd[5653]: Using interface ppp0
Mar 15 22:08:11 ubuntu1504 pppd[5653]: Connect: ppp0 <--> /dev/pts/0
Mar 15 22:08:11 ubuntu1504 systemd[1]: Started ifup for ppp0.
Mar 15 22:08:11 ubuntu1504 systemd[1]: Starting ifup for ppp0...
Mar 15 22:08:11 ubuntu1504 sh[5657]: Unknown interface ppp0
Mar 15 22:08:14 ubuntu1504 pppd[5653]: peer from calling number 192.168.1.7 authorized
Mar 15 22:08:14 ubuntu1504 pppd[5653]: MPPE 128-bit stateless compression enabled
Mar 15 22:08:15 ubuntu1504 pppd[5653]: Cannot determine ethernet address for proxy ARP
Mar 15 22:08:15 ubuntu1504 pppd[5653]: local  IP address 192.168.100.1
Mar 15 22:08:15 ubuntu1504 pppd[5653]: remote IP address 192.168.100.200

經過此修改後,我可以成功地從 windows 7 框連接到伺服器

在此處輸入圖像描述

引用自:https://serverfault.com/questions/763855