How Do I Open / Close / List A Port In Ubuntu Firewall

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.

  1. First i install v2ray in my google cloud VPS server, the v2ray use one port number such as 666666.
  2. Then i install another application from bt.cn which is a linux os management dashboard application.
  3. After i install it, i find the v2ray service can not be accessed.
  4. 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.
  5. So i need to change the ubuntu firewall port to allow v2ray being accessed again.

2. How To Manage Ubuntu Firewall.

  1. Enable ubuntu firewall.
    sudo ufw enable
  2. Disable ubuntu firewall.
    sudo ufw disable
  3. Reload ubuntu firewall.
    sudo ufw reload
  4. List ubuntu firewall allowed port number.
    ufw status
  5. Open a firewall port number.
    # ufw allow 666666
    ufw allow port-number

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.