linux 图形化操作富规则,Centos7 Firewalld 自定义富规则

以下只是针对自定义规则的简单说明和举例,其实也就是帮助文档里面的东西;详细的说明自行参考 firewall-cmd --help

传递的参数 与 iptables, ip6tables 以及 ebtables 一致!

Centos7 Firewall 用户操作接口依然调用系统内核的iptables模块来设定规则!

直接选项

–direct需要是直接选项的第一个参数。

将命令传递给防火墙。参数 可以是 iptables, ip6tables 以及 ebtables 命令行参数。

firewall-cmd --direct --passthrough { ipv4 | ipv6 | eb }

为表

firewall-cmd --direct --add-chain { ipv4 | ipv6 | eb }

从表

firewall-cmd --direct --remove-chain { ipv4 | ipv6 | eb }

查询 链是否存在与表

firewall-cmd --direct --query-chain { ipv4 | ipv6 | eb }

如果启用,此命令将有返回值。此命令没有输出信息。

获取用空格分隔的表

firewall-cmd --direct --get-chains { ipv4 | ipv6 | eb }

为表

firewall-cmd --direct --add-rule { ipv4 | ipv6 | eb }

参考示例:

方式-:[reload 生效,修改后重启才可生效]

# firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 1 -s 192.168.1.0/24 -p tcp --dport=22 -j ACCEPT

# firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 2 -p tcp --dport=22 -j DROP

方式二:[重载或重启后失效]

# iptables -t filter -I INPUT_direct -s 192.168.1.20 -p tcp --dport=22 -j ACCEPT

# iptables -A INPUT_direct -p tcp --dport=22 -j DROP

从表

firewall-cmd --direct --remove-rule { ipv4 | ipv6 | eb }

# firewall-cmd --direct --remove-rule ipv4 filter INPUT 2 -p tcp --dport=22 -j DROP

查询带参数 的链 是否存在表

firewall-cmd --direct --query-rule { ipv4 | ipv6 | eb }

获取表

firewall-cmd --direct --get-rules { ipv4 | ipv6 | eb }

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值