systemctl status firewalld -- 查看防火墙状态。
systemctl stop firewalld -- 临时关闭防火墙命令。重启电脑后,防火墙自动起来。
systemctl disable firewalld -- 永久关闭防火墙命令。重启后,防火墙不会自动启动。
systemctl enable firewalld -- 打开防火墙命令。
查看某服务是否开启
# firewall-cmd --query-service ftp
# firewall-cmd --query-service ssh
开启关闭服务端口
暂时开放 ftp 服務
# firewall-cmd --add-service=ftp
永久开放 ftp 服務
# firewall-cmd --add-service=ftp --permanent
永久关闭
# firewall-cmd --remove-service=ftp --permanent
success
重启一下
# systemctl restart firewalld
设置特殊端口开放
# firewall-cmd --add-port=1521/tcp
# firewall-cmd --list-all
public (default)
interfaces:
sources:
services: dhcpv6-client ftp ssh
ports: 1521/tcp
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
控制IP段访问
#firewall-cmd --list-all 查看默认是允许所有的访问
#firewall-cmd --permanent --remove-service=ssh 禁掉
#firewall-cmd --permanent --add-rich-rule 'rule service name=ssh family=ipv4 source address=192.168.1.0/24 accept' 允许访问
#firewall-cmd --permanent --add-rich-rule 'rule service name=ssh family=ipv4 source address=192.168.2.0/24 reject' 拒绝访问
#firewall-cmd --reload 重启一下
#firewall-cmd --list-all 在看一下变化。
#firewall-cmd --permanent --remove-rich-rule 'rule service name=ssh family=ipv4 source address=192.168.1.0/24 accept' 删除策略
systemctl start firewalld.service -- 启动一个服务:
systemctl stop firewalld.service -- 关闭一个服务:
systemctl restart firewalld.service -- 重启一个服务:
systemctl status firewalld.service -- 显示一个服务的状态:
systemctl enable firewalld.service -- 在开机时启用一个服务:
systemctl disable firewalld.service -- 在开机时禁用一个服务:
systemctl is-enabled firewalld.service -- 查看服务是否开机启动:
systemctl list-unit-files|grep enabled -- 查看已启动的服务列表:
-- 指定IP端口
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=10.176.49.99 port protocol=tcp port=1521 accept'
firewall-cmd --permanent --remove-rich-rule 'rule family=ipv4 source address=10.176.49.99 port protocol=tcp port=1521 accept'
-- 开放整个IP段
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=10.176.49.0/24 port protocol=tcp port=1521 accept'
firewall-cmd --permanent --remove-rich-rule 'rule family=ipv4 source address=10.176.49.0/24 port protocol=tcp port=1521 accept'
-- 开放IP段范围
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.176.49.99/24" port protocol=tcp port=1521 accept'
firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="10.176.49.99/24" port protocol=tcp port=1521 accept'
-- 防火墙配置实例
yum install firewalld firewall-config
reboot -- 重启下机器
systemctl enable/disable firewalld
systemctl start/stop firewalld.service文章来源:https://www.toymoban.com/news/detail-459890.html
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=192.168.123.2/24 port port=1521 protocol=tcp accept'
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=192.168.123.3/24 port port=1521 protocol=tcp accept'
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=192.168.123.4/24 port port=1521 protocol=tcp accept'
systemctl restart firewalld.service
firewall-cmd --list-all文章来源地址https://www.toymoban.com/news/detail-459890.html
到了这里,关于Red Hat 7 防火墙配置管理的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!