centos7.3 firewalld安全防火墙指定IP策略--------龙胆苏打

centos7.3 firewalld防火墙指定IP策略--------龙胆苏打

firewall-cmd的命令行客户端支持和这个守护进程通信以永久修改防火墙规则

常用命令

firewall-cmd  #防火墙的命令行
--permanent  #永久
   --remove  #移除
   --add  #添加
   --list-all #查询所有

查看配置结果

firewall-cmd --list-all

显示如下

   public (default)
      interfaces:
      sources:
      services: dhcpv6-client ftp ssh
      ports:
      masquerade: no
      forward-ports:
      icmp-blocks:
      rich rules:
                rule family="ipv4" source address="192.168.1.1" port port="2000-30000" protocol="tcp" accept
                rule family="ipv4" source address="192.168.1.19" " accept

#删除策略指定ip策略

语法

firewall-cmd --permanent --remove-rich-rule="《删除的信息》"

例子1

firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.1" port port="2000-30000" protocol="tcp" accept"

例子2

 firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.1.19" " accept"

重新加载防火墙

firewall-cmd --reload #在不改变状态的条件下重新加载防火墙

添加策略指定ip策略

语法

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="终端ip"  accept"

例子1

firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.1.1"  accept"

例子2

firewall-cmd --permanent --permanent --remove-rich-rule family="ipv4" source address="192.168.1.1" port port="1521" protocol="tcp" accept

开启防火墙

systemctl restart firewalld

或者重新加载防火墙

firewall-cmd --reload #在不改变状态的条件下重新加载防火墙与 systemctl restart firewalld类似的效果

你可能感兴趣的:(firewall-cmd,防火墙配置1,防火墙配置)