Welcome to another InMotion Hosting video tutorial. My name is Arnel Custodio
and today we will be learning how to open a port in UFW (Uncomplicated Fire Wall).
The operating system we will be using is Ubuntu version 18.0.4.5 LTS.
In order to follow this tutorial, you will need to have a variant of Linux like Ubuntu loaded,
root login (to make changes to the configuration of the firewall),
and UFW already loaded.
Keep in mind that changes to the firewall ports can affect the security of your installation.
If you are not sure if the ports should be open
then do not open them and consult with an experienced administrator with security knowledge before you make any changes.
Log in to your Ubuntu installation as the root user
Note that a new installation of UFW will start with the firewall DISABLED. However, if you need to disable it
then simply run ufw disable
If you aren’t sure of the status of firewall, then run: ufw status
All of our changes to the UFW firewall policies will be using the command UFW in the command line.
Opening a port uses the simple command of “allow”. Enabling a port is the same as opening a port.
So, if you want to enable port 22 then your command would simply be: ufw allow 22
uff allow 22
Note that this will enable both TCP (Transmission Control Protocol) and UDP (User Datagram Protocol)
If you do not specifically state it after the port number. So, if you only want to allow TCP traffic:
Then it would be ufw allow 22/tcp
If you need to open multiple ports then you can specify a range like this
ufw allow 6000:6007/tcp
Note that you will need to specify the protocol
Once you have set your policies for your firewall, then you should review them by using
ufw show added
If you're okay with your policies then you can enable UFW so that the policies are active
You would then run the command: UFW enable
In order to remove a firewall rule, you should first run
ufw show added
This will get the list of firewall rules you have in place
Then you can delete it by simply using the DELETE command in front of the command you used to enable the rule
For example: ufw delete allow 22/tcp
If you have many firewall policies in place, then it may be wise to make sure you have a copy of the text of your firewall rules
so that you can make sure that they’re all properly in place.
If you want to make sure that the rule has been removed, then run
ufw show added to make sure that the rule has been removed from the list.
Thanks for listening to our tutorial on how to open ports in UFW.
If you liked our video, please give us a thumbs below and then subscribe to our channel so that you can see our other tutorial videos.
Thanks again for listening and have a great day!