Redhat 7 防火墙

简介: systemctl status firewalld -- 查看防火墙状态。  systemctl stop firewalld         -- 临时关闭防火墙命令。重启电脑后,防火墙自动起来。

systemctl status firewalld       -- 查看防火墙状态。 

systemctl stop firewalld         -- 临时关闭防火墙命令。重启电脑后,防火墙自动起来。

systemctl disable firewalld      -- 永久关闭防火墙命令。重启后,防火墙不会自动启动。

systemctl enable firewalld      -- 打开防火墙命令。


查看防火墙的状态

# firewall-cmd --state

running


# firewall-cmd --list-all

public (default, active)

interfaces: eno16777736

sources: 

services: dhcpv6-client ssh

ports: 

masquerade: no

forward-ports: 

icmp-blocks: 

rich rules:


查看某服务是否开启

# firewall-cmd --query-service ftp

# firewall-cmd --query-service ssh

# firewall-cmd --query-service samba

# firewall-cmd --query-service http


开启关闭服务端口

暂时开放 ftp 服務

# firewall-cmd --add-service=ftp


永久开放 ftp 服務

# firewall-cmd --add-service=ftp --permanent


永久关闭

# firewall-cmd --remove-service=ftp --permanent

success


重启一下

# systemctl restart firewalld


检查设置是否生效

# iptables -L -n | grep 22

ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 ctstate NEW


设置特殊端口开放 

# firewall-cmd --add-port=5500/tcp

# firewall-cmd --list-all

public (default)

interfaces:

sources:

services: dhcpv6-client ftp ssh

ports: 5500/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' 删除策略


-- 配置防火墙 redhat 7.5

firewall-cmd --permanent --add-port=1521/tcp

firewall-cmd --reload


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;echo $? 查看服务是否开机启动:

systemctl list-unit-files|grep enabled 查看已启动的服务列表:

 

 

 

 

目录
相关文章
|
Linux 网络安全 数据安全/隐私保护
|
Linux 网络安全 安全
Redhat关闭SELinux和防火墙的办法
Redhat使用了SELinux来增强安全,关闭的办法为: 1. 永久有效 修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。 2. 即时生效 setenforce 0 关闭防火墙的方法为: 1. 永久性生效 开启:chkconfig iptables on  关闭:chkconfig iptables of
1764 0
|
安全 Linux 网络安全
Redhat关闭SELinux和防火墙的办法(转)
Redhat使用了SELinux来增强安全,关闭的办法为:1. 永久有效修改 /etc/selinux/config 文件中的 SELINUX="" 为 disabled ,然后重启。2. 即时生效setenforce 0 关闭防火墙的方法为:1.
860 0
|
4月前
|
运维 网络协议 安全
小白带你学习linux的防火墙
小白带你学习linux的防火墙
149 1
|
6月前
|
安全 Linux 网络安全
Linux一些防火墙实战知识
本文介绍了如何在Linux中设置防火墙和开放端口,以提高服务器的安全性。首先,使用firewalld作为防火墙软件包,并确保firewalld服务正在运行。然后,通过添加服务来定义允许的服务端口,可以使用firewall-cmd命令查看当前已定义的服务,并使用firewall-cmd命令添加服务。添加规则后,需要重新加载firewalld配置以使更改生效。在某些情况下,需要打开特定的端口,例如HTTP端口80和HTTPS端口443。可以使用firewall-cmd命令打开端口,并将规则添加到相应的区域。。。确实都是工作中日常中会用到的一些命令
|
6月前
|
安全 Linux 网络安全
百度搜索:蓝易云【linux iptables安全技术与防火墙】
请注意,iptables的具体使用方法和配置选项可能会有所不同,取决于Linux发行版和版本。管理员应该参考相关文档和资源,以了解适用于其特定环境的最佳实践和配置方法。
467 0
百度搜索:蓝易云【linux iptables安全技术与防火墙】
|
6月前
|
开发框架 网络协议 Ubuntu
【Linux】配置网络和firewall防火墙(超详细介绍+实战)
【Linux】配置网络和firewall防火墙(超详细介绍+实战)
1332 0
|
1月前
|
存储 安全 网络协议
使用 firewall-cmd 管理 Linux 防火墙端口
本文将介绍如何使用 firewall-cmd 工具在 Linux 系统中进行简单端口管理,包括开放、查询、关闭等操作。通过实例展示相关命令的用法,希望能对大家有所帮助。
132 0
|
1天前
|
Linux 网络安全 数据安全/隐私保护
Linux 如何关闭防火墙(开启管理员权限)
Linux 如何关闭防火墙(开启管理员权限)
2 0
|
9天前
|
Linux 网络安全
linux如何关闭防火墙
记住,关闭防火墙可能会降低系统安全性,请在真正需要的情况下关闭,并确保你在网络环境中采取其他安全措施。
15 0

推荐镜像

更多