# 3CX: Configuring Ports on Your 3CX Server Using nftables

**Step 1: Login to Your Server**  
First, you'll need to access your server via SSH.

```
ssh username@your_server_ip

```

**Step 2: Open the nftables Configuration File**

Once you're logged into your server, the next step is to edit the `nftables` configuration file. Run the following command to open the file in the `vim` editor:

```
vim /etc/nftables.conf

```

**Step 3: Add Your Desired Port**

In the `vim` editor, add the rule for your desired port. For example, to open port 8080 for TCP traffic, you would add the following line:

```
tcp dport 8080 accept

```

Or if you want to add multiple ports for TCP/UDP, you should add the following line:

```
tcp dport {8080,8443} accept

udp dport {7000,150} accept
```

Ensure you place this line in the correct section of the configuration file, typically within the table and chain definitions for your firewall rules.

**Step 4: Save the Configuration File**

After adding your port rule, you need to save and close the `vim` editor. To do this, follow these steps:

1. Press `Esc` to exit insert mode.
2. Type `:wq` and press `Enter` to write the changes and quit the editor.

**Step 5: Backup the Configuration File**

Before applying the new configuration, it's a good practice to create a backup of the current configuration file. This ensures you can easily revert to the previous settings if something goes wrong. Run the following command to create a backup:

```
cp /etc/nftables.conf /etc/nftables.conf-BAK

```

**Step 6: Apply the New Configuration**

Finally, apply the new `nftables` configuration by running the following command:

```
sudo nft -f /etc/nftables.conf

```

This command loads the rules from the configuration file and applies them to your firewall.