知识共享许可协议
本作品采用知识共享署名-非商业性使用-禁止演绎 3.0 未本地化版本许可协议进行许可。

更新源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -Uvh http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

yum makecache
yum update
安装 pptpd
yum install pptpd -y
配置
  • pptpd.conf

    vim /etc/pptpd.conf 在最后面增加
    
    option /etc/ppp/options.pptpd
    logwtmp
    
    localip 192.168.0.1
    remoteip 192.168.0.2-254
    
  • pptpd-options

    vim /etc/ppp/options.pptpd
    
    name pptpd
    
    refuse-pap
    refuse-chap
    refuse-mschap
    
    require-mschap-v2
    
    require-mppe-128
    
    ms-dns 8.8.8.8
    ms-dns 8.8.4.4
    
    proxyarp
    
    debug
    
    dump
    
    lock
    
    nobsdcomp
    
    novj
    novjccomp
    
    nologfd
    
  • chap-secrets

    增加用户
    vim /etc/ppp/chap-secrets
    
    nate * test *
    
  • 开启转发

    sed -i 's/^\(net.ipv4.ip_forward =\).*/\1 1/' /etc/sysctl.conf; sysctl -p 
    
  • 防火墙

    iptables --flush POSTROUTING --table nat
    iptables --flush FORWARD
    iptables -I INPUT -p tcp -m tcp --dport 1723 -j ACCEPT
    iptables -I INPUT -p gre -j ACCEPT
    iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth0 -j MASQUERADE
    service iptables save
    service iptables restart
    
启动
/etc/init.d/pptpd start
重启
/etc/init.d/pptpd restart