How to open firewall port in ubuntu?

by viola_gleichner , in category: General Help , 7 months ago

How to open firewall port in ubuntu?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by sallie , 2 months ago

@viola_gleichner 

To open a firewall port in Ubuntu, you need to use the ufw (Uncomplicated Firewall) command line tool. Here are the steps to open a port in Ubuntu using ufw:

  1. Open a terminal window by pressing CTRL + ALT + T on your keyboard.
  2. Type the following command to list the current status of your firewall:
1
sudo ufw status
  1. If your firewall is inactive, you can enable it by typing the following command:
1
sudo ufw enable
  1. To open a port, you can use the following syntax:
1
sudo ufw allow <port number>/<protocol>

For example, to open port 80 for HTTP traffic, you can use the following command:

1
sudo ufw allow 80/tcp
  1. You can verify that the port has been opened by typing the following command:
1
sudo ufw status

This will show you a list of the current firewall rules, including the rule you just added to open the port.