# How To Open Port on Linux

Opening a port on Linux is essential for allowing traffic to reach a specific application or service. This guide will walk you through the steps to open a port using tools like UFW and firewall-cmd.

## **Steps to Open a Port**

### **Using ufw**

Open the terminal and check the current Rules:

```
sudo ufw status
```

Allow traffic on a specific port:

```
sudo ufw allow 8080/tcp
```

Enable the UFW:

```
sudo ufw enable
```

### Using firewall-cmd

Open the terminal and check the status :

```
sudo firewall-cmd --state
```

Add a rule to open a specific port:

```
sudo firewall-cmd --add-port=8080/tcp --permanent
```

Reload the firewall to apply changes:

```
sudo firewall-cmd --reload
```

Display all the current settings and rules

```
sudo firewall-cmd --list-all
```

### Verifying the Port Opening

Using **`ss`**&#x63;onfirm the port is open and listening:

```
sudo ss -tuln | grep 8080
```

**Best Practices:**

* **KeepRules Minimal**: Only open necessary ports to reduce security risks.
* **Use Specific IP Addresses**: Where possible, restrict access to specific IP addresses.
* **Monitor Traffic**: Use monitoring tools to keep an eye on traffic to and from open ports.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.neevcloud.com/neevcloud-guide/neevcloud-knowledgebase/how-to-open-port-on-linux.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
