pptp forword setting

2015年5月30日 09:04

1. 设置允许转发
sysctl -w net.ipv4.ip_forward=1 (这步一般文档都有)
2. 设置ppp0 -> eth0的跳转
iptables --insert FORWARD 1 --source 192.168.0.0/24 --destination 0.0.0.0/0.0.0.0 --jump ACCEPT

测试:

tcpdump -n -i ppp0 icmp and src host 192.168.0.234 and dst host 8.8.8.8
3. 设置Target-> eth0 的返回
iptables --table nat --append POSTROUTING --out-interface eth0 --jump MASQUERADE

测试:

tcpdump -n -i eth0 icmp and dst host 8.8.8.8
4. 设置ppp0 -> eth0 的返回
iptables --insert FORWARD 1 --source 0.0.0.0/0.0.0.0 --destination 192.168.0.0/24 --jump ACCEPT --out-interface ppp0

测试:

tcpdump -n -i eth0 icmp and src host 8.8.8.8