centos pptp 客户端 连接***


1,安装ppp pptp pptp-setup

# yum -y install ppp pptp pptp-setup  


2,创建×××连接

# pptpsetup --create test --server ip --username test --password test --start

建立配置文件后在配置文件test最后增加如下配置

# [root@localhost ~]# cd /etc/ppp/peers/

refuse-pap

refuse-chap

refuse-eap

refuse-mschap


如果报以下错误:

FATAL: Module ppp_mppe not found.  

/usr/sbin/pptpsetup: couldn't find MPPE support in kernel.  

解决方法:

# modprobe ppp_mppe  


3,连接×××连接

[root@localhost peers]# pppd call test  //这里的test是上面创建***连接名称


如果报以下错误:

Using interface ppp0  

Connect: ppp0 <--> /dev/pts/3  

CHAP authentication succeeded  

LCP terminated by peer (MPPE required but peer refused)  

Modem hangup  


解决方法:

# vim /etc/ppp/peers/test  //test是上面创建的连接  

 文件尾部,加上以下内容  

require-mppe-128  


成功后会多出一个虚拟网口ppp0,并且用ifconfig也可以看到

[root@localhost home]# ifconfig

eth0      Link encap:Ethernet  HWaddr A2:9E:0D:5A:75:FB  

          inet addr:113.106.99.72  Bcast:113.106.99.127  Mask:255.255.255.192

          inet6 addr: fe80::a09e:dff:fe5a:75fb/64 Scope:Link

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:58010 errors:0 dropped:0 overruns:0 frame:0

          TX packets:20893 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000 

          RX bytes:4557960 (4.3 MiB)  TX bytes:3357057 (3.2 MiB)

          Interrupt:23 


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:1 errors:0 dropped:0 overruns:0 frame:0

          TX packets:1 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0 

          RX bytes:28 (28.0 b)  TX bytes:28 (28.0 b)


ppp0      Link encap:Point-to-Point Protocol  

          inet addr:192.168.99.103  P-t-P:192.168.99.100  Mask:255.255.255.255

          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1396  Metric:1

          RX packets:10 errors:0 dropped:0 overruns:0 frame:0

          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:3 

          RX bytes:236 (236.0 b)  TX bytes:80 (80.0 b)


[root@localhost home]# 


4,添加默认路由

/** 

 *这里有三个IP 

 *113.106.99.75:公网IP 

 *192.168.99.1:局域网网关 

 *192.168.99.103:本机的局域网IP 

 */  

[root@localhost peers]# ip route replace 113.106.99.75 via 192.168.99.1 dev eth0 src 192.168.99.103  

  

[root@localhost peers]# ip route replace default dev ppp0  

  

[root@localhost peers]#  route  

[root@localhost ~]# route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

113.106.99.75   192.168.99.1         255.255.255.255 UH    0      0        0 eth0

192.168.99.100  0.0.0.0         255.255.255.255 UH    0      0        0 ppp0

113.106.99.64   0.0.0.0         255.255.255.192 U     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     U     1002   0        0 eth0

0.0.0.0         113.106.99.65   0.0.0.0         UG    0      0        0 eth0

[root@localhost ~]# 

到这儿×××就设置好了,如果还上不了外网,就是DNS的问题了

5,dns修改

# vim /etc/resolv.conf  

nameserver 8.8.8.8  

nameserver 8.8.4.4  

6,断开***连接,只需注销这pppd进程即可

[root@localhost peers]# killall pppd