Are you getting UFW status inactive?
Ubuntu’s default firewall UFW comes handy in controlling incoming and outgoing network traffic.
However, firewall should be active on the server.
At Bobcares, we often receive requests regarding the UFW firewall failures as a part of our Server Management Services.
Today, let us discuss how Support Engineers keep UFW in active status on the servers.
Causes for UFW status inactive
Let’s begin by checking the causes that make UFW inactive.
Although Ubuntu servers come up with UFW, the default status of the firewall will be OFF. Thus on checking the server firewall status, the UFW status shows as inactive.
Similarly, if we install the UFW firewall in a new server, it will still be inactive. In all cases, we need to manually enable it from our end. The error looks like:
# ufw status
Status: inactive
How to resolve UFW status inactive
Recently one of our customers contacted us about the failure of UFW in his server. On analyzing we found that the UFW service was not enabled. Let us discuss on how our Support Engineers enabled UFW service.
Before enabling UFW, we enable SSH port in the firewall. Omitting this step make the server inaccessible via SSH. Therefore, we first allow the SSH port using the command:
ufw allow ssh
or we use
ufw allow 22
Now our Support Engineers use the command to enable UFW.
ufw enable
UFW enable will also enable the option to start at server startup. If any prompt message shows up as “Command may disrupt existing ssh connections. Proceed with the operation (y|n)?”
Enter y to continue.
It is safe to proceed since we have already added SSH port in the firewall
We can also start UFW from the config file. Initially, on checking the config file the output is:
cat /etc/ufw/ufw.conf | grep ENABLED
ENABLED=no
We edit ENABLED from no to yes in the ufw.conf. Before making and changing in the configuration we always take a backup of the file.
Finally, we confirm the details by verifying the UFW status.
[Trouble making UFW active on the server? Reach out to us!]
Conclusion
In short, we have discussed the causes for the inactive status. Also, we have discussed how our Support Engineers enable the UFW firewall.
sudo ufw enable
it works
Thank you. I was about to pull the trigger on this myself, but worried about locking myself out of ssh by just doing ufw enable. This helped and all my rules are showing and ufw is active. Appreciated.
wow nice documentation, thanks man.