firewall-cmd --zone=external --add-rich-rule="rule \ family="ipv4" \ source address=192.168.168.105 \ service name=ssh reject \" rich规则详解 --add-rich-rule选项,将该规则描述为其参数。规则以rule关键字开头。 family:我们指定该规则仅应用于IPv4数据包:如果未提供此关键字,则该规则将同时应用...
firewall-cmd --direct --add-rule ipv4 filter INPUT 0 ! -s 172.25.254.250 -p tcp --dport 22 -j REJECT 6.firewalld中的NAT SNAT firewall-cmd --permanent --add-masquerade #打开地址伪装 firewall-cmd --reload #重启服务 DNAT firewall-cmd --add-forward-port=port=22:proto=tcp:toport=2...
第二条禁止同一个ip访问 [root@blog ~]# firewall-cmd --add-rich-rule='rule family="ipv4" source address="13.17.12.210" port port="22" protocol="tcp" accept'success [root@blog ~]# firewall-cmd --add-rich-rule='rule family="ipv4" source address="13.17.12.210" reject'success 列出现有...
sudo firewall-cmd --zone=<zone> --add-service=<service> --permanent sudo firewall-cmd --zone=<zone> --remove-service=<service> --permanent 7、允许或禁止单个 IP 地址 sudo firewall-cmd --zone=<zone> --add-rich-rule='rule family="ipv4" source address="<ip-address>" accept'sudo fir...
firewall-cmd --add-service={http,https}firewall-cmd --remove-service=ssh firewall-cmd --add-rich-rule='rule family=ipv4 source address=10.0.0.1/32 service name=ssh accept' 1. 2. 3. 4. 7.7、Rule场景示例4 当用户来源IP地址是10.0.0.1主机,则将用户请求的5555端口转发至后端172.16.1.9的22端...
# firewall-cmd --permanent --add-rich-rule=‘rule protocol value=icmp drop’ //禁用传统防火墙服务 # systemctl mask iptables //将服务关联到黑洞 关联后服务将无法启动 Created symlink from /etc/systemd/system/iptables.service # systemctl unmask iptables //关闭服务关联到黑洞 ...
firewall-cmd--permanent--add-rich-rule="rulefamily='ipv4'source address='192.168.72.152'port protocol='tcp'port='3306'accept" 这条命令只允许IP地址为192.168.72.152的设备访问3306端口。 7.允许指定网段访问特定端口 如果你有一个信任的村庄(网段),你可以使用: ...
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.2.100" port protocol="tcp" port="8088"accept' #重新加载防火墙配置: firewall-cmd --reload 4.3、验证规则是否生效: firewall-cmd --list-all 通过以上步骤同样可以实现限制对端口8088的访问,只允许IP为192.168.2.100...
二、rich-rules的方式 代码语言:javascript 代码运行次数:0 运行 AI代码解释 firewall-cmd--remove-port=9000/tcp--permanent--zone=publicfirewall-cmd--reload firewall-cmd--add-rich-rule='rule family="ipv4" source address="192.168.31.100/32" port port="9000" protocol="tcp" log prefix="graylog900...
> firewall-cmd --permanent --zone=public --add-rich-rule="rule family="ipv4"source address="192.168.100.1/24"service 允许来自 192.168. 100.1 的主机访问 22 端口 > --add-rich-rule 添加一个富规则 > --remove-ruch-rule 删除一个富规则 ...