阿里云ECS搭建的PPTPVPN内网通,但无法访问外网,无法转发。

1 .清除旧规则 ,一定得记得清nat记录,不清除会越加越多。

iptables -F iptables -X iptables -t nat -F iptables -t nat -X
---查看nat: # iptables -t nat -nL
---查看 #iptables -nvL -t nat --line-numbers 

2.) /bin/iptables.sh 里的
iptables -A INPUT -p gre -j ACCEPT
iptables -A INPUT -p tcp –dport 1723 -j ACCEPT
iptables -A INPUT -p tcp –dport 47 -j ACCEPT

重点是这一条:

iptables -t nat -A POSTROUTING -s 192.168.0.0/24 -o eth1 -j SNAT --to-source x.x.x.x 

(192.168.0.0/24为VPN的网段,eth0 为外网网卡,xxxx 为外网ip )

查看PPTP的VPN网段,在/etc/pptpd.conf的文件夹下可以看到。

外网IP还用ifconfig命令以及外网网卡的名称

3.) 重启pptp的服务

posted @ 2018-05-02 09:11  阿鹏2019  阅读(515)  评论(0编辑  收藏  举报