This article will tell you how to enable / disable ubuntu firewall, it also tell you how to manage ( open, close, list ) firewall port number. If you find your service which is running on ubuntu server can not be accessed, you should first confirm that the service’s port number is allowed in ubuntu firewall. Below is the use case which i encountered.
1. V2ray Service Can Not Be Accessed After Install Linux Dashboard Use Case.
- First i install v2ray in my google cloud VPS server, the v2ray use one port number such as 666666.
- Then i install another application from bt.cn which is a linux os management dashboard application.
- After i install it, i find the v2ray service can not be accessed.
- After some investigation, i find that the v2ray service listen port has been blocked by ubuntu firewall, this is done by the linux management dashboard application.
- So i need to change the ubuntu firewall port to allow v2ray being accessed again.
2. How To Manage Ubuntu Firewall.
- Enable ubuntu firewall.
sudo ufw enable
- Disable ubuntu firewall.
sudo ufw disable
- Reload ubuntu firewall.
sudo ufw reload
- List ubuntu firewall allowed port number.
- Open a firewall port number.
# ufw allow 666666 ufw allow port-number