Home > Operation and Maintenance > Linux Operation and Maintenance > Detailed explanation of how to add a Linux security group port (command line method)

Detailed explanation of how to add a Linux security group port (command line method)

藏色散人
Release: 2023-01-29 20:29:42
forward
2091 people have browsed it

This article brings you relevant knowledge about Linux. It mainly introduces how to use the command line to add Linux security group ports using Centos7. helpful.

Detailed explanation of how to add a Linux security group port (command line method)

Use the command line to add the Linux security group port

We take Centos7.x as an example

firewalld Commonly used commands

The name of the service is firewalld

#查看firewall防火墙状态 
systemctl status firewalld
# 等价命令
service firewalld status
#开启firewall防火墙
systemctl start firewalld.service
# 等价命令
service firewalld start
#关闭firewall防火墙
systemctl stop firewalld.service
# 等价命令
service firewalld stop

#禁止firewall开机启动,此操作尽量不要用
systemctl disable firewalld.service
Copy after login

The operation command is firewall-cmd

firewall-cmd --list-ports
#查看firewall防火墙开放端口

firewall -cmd --reload
#重新加载防火墙permanent(永久的)的规则配置,覆盖当前运行时配置,在运行时添加的非permanent规则,都将丢失

#开放firewall防火墙端口,需重启防火墙生效service firewalld restart
firewall-cmd --zone=public --add-port=8088/tcp --permanent
# 移除指定端口
firewall-cmd --permanent --remove-port=8088/tcp
Copy after login

Command parameter command Meaning:

-zone #作用域
-add-port=80/tcp #添加端口,格式为:端口 / 通讯协议
-permanent #永久生效,没有此参数重启后失效
Copy after login

Please click here for the difference between service and systemctl:

The difference between the systemctl command and the service and chkconfig commands under Linux

Recommended learning: "Linux Video Tutorial"

The above is the detailed content of Detailed explanation of how to add a Linux security group port (command line method). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:learnku.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template