centOS搭建vpn服务器

2015-11-13 22:2

把某位大侠写的文档抄这里,免得忘记了,非常感谢此大侠。我的服务器是centOS 6.5 64位,基本按照如下设置就ok了

yum install -y ppp iptables 
yum install -y wget
yum install -y perl

wget http://poptop.sourceforge.net/yum/stable/packages/pptpd-1.4.0-1.el6.x86_64.rpm

rpm -ivh  pptpd-1.4.0-1.el6.x86_64.rpm

 


vi /etc/pptpd.conf 

localip 192.168.0.1
remoteip 192.168.0.234-238,192.168.0.245 


vi /etc/ppp/options.pptpd 

ms-dns 8.8.8.8
ms-dns 8.8.4.4 


vi /etc/ppp/chap-secrets 

vpn账号 * vpn密码 *
vpn其他账号 * vpn其他密码 *

vi /etc/sysctl.conf
net.ipv4.ip_forward=1
#net.ipv4.tcp_syncookies = 1

 

sysctl -p
iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -j SNAT --to-source 你服务器ip
 

/etc/init.d/iptables save 
/etc/init.d/iptables restart 
/etc/init.d/pptpd restart 
chkconfig --level 345 pptpd on 
chkconfig --level 345 iptables on 

 

rm /dev/ppp
mknod /dev/ppp c 108 0 

要注意的是执行过程中有没有出错,有出错要处理掉

另外附上查到的一个写的差不多,也挺好,没试应该也差不多

http://blog.csdn.net/ownfire/article/details/8051349

iptables的编辑办法在这里

打开iptables的命令为:vi /etc/sysconfig/iptables

打开后,按insert键进入编辑状态,然后找到你的内网IP,把他删掉,改成你的外网IP,再然后按ESC退出编辑模式,再:wq保存退出。最后service iptables restart重启服务即可。

点击:loading..
收藏到:中国收客网
评论