Table of Contents
![Open a Port in UFW - UncomplicatedFirewall](https://www.inmotionhosting.com/support/wp-content/uploads/2020/07/ufw-open-port-1024x538.jpg)
![Gufw](https://www.inmotionhosting.com/support/wp-content/uploads/2020/07/gufw.png)
UncomplicatedFirewall (UFW) is a command-line, frontend iptables manager, similar to Firewalld and ConfigServer Security & Firewall (CSF). Understanding basic UFW commands is beneficial since it is available by default in all Ubuntu-based installations after 8.04, including Mint.
Those configuring UFW for a desktop system who prefer not to use the CLI can use the GUFW GUI application.
You must ensure the appropriate ports are open when installing new server management software such as Apache or Webmin.
Open a Port in UFW
There are multiple ways to open a port in UFW. Below, we cover how to open ports using the port number, service name, and custom IP/port combination.
- Log into SSH as root.
- Check if the application port is defined as a service (e.g. OpenVPN, PostgreSQL, IRC):
Or
To navigate the full list, use Page Up, Page Down, and arrow keys after using theless
command: - If the service is listed, you can open the port using the service name (TCP/UDP protocol optional):
- If there is no service listed for the port, you can open the port by specifying the port and protocol (TCP/UDP):
- If you need to allow all connections from a specific system or network IP address:
- To allow all connections from a particular subnet of IP:
- To allow connections on a specific port from an IP address:
- After you open a port in UFW, ensure UFW is enabled:
Close a Port in UFW
After you uninstall software, you should close any ports you no longer need to open on your system. You can accomplish this using the service name or port number.
- To close a port in UFW using the service name:
- To close a port in UFW using the port number:
Check Open Ports in UFW
After making changes to any firewall, you should verify your changes to ensure they’re correct and active.
- To check whether UFW is running:
- To check whether UFW is running with additional information, such as logging and profile status:
- To find the rule number for UFW rules:
- Then you can remove the rule:
Want to learn more about web server security? Check out our guide on hardening your managed VPS or dedicated server.
Upgrade to VPS Hosting for Peak Performance
Upgrade to InMotion VPS Hosting today for top-notch performance, security, and flexibility, and save up to $2,412 – a faster, stronger hosting solution is just a click away!
SSD Storage
High-Availability
Ironclad Security
Premium Support