iptables nat 端口映射转发

作者: dreamfly 分类: 未分类 发布时间: 2018-07-21 23:35
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE


//所有从eth0(外网卡)出来的数据包的源地址改成61.99.28.1
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o eth0 -j SNAT --to 61.99.28.1


//将外部服务器的ip访问转到目的ip端口
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 53 -j DNAT --to-destination 1.2.3.4:53

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!