linux iptables 公网、网关做DNAT
192.168.18.230 <-------> 192.168.18.130 192.168.11.130 <-------> 192.168.11.131
iptables -t nat -A PREROUTING -p tcp -d 192.168.18.130 --dport 2222 -j DNAT --to 192.168.11.131:22 iptables -t nat -A POSTROUTING -s 192.168.11.131 -p tcp --sport 22 -j SNAT --to-source 192.168.18.130 iptables -t nat -A PREROUTING -p tcp -d 192.168.18.130 --dport 80 -j DNAT --to 192.168.11.131:80 iptables -t nat -A POSTROUTING -s 192.168.11.131 -p tcp --sport 80 -j SNAT --to-source 192.168.18.130
时间: 2024-10-19 06:16:37