首页 > 代码库 > 多ip pptp
多ip pptp
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
安装 ppp 和pptpd 两个包
yum -y install ppp ppp-devel pptpd
service pptpd restart
kill pptpd
cp /etc/pptpd.conf /etc/pptpd1.conf
cp /etc/pptpd.conf /etc/pptpd2.conf
pptpd1.conf
localip 172.16.36.1
remoteip 172.16.36.2-10
listen 103.233.251.74
pptpd2.conf
localip 172.16.36.1
remoteip 172.16.36.2-10
listen 103.233.251.74
增加dns
vim /etc/ppp/options.pptpd
ms-dns 8.8.8.8
ms-dns 8.8.4.4
开启nat
vim /etc/sysctl.conf
打开转发
net.ipv4.ip_forward = 1 #这里的0 改为1
sysctl -p
配置账号密码
# Secrets for authentication using CHAP
# client server secret IP addresses
admin pptpd 1qaz@WSX 172.16.36.2
admin pptpd 1qaz@WSX 172.16.37.2
启动pptpd
pptpd -c /etc/pptpd/pptpd1.conf
pptpd -c /etc/pptpd/pptpd2.conf
pptp按来源进去nat
/etc/sysconfig/iptables
# Generated by iptables-save v1.4.7 on Mon Sep 12 00:24:05 2016
*nat
:PREROUTING ACCEPT [16858:1077746]
:POSTROUTING ACCEPT [2493:168701]
:OUTPUT ACCEPT [1950:141032]
-A POSTROUTING -s 172.16.36.0/24 -j SNAT --to-source 103.233.251.74
-A POSTROUTING -s 172.16.37.0/24 -j SNAT --to-source 103.233.251.75
COMMIT
# Completed on Mon Sep 12 00:24:05 2016
# Generated by iptables-save v1.4.7 on Mon Sep 12 00:24:05 2016
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [52131:6533886]
:RH-Firewall-1-INPUT - [0:0]
-A INPUT -p gre -j ACCEPT
-A INPUT -j RH-Firewall-1-INPUT
-A FORWARD -j RH-Firewall-1-INPUT
-A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -s 172.16.36.0/24 -d 103.233.251.0/24 -j ACCEPT
-A FORWARD -s 172.16.37.0/24 -d 103.233.251.0/24 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 1723 -j ACCEPT
-A RH-Firewall-1-INPUT -i lo -j ACCEPT
-A RH-Firewall-1-INPUT -p icmp -m icmp --icmp-type any -j ACCEPT
-A RH-Firewall-1-INPUT -p esp -j ACCEPT
-A RH-Firewall-1-INPUT -p ah -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 47 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT
-A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
COMMIT
# Completed on Mon Sep 12 00:24:05 2016
多ip pptp