xglys 发表于 2019-2-15 14:30:55

centos7.3 连接***

  windows和手机连接***很常用,今天有需求在centos下面连接***;

  步骤很简单:
  1.yum install ppp pptp pptp-setup
  2. pptpsetup --create --server--username--password[--start]
  必填,[]可选
  比如:pptpsetup --create *** server 111.111.111.111--username abc --password *** –start
   3.关闭:killall pppd
   4.启用:pppd call
  
  但是没连上***,查看日志:
  tail -100f /var/log/messages|grep ppp
  
  Nov 19 15:23:09 151test pppd: pppd 2.4.5 started by root, uid 0
  Nov 19 15:23:09 151test pppd: Using interface ppp0
  Nov 19 15:23:09 151test pppd: Connect: ppp0/dev/pts/0
  Nov 19 15:23:09 151test NetworkManager:    manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/6)
  Nov 19 15:23:12 151test pppd: EAP: peer reports authentication failure
  Nov 19 15:23:12 151test pppd: Connection terminated.
  Nov 19 15:23:12 151test pptp: anon warn: pppd may have shutdown, see pppd log
  Nov 19 15:23:12 151test pppd: Exit.
  
  
  vi /etc/ppp/options   不是 options.pptp,默认里面是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: pppd 2.4.5 started by root, uid 0
  Nov 19 15:43:58 151test pppd: Using interface ppp0
  Nov 19 15:43:58 151test pppd: Connect: ppp0/dev/pts/2
  Nov 19 15:43:58 151test NetworkManager:    manager: (ppp0): new Generic device (/org/freedesktop/NetworkManager/Devices/9)
  Nov 19 15:44:02 151test pppd: CHAP authentication succeeded
  Nov 19 15:44:02 151test pppd: MPPE 128-bit stateless compression enabled
  Nov 19 15:44:05 151test pppd: localIP address 172.18.18.13
  
  Ok,至此***连到服务器了,但是上网没走***,还是有问题:
      # ip a |grep ppp
     9: ppp0: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

# route -n
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的路由设为:将所有对外网络都通过ppp0路由:
  # 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
  
  然后再试试应该ok了。
  PS:网上的解决方案;
  
若错误为:
MPPE required but peer negotiation failed
说明服务端不支持MPPE加密,pptpsetup时不需要使用—encrypt选项。可以手工修改/etc/ppp/peers/codelife文件
# vim /etc/ppp/peers/codelife
去除或者注释掉require-mppe-128

若错误为:
LCP terminated by peer (MPPE required but peer refused)
说明服务端要求MPPE加密,但是客户端不支持,pptpsetup时漏掉了—encrypt选项。解决方法正好相反,往/etc/ppp/peers/codelife文件添加一行require-mppe-128


  





页: [1]
查看完整版本: centos7.3 连接***