Last update at :2024-07-03,Edit by888u
CentOS7 still has some differences from the previously commonly used CentOS6. For example, the setting of open ports is slightly different. The commonly used iptables command has been replaced by firewalld. In the past few days, I happened to be playing Seafile self-built network disk in CentOS7 system. By default, port 8082 is not enabled. Then I saw that the open port of CentOS7 is slightly different from that of CentOS6. Here, based on the habit of learning and recording, I will open the port of CentOS7. As well as the organization of commonly used command records.
In this way, when you need CentOS7 open ports and commands in the future, you can directly read and use them. The content is relatively basic and simple for experts, but my memory is not good, so I can only record it.
First, stop and enable the firewall
systemctl stop firewalld.service #Stop systemctl disable firewalld.service #Disable startup at boot systemctl restart iptables.service #Enable systemctl enable iptables.service #Start at boot
Second, commonly used commands
firewall-cmd –state ##Check the firewall status, whether it is runningfirewall-cmd –reload ##Reload the configuration, for example, after adding rules, you need to execute this command firewall-cmd –get-zones ##List supported zonefirewall-cmd –get-services ##List supported services, the services in the list are allowed firewall-cmd –query-service ftp ##Check whether the ftp service is supported, return yes or no firewall-cmd –add-service= ftp ##Temporarily open the ftp service firewall-cmd –add-service=ftp –permanent ##Permanently open the ftp service firewall-cmd –remove-service=ftp –permanent ##Permanently remove the ftp service firewall-cmd –add-port= 80/tcp –permanent ##Permanently add port 80 iptables -L -n ##View rules, this command is the same as iptables man firewall-cmd ##View help
This article has a reference here: http://blog.csdn.net/achang21/article/details/52538049
Third, test the open port
firewall-cmd –zone=public –add-port=8082/tcp –permanent
firewall-cmd –reload
Here I opened port 8082 of seafile the day before yesterday so that I can upload files, otherwise it will not work.
Recommended site search: US server website, registration-free jsp space, free vps trial 7-day accelerator, legendary server rental, US virtual host free domain name registration platform, rental server, vps server, Google permanently free server, US attack defense Server,
发表评论