How to enable port on cloud server using ufw
UFW, or the “Uncomplicated FireWall”, UFW use iptables to manage it’s firewall rules, you may need this while your are using ubuntu or Debian server.
it’s very simple to use
Firstly instal UFW using following command
apt-get install ufw
You can then set it to allow outgoing traffic and reject incoming traffic by default with the following commands:
ufw default allow outgoing
ufw default allow outgoing
You will need to then enable the firewall:
ufw enable
You can then open specific ports using the following command (remember to replace $PORT with the port number you wish to open, and $PROTOCOL with either tcp or udp:
ufw allow $PORT/$PROTOCOL
If you are looking to open the same port for TCP and UDP, you can just leave out the /$PROTOCOL part:
ufw allow $PORT