How to configure firewalld in RHEL 7

本文围绕Red Hat Enterprise Linux 7系统中firewalld的配置展开。提出如何在RHEL 7中配置firewalld的问题,给出一系列配置Firewalld服务的命令,如启动、停止服务,添加接口到区域等,还指出要验证接口区域和允许服务以确保访问。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

https://access.redhat.com/solutions/2177831

SOLUTION 已验证 - 已更新 2016年三月29日08:47 - 

English 

环境

  • Red Hat Enterprise Linux 7

问题

  • How to configure firewalld in RHEL 7.

决议

  • Follow are list of commands that would be helpful to configure Firewalld service.

1. To start/stop/status firewalld service

Raw

systemctl start firewalld.service

systemctl stop firewalld.service

systemctl status firewalld.service

2. To enable/disable firewalld service at boot time.

To enable firewalld service from starting at boot time.

Raw

systemctl enable firewalld

To disable firewalld service from starting at boot time.

Raw

systemctl disable firewalld

3. To list details of default and active zones.

Raw

firewall-cmd --get-default-zone

Raw

firewall-cmd --get-active-zones

Raw

firewall-cmd --list-all

4. To add/remove interfaces to zones.

To add interface "eth1" to "public" zone.

Raw

firewall-cmd --zone=public --change-interface=eth1

5. To list/add/remove services to zones.

To list available services

Raw

firewall-cmd --get-services

To add "samba and samba-client" service to a specific zone.
You may include, "permanent" flag to make this permanent change.

Raw

firewall-cmd --zone=public --add-service=samba --add-service=samba-client --permanent 

To list services configured in a specific zone.

Raw

firewall-cmd --zone=public --list-service

6. To list and Add ports to firewall.

Raw

firewall-cmd --list-ports

firewall-cmd --zone=public --add-port=5000/tcp

Note:

You may restart the Network service followed by Firewall server.

Raw

systemctl restart network.service
systemctl restart firewalld.service

根源

Verify interfaces are added to correct zones and specific services are allowed to provide
access to server while firewalld is running.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值