openvpn太烦,而且还要在Windows安装openvpn客户端,太烦。忽略。现在采用PPTP来实现。
系统版本查看

1
2
3
#cat /etc/issue
CentOS release 5.6 (Final)
Kernel \r on an \m

检查内核是否包含mppe,因为如果没有mppe模块,则PPTP是无法建立成功的。顺便说一下,只有XEN的VPS服务器是基本上有的。OPENVZ的服务器是基本上不支持的。如果你是OPENVZ服务器的,绕过吧。

1
modprobe ppp-compress-18 && echo ok

软件需要PPTP与Iptables支持,如果您的系统已经安装Iptables,则忽略。

1
yum install -y ppp iptables

然后去下载PPTPD程序

1
2
3
cd tmp
wget -c http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.3.4-2.rhel5.x86_64.rpm
rpm -ivh pptpd-1.3.4-2.rhel5.x86_64.rpm

到这里,支持软件安装完成,剩下配置的内容了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
nano /etc/ppp/options.pptpd
------------
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
ms-dns 208.67.222.222
ms-dns 208.67.220.220
 
nano /etc/pptpd.conf
----
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.8.1
remoteip 192.168.8.2-40
 
nano /etc/ppp/chap-secrets
----
username1 pptpd password1 *
 
nano /etc/sysctl.conf
----
net.ipv4.ip_forward = 1
 
sysctl -p

启动服务及配置

1
2
3
4
5
6
7
8
9
10
service pptpd start
service iptables start
iptables -A INPUT -p tcp --dport 1723 -j ACCEPT
iptables -A INPUT -p tcp --dport 47 -j ACCEPT
iptables -A INPUT -p gre -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.8.0/24 -o eth0 -j MASQUERADE
/etc/init.d/iptables save
/etc/init.d/iptables restart
chkconfig pptpd on
chkconfig iptables on

Linux下的环境配置完成
在Windows下创建VPN连接吧。拨号成功后,使用Ipconfig查看。

1
2
3
4
5
6
PPP 适配器 cnhup.net:
 
   连接特定的 DNS 后缀 . . . . . . . :
   IPv4 地址 . . . . . . . . . . . . : 192.168.8.2
   子网掩码  . . . . . . . . . . . . : 255.255.255.255
   默认网关. . . . . . . . . . . . . : 0.0.0.0

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2012 客家缘分小筑 Suffusion theme by Sayontan Sinha