http://www.revsys.com/writings/quicktips/nat.html

 

https://www.alibabacloud.com/zh/product/nat?spm=a3c0i.7919406.692950.dznavproductsc3.143733e26UobLQ

echo 1 > /proc/sys/net/ipv4/ip_forward

Then you'll need to configure iptables to forward the packets from your internal network, on /dev/eth1, to your external network on /dev/eth0. You do this will the following commands:

# /sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
# /sbin/iptables -A FORWARD -i eth0 -o eth1 -m state
   --state RELATED,ESTABLISHED -j ACCEPT
# /sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT
posted on 2017-10-17 13:50  heidsoft  阅读(291)  评论(0编辑  收藏  举报