The following problems with the firewall can be solved with this method
For example, the command line cannot be found
Failed to stop : Unit not loaded.
Or it won't shut down won't start, etc.
Failed to start : Unit not found. Unit could no
Problems such as these can be solved in this way
First start the firewall normallysystemctl unmask
If the startup is unsuccessful or this command line is not available
Then you need to install it first or shut down the startup first, etc.
existubuntuWhen executing service iptables stop to turn off the firewall for some commands
This command is not found, etc.
Due to the continuous updating and iteration of the system
Have turned this command into firewall as a firewall
If this firewall command is not yet available as well as not installed
This can be done byapt-get install firewall
mounting
If you want to disable the firewall you can runsystemctl stop
If you want to open the firewall you can run
systemctl unmask firewalld
systemctl enable firewalld
systemctl start firewalld
- 1
- 2
- 3
Once this is done, you can do things like startup shutdown of commands on that firewall
The specific commands are explained as
Turn on the firewallsystemctl start
Turn off the firewallsystemctl stop
autostartsystemctl enable
disable boot-up (computing)systemctl disable
Reload the firewall without changing its statefirewall-cmd --reload
After modifying the configuration, you need to restart the service for it to take effect.systemctl restart
Other command lines:
Starting services
firewall-cmd --zone=public --add-service=https //temporary
firewall-cmd--permanent --zone=public --add-service=https //permanent
- 1
- 2
boot port number
firewall-cmd --permanent --zone=public --add-port=Port number //permanent
firewall-cmd--zone=public --add-port=Port number //temporary
- 1
- 2
Check if the startup was successful
Have this service or port number
firewall-cmd --permanent --zone=public --list-services
firewall-cmd --permanent --zone=public --list-ports
- 1
- 2
Remember to add the protocol after all the above port numbers
Otherwise, you'll make a mistake.
The correct way should be[Port number/protocol]