How to open a port?

To open a port using firewalld, you can use the following command:

sudo firewall-cmd --zone=public --add-port=PORT_NUMBER/tcp --permanent

Replace PORT_NUMBER with the actual port number you want to open. For example, to open port 8080, you would use:

sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent

After adding the port, reload the firewall to apply the changes:

sudo firewall-cmd --reload

Note

  • The --permanent option makes the change persistent across reboots.
  • If you want to open a UDP port, replace tcp with udp.

Further Learning

For more details, you can check the firewalld documentation or explore related labs on LabEx.

0 Comments

no data
Be the first to share your comment!