1.安装iptables-services
systemctl stop firewalld systemctl mask firewalld yum install iptables-services systemctl enable iptables systemctl restart iptables
2.配置规则
将 10.129.4.96:5901 端口映射到 10.129.4.90:5911
iptables -t nat -A PREROUTING --dst 10.129.4.90 -p tcp --dport 5911 -j DNAT --to-destination 10.129.4.96:5901 iptables -t nat -A POSTROUTING --dst 10.129.4.96 -p tcp --dport 5901 -j SNAT --to-source 10.129.4.90
3.保存配置
service iptables save