Loading... ```shell #关闭 systemctl stop firewalld #取消开机启动 systemctl disable firewalld #安装iptables yum install -y iptables-services #开启防火墙 service iptables start #设置开机启动 systemctl enable iptables.service #编辑iptables vi /etc/sysconfig/iptables #重启防火墙 service iptables restart #查看状态 service iptables status ``` ```shell #规则示例 允许访问端口9999 8888 80 443 5443 6443 2233,仅允许1.60.1.1和1.61整段访问端口6886,其它IP禁止访问。 -A INPUT -s 1.60.1.1/32 -p tcp -m tcp --dport 6886 -m comment --comment zkx -j ACCEPT -A INPUT -s 1.61.0.0/16 -p tcp -m tcp --dport 6886 -m comment --comment zkx -j ACCEPT -A INPUT -p tcp -m tcp --dport 6886 -j DROP -A INPUT -p tcp -m tcp --dport 9999 -j ACCEPT -A INPUT -p tcp -m tcp --dport 8888 -j ACCEPT -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 5443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 6443 -j ACCEPT -A INPUT -p tcp -m tcp --dport 2233 -j ACCEPT ``` Last modification:January 10th, 2021 at 02:01 am © 允许规范转载 Support 如果觉得我的文章对你有用,请随意赞赏 ×Close Appreciate the author Sweeping payments Pay by AliPay Pay by WeChat