Centos7 default firewalld firewall command
Basic operations;
# systemctl start firewalld //启动 # systemctl status firewalld //状态 # systemctl disable firewalld //禁用 # systemctl stop firewalld //停止
systemctl is an indispensable management tool in centos7. It has all the functions of service and chkconfig;
# 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 //查看已经启动的服列表 # systemctl --failed //查看启动失败的服务列表
Basic configuration firewalld-cmd;
# firewall-cmd --version //查看防火墙版本 # firewall-cmd --help //查看命令操作帮助 # firewall-cmd --state //显示当前状态 # firewall-cmd --zone=public --list-ports //查看所有打开运行的端口 # firewall-cmd --reload //不重启立即加载 # firewall-cmd --list-all-zones | more //查看区域信息情况 # firewall-cmd --get-zone-of-interface=eth0 //查看指定接口所属区域 # firewall-cmd --panic-on //拒绝所有包 # firewall-cmd --panic-off //取消拒绝状态 # firewall-cmd --query-panic //查看是否拒绝
For example, how to open a port, such as 3306;
# firewall-cmd --zone=public --add-port=3306/tcp --permanent //添加3306端口(--permanent)永久生效,没有此参数重启后失效 # firewall-cmd --reload //不重启立即加载 # firewall-cmd --zone= public --query-port=3306/tcp //查看加入3306端口状态 # firewall-cmd --zone= public --remove-port=3306/tcp --permanent //删除刚刚加入的防火墙规则3306 # firewall-cmd --permanent --remove-icmp-block=echo-request //删除禁ping # firewall-cmd --permanent --add-icmp-block=echo-request //开启禁ping # firewall-cmd --get-service //查看已被允许的信息
For specific rule management, you can use firewall-cmd, and the specific usage method can be
# firewall-cmd --help
For advanced functions of firewall-cmd, please go to the official database for more information.
https://fedoraproject.org/wiki/FirewallD/zh-cn
https://access.redhat.com/documentation/zh-CN/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Firewalls.html
https://www.ibm.com/developerworks/cn/linux/1507_caojh/
Note: The above operation methods and commands are not applicable to versions below Centos7, unless you install firewall separately in other Linux distributions.
The above is the detailed content of Centos7 default firewalld firewall command. For more information, please follow other related articles on the PHP Chinese website!

Linux systems are known for their power and reliability, but even experienced users will encounter unexpected problems. Whether it is an unexpectedly deleted file, a forgotten root password, or a slow system running, efficient troubleshooting skills are the key to becoming a Linux expert. This guide will introduce common Linux problem solving scenarios and step-by-step solutions that are common among system administrators, developers, and everyday Linux users. Scene 1: Unexpected deletion of important files You accidentally deleted an important file using the rm command and now you need to restore it. Unlike Windows and macOS, Linux does not have a built-in "recycle bin" to store files deleted from the terminal. Recovery options depend on

Docker is a powerful tool that allows you to run applications in an isolated environment called containers. However, sometimes you may need to change the permissions of the Docker folder to ensure that your application has access to the necessary files and directories. This article will guide you through the process of permanently changing Docker folder permissions on Linux systems. Understand Docker folder permissions By default, Docker stores its data, including images, containers, and volumes, in specific directories on Linux systems. The most common directory is /var/lib/docker. The permissions of these folders determine who can read, write, or execute the files in it. if

Simplify Docker Management with Portainer CE on Linux: A Step-by-Step Guide Managing Docker containers via the command line can be daunting, especially for newcomers. Portainer CE (Community Edition) offers a free, lightweight, and intuitive solutio

This guide details how to install and use Whisper AI for real-time speech-to-text transcription on Linux systems. Whisper AI, an OpenAI creation, offers high-accuracy transcription across multiple languages. While primarily designed for batch proces

For Linux terminal enthusiasts, a robust file manager is essential. While many exist, Superfile stands out as a modern, lightweight, and visually appealing choice. This article explores Superfile, its origins, and why it's a top contender for your f

Zellij: A Modern Terminal Multiplexer for Enhanced Linux Workflows Linux terminal multiplexers are indispensable tools for developers and system administrators, streamlining command-line interactions. Zellij, a relatively new open-source multiplexer

The startup process of Linux includes: 1. Start BIOS/UEFI, 2. Load GRUB, 3. Load kernel and initrd, 4. Execute init process, 5. Start system services, 6. Start login manager; the startup process of Windows includes: 1. Start BIOS/UEFI, 2. Load WindowsBootManager, 3. Load winload.exe, 4. Load tonskrnl.exe and HAL, 5. Start system services, 6. Start login screen; Linux provides more customization options, while Windows pays more attention to user experience and stability.

This guide details how to configure automatic service restarts in Linux using systemd, enhancing system reliability and minimizing downtime. System administrators often rely on this functionality to ensure critical services, such as web servers (Apa


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

Notepad++7.3.1
Easy-to-use and free code editor

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Chinese version
Chinese version, very easy to use

Dreamweaver CS6
Visual web development tools
