使用centos 进行流量转发
首先
firewall-cmd –query-masquerade # 检查是否允许伪装IP
firewall-cmd –add-masquerade # 允许防火墙伪装IP
firewall-cmd –remove-masquerade# 禁止防火墙伪装IP
firewall-cmd --list-ports #查看已开放端口的列表
firewall-cmd –list-forward-ports #查看转发的端口列表
firewall-cmd –remove-forward-port=port=3001:proto=tcp:toport=3001:toaddr=192.168.1.1 #删除转发
然后开搞
# 将80端口的流量转发至8080
firewall-cmd –add-forward-port=port=80:proto=tcp:toport=8080
# 将80端口的流量转发至
firewall-cmd –add-forward-port=port=80:proto=tcp:toaddr=192.168.1.0.1192.168.0.1
# 将80端口的流量转发至192.168.0.1的8080端口
firewall-cmd –add-forward-port=port=80:proto=tcp:toaddr=192.168.0.1:toport=8080