環境:macos mojave 10.14.6
嘗試的解決方案:
-
mac自帶vpn 結論:已經不支持pptp協議
-
使用shimo 結論:無用,連接的時候沒反應
-
為了解決不能連接的問題,某老外寫的pptp連接工具 結論:無用,報錯信息和下一步腳本執行結果一樣
-
實用pppd,步驟如下:
1)進入 /etc/ppp/peers/ 目錄,創建 test.vpn,此文件名自己取;
2)寫入以下內容,根據需要修改;
plugin PPTP.ppp noauth remoteaddress "------VPN server name or IP address------" user "------VPN username------" password "------VPN password------" redialcount 1 redialtimer 5 idle 1800 # mru 1368 # mtu 1368 receive-all novj 0:0 ipcp-accept-local ipcp-accept-remote refuse-eap refuse-pap refuse-chap-md5 hide-password mppe-stateless mppe-128 # require-mppe-128 looplocal nodetach ms-dns 8.8.8.8 usepeerdns # ipparam gwvpn defaultroute debug
3)運行sudo pppd call test.vpn
結論:出錯,結果如下:
Sat Feb 29 11:24:47 2020 : publish_entry SCDSet() failed: Success!
Sat Feb 29 11:24:47 2020 : publish_entry SCDSet() failed: Success!
Sat Feb 29 11:24:47 2020 : PPTP connecting to server 'xxx.xxx.xxx.xxx' (xxx.xxx.xxx.xxx)...
Sat Feb 29 11:24:48 2020 : PPTP connection established.
Sat Feb 29 11:24:48 2020 : PPTP set port-mapping for en0, interface: 9, protocol: 0, privatePort: 0
Sat Feb 29 11:24:48 2020 : using link 0
Sat Feb 29 11:24:48 2020 : Using interface ppp0
Sat Feb 29 11:24:48 2020 : Connect: ppp0 <--> socket[34:17]
Sat Feb 29 11:24:48 2020 : sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x60725c7f>]
Sat Feb 29 11:24:51 2020 : rcvd [LCP ConfReq id=0x1 <asyncmap 0x0><magic 0x90775e6> ]
Sat Feb 29 11:24:51 2020 : lcp_reqci: returning CONFACK.
Sat Feb 29 11:24:51 2020 : sent [LCP ConfAck id=0x1 <asyncmap 0x0><magic 0x90775e6> ]
Sat Feb 29 11:24:51 2020 : sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x60725c7f>]
Sat Feb 29 11:24:51 2020 : rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x60725c7f>]
Sat Feb 29 11:24:51 2020 : rcvd [CHAP Challenge id=0xf9 <4a44a223bded3c174d9524e514b7b186>, name = "pptpd"]
Sat Feb 29 11:24:51 2020 : sent [CHAP Response id=0xf9 <7fa23ba608c73e19030ab3ac356541de00000000000044442b41d5fa9f4034e4ba1cf873502c4e3e4ca4d86752c1994800>, name = "xx"]
Sat Feb 29 11:24:51 2020 : rcvd [LCP ConfReq id=0x2 <asyncmap 0x0><magic 0x241bc6d7> ]
Sat Feb 29 11:24:51 2020 : sent [LCP ConfReq id=0x2 <asyncmap 0x0> <magic 0x330e8a78>]
Sat Feb 29 11:24:51 2020 : lcp_reqci: returning CONFACK.
Sat Feb 29 11:24:51 2020 : sent [LCP ConfAck id=0x2 <asyncmap 0x0><magic 0x241bc6d7> ]
Sat Feb 29 11:24:51 2020 : rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x60725c7f>]
Sat Feb 29 11:24:51 2020 : rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <magic 0x330e8a78>]
Sat Feb 29 11:24:51 2020 : rcvd [CHAP Challenge id=0xf1 <7152e60444448f03c00d77bc4f4f85e7>, name = "pptpd"]
Sat Feb 29 11:24:51 2020 : sent [CHAP Response id=0xf1 <67c6ba6d36b2fcf0f07d2b24d38a13db000000000000000099b744446dee24113587aab45c859bc033099f424d94e50400>, name = "xx"]
Sat Feb 29 11:24:51 2020 : rcvd [CHAP Success id=0xf1 "S=21E481AFF77DB980039418F738D7749C6A4C590A M=Access granted"]
Sat Feb 29 11:24:51 2020 : sent [CCP ConfReq id=0x1 <mppe +H -M +S -L -D -C>]
Sat Feb 29 11:24:51 2020 : rcvd [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
Sat Feb 29 11:24:51 2020 : MPPE required but peer negotiation failed
Sat Feb 29 11:24:51 2020 : sent [LCP TermReq id=0x3 "MPPE required but peer negotiation failed"]
Sat Feb 29 11:24:51 2020 : Connection terminated.
Sat Feb 29 11:24:51 2020 : sent [CCP ConfRej id=0x1 <deflate 15> <deflate(old#) 15>]
Sat Feb 29 11:24:51 2020 : PPTP disconnecting...
Sat Feb 29 11:24:51 2020 : PPTP clearing port-mapping for en0
Sat Feb 29 11:24:51 2020 : PPTP disconnected可以發現,報錯信息在這里:
MPPE required but peer negotiation failed
多方搜索無果,只能靠自己了......
再次打開 test.vpn 配置文件,我發現了其中關於 mmpe 的部分:
mppe-stateless mppe-128 # require-mppe-128
發現問題所在了嗎?我搜索到的所有教我配置pppd配置文件中的內容都是這樣,但是報錯卻提示“MPPE required but peer negotiation failed”,因此,我嘗試將另外兩行和mmpe相關的配置行注釋掉,結果如下:
# mppe-stateless # mppe-128 # require-mppe-128
再次執行 sudo pppd call test.vpn,錯誤解決,運行成功!!
如圖,運行成功后,最下面兩行是這樣: