Home >Operation and Maintenance >Linux Operation and Maintenance >Detailed explanation of how to add a Linux security group port (command line method)
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.
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
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
Command parameter command Meaning:
-zone #作用域 -add-port=80/tcp #添加端口,格式为:端口 / 通讯协议 -permanent #永久生效,没有此参数重启后失效
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!