CentOS 7.X 安裝VPN PPTP

  1. 安裝yum第三方EPEL套件庫
    sudo yum install epel-release -y

    清除快取

    sudo yum clean all -y

    更新套件庫

    sudo yum update -y
  2. 安裝PPTP
    sudo yum install ppp pptpd -y

    01

  3. 備份設定擋
    cp /etc/pptpd.conf /etc/pptpd.conf.bak
  4. 打開/etc/pptpd.conf,拉到最下面新增
    localip 10.0.10.1
    remoteip 10.0.10.2-254
  5. 備份設定擋
    cp /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak
  6. 搜尋ms-dns,將前面#去掉如下
    ms-dns 8.8.8.8
    ms-dns 8.8.4.4
  7. 備份設定擋
    cp /etc/sysctl.conf /etc/sysctl.conf.bak
  8. 將下面的設定貼上去
    net.core.wmem_max = 12582912
    net.core.rmem_max = 12582912
    net.ipv4.tcp_rmem = 10240 87380 12582912
    net.ipv4.tcp_wmem = 10240 87380 12582912
    net.core.wmem_max = 12582912
    net.core.rmem_max = 12582912
    net.ipv4.tcp_rmem = 10240 87380 12582912
    net.ipv4.tcp_wmem = 10240 87380 12582912
    net.core.wmem_max = 12582912
    net.core.rmem_max = 12582912
    net.ipv4.tcp_rmem = 10240 87380 12582912
    net.ipv4.tcp_wmem = 10240 87380 12582912
    net.ipv4.ip_forward = 1
  9. 打開/etc/rc.d/rc.local,新增設定
    iptables -t nat -A POSTROUTING -s 10.0.10.0/24 -o eth0 -j MASQUERADE
  10. 設定防火牆
    firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -i eth0 -p tcp --dport 1723 -j ACCEPT
    firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -p gre -j ACCEPT
    firewall-cmd --permanent --direct --add-rule ipv4 filter POSTROUTING 0 -t nat -o eth0 -j MASQUERADE
    firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i ppp+ -o eth0 -j ACCEPT
    firewall-cmd --permanent --direct --add-rule ipv4 filter FORWARD 0 -i eth0 -o ppp+ -j ACCEPT
    firewall-cmd --reload
  11. 設定帳號密碼/etc/ppp/chap-secrets
    username pptpd password *
  12. 啟動pptp
    service pptpd start
    chkconfig pptpd on

參考:

  1. CentOS 7 快速部署 PPTP VPN 服務
  2. Setup PPTP Server on CentOS


這裡的資訊對您有用嗎?歡迎斗內給我