- 安裝yum第三方EPEL套件庫
sudo yum install epel-release -y
清除快取
sudo yum clean all -y
更新套件庫
sudo yum update -y
- 安裝PPTP
sudo yum install ppp pptpd -y
- 備份設定擋
cp /etc/pptpd.conf /etc/pptpd.conf.bak
- 打開
/etc/pptpd.conf
,拉到最下面新增localip 10.0.10.1 remoteip 10.0.10.2-254
- 備份設定擋
cp /etc/ppp/options.pptpd /etc/ppp/options.pptpd.bak
- 搜尋
ms-dns
,將前面#去掉如下ms-dns 8.8.8.8 ms-dns 8.8.4.4
- 備份設定擋
cp /etc/sysctl.conf /etc/sysctl.conf.bak
- 將下面的設定貼上去
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
- 打開
/etc/rc.d/rc.local
,新增設定iptables -t nat -A POSTROUTING -s 10.0.10.0/24 -o eth0 -j MASQUERADE
- 設定防火牆
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
- 設定帳號密碼
/etc/ppp/chap-secrets
username pptpd password *
- 啟動pptp
service pptpd start chkconfig pptpd on
參考: