In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
CentOS7 firewall and port-related commands are what, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
In the following cases, the corresponding linux system version is CentOS7. If the environment is CentOS6, use service iptables state/start/stop/restart to replace the corresponding systemctl status / start/stop/restart firewalld.service command.
1. View the current status of the firewall
Method 1
[root@hu ~] # firewall-cmd-- statenot running-- not running [root@hu ~] # firewall-cmd-- staterunning-- running
Method 2
[root@hu ~] # systemctl status firewalld.service is running normally.
Abnormal / not running?
2. Start the firewall service [root@hu ~] # systemctl start firewalld.service3, close the firewall service [root@hu ~] # systemctl stop firewalld.service4, and open the specified port # add-- permanent parameter before the restart service will take effect and permanently. # if the-- permanent parameter is not added, it will take effect immediately, and it will become invalid after the service is restarted. [root@hu ~] # firewall-cmd-- zone=public-- add-port=8080/tcp-- permanentsuccess [root@hu ~] # firewall-cmd-- zone=public-- add-port=80/tcp-- permanentsuccess# restart service to make the open port effective [root@hu ~] # firewall-cmd-- reloadsuccess#4.1, verify whether the new open port is valid, yes indicates it is valid, no indicates that it does not fail [root@hu ~] # firewall-cmd-- zone=public-- query-port=8080/tcpyes5, removes the designated port. You need to restart the firewall service to take effect. [root@hu ~] # firewall-cmd-- zone=public-- remove-port=8080/tcp-- permanent# command verifies whether [root@hu ~] # firewall-cmd-- zone=public-- query-port=80/tcp# has been removed or check [root@hu ~] # firewall-cmd-- permanent-- zone=public-- list-ports8081/tcp 3306/tcp 111/tcp 111/udp 2049/tcp by checking the open ports of the current firewall. 2049/udp 1001/tcp 1001/udp 1002/tcp 1002/udp 30001/tcp 30002/udp 80/tcp 8080/tcp# can add multiple ports by configuring multiple-- add-port parameters Example: [root@hu] # firewall-cmd-- zone=public-- add-port=80/tcp-- add-port=8080/tcp-- permanent6, restart the firewall
Method 1
[root@hu ~] # systemctl restart firewalld.service
Method 2
[root@hu ~] # firewall-cmd-- reloadsuccess7, set the firewall to boot [root@hu ~] # systemctl enable firewalld.service# restart the machine and check the firewall status [root@hu ~] # reboot. [root@hu ~] # firewall-cmd-- staterunning-- does it help you to read the above contents successfully? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.