CentOS 6 搭建VPN Server

#安装yum源,及pptpd服务

rpm -Uvh http://poptop.sourceforge.net/yum/stable/rhel6/pptp-release-current.noarch.rpm

yum install -y ppp pptpd iptables

#编辑sysctl.conf文件,打开ip包转发

vi /etc/sysctl.conf

net.ipv4.ip_forward = 1

#保存设置

/sbin/sysctl -p

#设置pptpd

vi /etc/ppp/options.pptpd

name vps

refuse-pap

refuse-chap

refuse-mschap

require-mschap-v2

require-mppe-128

proxyarp

nobsdcomp

novj

novjccomp

nologfd

ms-dns 4.2.2.1

ms-dns 4.2.2.2

#设置pptpd

vi /etc/pptpd.conf

option /etc/ppp/options.pptpd

debug

logwtmp

localip 10.10.10.1

remoteip 10.10.10.2-254

#设置iptables

iptables -t nat -F

iptables -t nat -A POSTROUTING -o eth0 -s 10.10.10.0/24 -j MASQUERADE

iptables -t nat -L -n

service iptables save

#添加到开机启动

chkconfig --level 345 pptpd on

#启动vpn server

/etc/init.d/pptpd start

#添加vpn用户名密码

vpnuser username passwd

相关推荐