转发流量

wget -N –no-check-certificate https://wp.jinzz.cc/wp-content/uploads/iptables-pf.sh && chmod +x iptables-pf.sh
bash iptables-pf.sh

 

Centos开始采用Firewall,不过也是基于Iptables的基础_

Iptables

配置文件位置 /etc/sysconfig/iptables

iptables -A INPUT -p tcp –dport 22 -j ACCEPT
iptables -A OUTPUT -p tcp –sport 22 -j ACCEPT

Firewall

操作命令范例

firewall-cmd –permanent –zone=public –add-port=80/tcp //添加开放80端口
firewall-cmd –permanent –zone=public –remove-port=80/tcp //移除开放80端口

另外配置方式可以间接修改/etc/firewalld/zones/public.xml文件

firewall-cmd –permanent –zone=public –add-forward-port=port=2333:proto=tcp:toport=2333:toaddr=192.168.0.152 //端口转发
firewall-cmd –complete-reload //保存并且重新启动防火墙

启动防火墙

systemctl start firewalld.service

关闭防火墙

systemctl stop firewalld.service

重新启动防火墙

systemctl restart firewalld.service