centos7.3 連接***

windows和手機(jī)連接***很常用,今天有需求在centos下面連接***;

步驟很簡單:

1.yum install ppp pptp pptp-setup

2. pptpsetup?--create<定義的名稱> --server<服務(wù)器>??--username <用戶名> --password <密碼> [--start]

<>必填,[]可選

比如:pptpsetup --create *** server 111.111.111.111? --username abc --password *** –start

3.關(guān)閉:killall pppd

4.啟用:pppd call


但是沒連上***,查看日志:

tail -100f /var/log/messages|grep ppp


Nov 19 15:23:09 151test pppd[8613]: pppd 2.4.5 started by root, uid 0

Nov 19 15:23:09 151test pppd[8613]: Using interface ppp0

Nov 19 15:23:09 151test pppd[8613]: Connect: ppp0 <--> /dev/pts/0

Nov 19 15:23:09 151test NetworkManager[704]: <info>? [1542612189.0159] manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/6)

Nov 19 15:23:12 151test pppd[8613]: EAP: peer reports authentication failure

Nov 19 15:23:12 151test pppd[8613]: Connection terminated.

Nov 19 15:23:12 151test pptp[8614]: anon warn[decaps_hdlc:pptp_gre.c:229]: pppd may have shutdown, see pppd log

Nov 19 15:23:12 151test pppd[8613]: Exit.



vi /etc/ppp/options?不是options.pptp,默認(rèn)里面是lock,刪除lock添加以下配置:


refuse-pap

refuse-eap

refuse-chap

refuse-mschap

require-mppe


再啟動試試:

pppd call ***


tail -100f /var/log/messages|grep ppp

Nov 19 15:43:58 151test pppd[8871]: pppd 2.4.5 started by root, uid 0

Nov 19 15:43:58 151test pppd[8871]: Using interface ppp0

Nov 19 15:43:58 151test pppd[8871]: Connect: ppp0 <--> /dev/pts/2

Nov 19 15:43:58 151test NetworkManager[704]: <info>? [1542613438.8796] manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/9)

Nov 19 15:44:02 151test pppd[8871]: CHAP authentication succeeded

Nov 19 15:44:02 151test pppd[8871]: MPPE 128-bit stateless compression enabled

Nov 19 15:44:05 151test pppd[8871]: local? IP address 172.18.18.13


Ok,至此***連到服務(wù)器了,但是上網(wǎng)沒走***,還是有問題:

? ? [root@151test log]# ip a |grep ppp

? ? ?9: ppp0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1396 qdisc pfifo_fast state UNKNOWN qlen 3

??? link/ppp

inet 172.18.18.13 peer 172.18.18.10/32 scope global ppp0


[root@151test log]# route -n? 小程序開發(fā)找上海捌躍網(wǎng)絡(luò)科技有限公司

Kernel IP routing table

Destination???? Gateway???????? Genmask???????? Flags Metric Ref??? Use Iface

0.0.0.0???????? 192.168.1.1???? 0.0.0.0???????? UG??? 100??? 0??????? 0 ens33

111.111.111.111? ? 192.168.1.1???? 255.255.255.255 UGH?? 0????? 0??????? 0 ens33

172.17.0.0????? 0.0.0.0???????? 255.255.0.0???? U???? 0????? 0??????? 0 docker0

172.18.18.10??? 0.0.0.0???????? 255.255.255.255 UH??? 0????? 0??????? 0 ppp0

172.18.18.13??? 0.0.0.0???????? 255.255.255.255 UH??? 0????? 0??????? 0 ppp0

192.168.1.0???? 0.0.0.0???????? 255.255.255.0?? U???? 100??? 0??????? 0 ens33


這里需要將ppp0的路由設(shè)為:將所有對外網(wǎng)絡(luò)都通過ppp0路由:

[root@151test log]# route add -net 0.0.0.0 dev ppp0

?route -n

Kernel IP routing table

Destination???? Gateway???????? Genmask???????? Flags Metric Ref??? Use Iface

0.0.0.0???????? 0.0.0.0???????? 0.0.0.0???????? U???? 0????? 0??????? 0 ppp0

0.0.0.0???????? 192.168.1.1???? 0.0.0.0???????? UG??? 100??? 0??????? 0 ens33

111.111.111.111? ? 192.168.1.1???? 255.255.255.255 UGH?? 0????? 0??????? 0 ens33

172.17.0.0????? 0.0.0.0???????? 255.255.0.0???? U???? 0????? 0??????? 0 docker0

172.18.18.10??? 0.0.0.0???????? 255.255.255.255 UH??? 0????? 0??????? 0 ppp0

172.18.18.13??? 0.0.0.0???????? 255.255.255.255 UH??? 0????? 0??????? 0 ppp0

192.168.1.0???? 0.0.0.0???????? 255.255.255.0?? U???? 100??? 0??????? 0 ens33


然后再試試應(yīng)該ok了。

PS:網(wǎng)上的解決方案;

若錯(cuò)誤為:

MPPE required but peer negotiation failed

說明服務(wù)端不支持MPPE加密,pptpsetup時(shí)不需要使用—encrypt選項(xiàng)??梢允止ば薷?etc/ppp/peers/codelife文件

# vim /etc/ppp/peers/codelife

去除或者注釋掉require-mppe-128


若錯(cuò)誤為:

LCP terminated by peer (MPPE required but peer refused)

說明服務(wù)端要求MPPE加密,但是客戶端不支持,pptpsetup時(shí)漏掉了—encrypt選項(xiàng)。解決方法正好相反,往/etc/ppp/peers/codelife文件添加一行require-mppe-128

轉(zhuǎn)自:http://blog.51cto.com/xpu2001/2319008

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容