Linux防火墙

简介: 官方链接:https://www.linode.com/docs/security/firewalls/introduction-to-firewalld-on-centos/#installing-and-managing-firewalld安装和管理FirewallD要启动该服务并在启动时...

官方链接:https://www.linode.com/docs/security/firewalls/introduction-to-firewalld-on-centos/#installing-and-managing-firewalld

安装和管理FirewallD

  • 要启动该服务并在启动时启用FirewallD:
sudo systemctl start firewalld
sudo systemctl enable firewalld
  • 要停止并禁用它:
sudo systemctl stop firewalld
sudo systemctl disable firewalld
  • 检查防火墙状态。输出应该说running或者not running
sudo firewall-cmd --state
  • 要查看FirewallD守护程序的状态:
sudo systemctl status firewalld
  1. 显示示例
firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled)
   Active:active (running) since Wed 2015-09-02 18:03:22 UTC; 1min 12s ago
 Main PID: 11954 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─11954 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
  • 要重新加载FirewallD配置:
sudo firewall-cmd --reload

配置集永久链接

  • 将规则添加到永久集和运行时集
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --add-service=http
  • 将规则添加到永久集并重新加载FirewallD。
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --reload

防火墙区

  • 要查看默认区域:
sudo firewall-cmd --get-default-zone
  • 要更改默认区域:
sudo firewall-cmd --set-default-zone=internal
  • 要查看网络接口使用的区域:
sudo firewall-cmd --get-active-zones
  • 示例输出:
public
  interfaces: eth0
  • 要获取特定区域的所有配置
sudo firewall-cmd --zone=public --list-all
  • 示例输出
    image
  • 要获取所有区域的所有配置:
sudo firewall-cmd --list-all-zones

使用服务

  • 要查看默认的可用服务:
sudo firewall-cmd --get-services
  • 例如,要启用或禁用HTTP服务:
sudo firewall-cmd --zone=public --add-service=http --permanent
sudo firewall-cmd --zone=public --remove-service=http --permanent
  • 允许或拒绝任意端口/协议
sudo firewall-cmd --zone=public --add-port=12345/tcp --permanent
sudo firewall-cmd --zone=public --remove-port=12345/tcp --permanent
相关文章
|
4月前
|
运维 网络协议 安全
小白带你学习linux的防火墙
小白带你学习linux的防火墙
149 1
|
1月前
|
存储 安全 网络协议
使用 firewall-cmd 管理 Linux 防火墙端口
本文将介绍如何使用 firewall-cmd 工具在 Linux 系统中进行简单端口管理,包括开放、查询、关闭等操作。通过实例展示相关命令的用法,希望能对大家有所帮助。
|
7天前
|
Linux 网络安全
linux如何关闭防火墙
记住,关闭防火墙可能会降低系统安全性,请在真正需要的情况下关闭,并确保你在网络环境中采取其他安全措施。
15 0
|
4月前
|
网络协议 Linux 网络安全
linux服务器防火墙的开启及关闭
linux服务器防火墙的开启及关闭
210 1
|
4月前
|
安全 Linux 网络安全
linux的防火墙
Linux的防火墙是一种网络安全工具,用于保护Linux系统免受网络攻击。
64 0
|
4月前
|
存储 网络协议 Linux
Linux加强篇008-使用Iptables与Firewalld防火墙
山重水复疑无路,柳暗花明又一村
309 0
Linux加强篇008-使用Iptables与Firewalld防火墙
|
3月前
|
监控 网络协议 安全
Linux中防火墙的简单使用方法
防火墙是一种网络安全设备或软件,用于监控和控制网络流量,以保护计算机网络免受未经授权的访问、恶意攻击和未经授权的数据传输。防火墙通过筛选网络流量并根据预定义的规则集来允许或阻止特定类型的通信。
149 0
|
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防火墙(超详细介绍+实战)
1310 0