How to open ports with firewall-cmd command

藏色散人
Release: 2023-01-04 15:11:19
Original
8448 people have browsed it

How to open the port with firewall-cmd command: 1. Open the terminal command window; 2. Open it by executing the "firewall-cmd --zone=public --add-port=8888/tcp --permanent" command Just specify the port.

How to open ports with firewall-cmd command

The operating environment of this tutorial: Centos7 system, Dell G3 computer.

How to open the port with the firewall-cmd command?

Centos7 Use the firewall-cmd command to open and view port openings

1. Open ports

firewall-cmd --zone=public --add-port=8888/tcp --permanent # 开放5672端口 firewall-cmd --zone=public --remove-port=8888/tcp --permanent #关闭5672端口 firewall-cmd --reload # 配置立即生效
Copy after login

2. View all open ports on the firewall

firewall-cmd --zone=public --list-ports
Copy after login

3. Turn off the firewall

If you don’t want to control the port, just turn off the system firewall. Everything will work, but the security is not strong, so it is not recommended.

systemctl stop firewalld.service
Copy after login

4. Check the firewall status

firewall-cmd --state
Copy after login

5. Check the listening port

netstat -lnpt
Copy after login

PS: centos7 does not have the netstat command by default. You need to install the net-tools tool, yum install - y net-tools

6. Check which process the port is occupied

netstat -lnpt |grep 8888
Copy after login

7. View the detailed information of the process

ps 8888
Copy after login

8. Terminate the process

kill -9 6832
Copy after login

Recommended study: "Linux Video Tutorial"

The above is the detailed content of How to open ports with firewall-cmd command. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!