SSPanel Uim端口偏移(后端) Firewall流量转发

2019-11-19T02:12:00

后端偏移很简单,就是转发流量即可。Centos7默认是firewall防火墙,Centos6是iptables。

首先启动防火墙

systemctl start firewalld

然后是设置它开机启动

systemctl enable firewalld

首先开启路由转发,编辑文件/etc/sysctl.conf
在最后加上这一行代码

net.ipv4.ip_forward = 1

然后执行sysctl -p使其生效。

然后开启防火墙流量伪装功能

firewall-cmd --zone=public --permanent --add-masquerade

之后开放你的端口,比如你单端口80,偏移10之后是90,那就开放90端口

firewall-cmd --add-port=90/tcp --permanent
firewall-cmd --add-port=90/udp --permanent

然后把90端口流量转发到80去

firewall-cmd --add-forward-port=port=90:proto=tcp:toport=80 --permanent
firewall-cmd --add-forward-port=port=90:proto=udp:toport=80 --permanent

最后重新加载防火墙配置文件使其生效

firewall-cmd --reload

也可直接修改防火墙配置文件,文件位置在/etc/firewalld/zones/public.xml

效果如下图:

修改配置文件同样也需要重新加载配置文件才能生效。

当前页面是本站的「Baidu MIP」版。发表评论请点击:完整版 »