# FiveM server ports: what to open and what to keep closed

> A FiveM server needs 30120 open on TCP and UDP, and txAdmin on 40120 restricted to you. Keep 3306 closed, and give each server its own ports on one box.

Source: https://fam-tools.com/guides/fivem-server-ports-firewall · FAM Tools · published 2026-09-11 · updated 2026-09-11 · about 9 min

**Short answer.** Players connect on **30120 TCP and UDP** (set by `endpoint_add_tcp` and `endpoint_add_udp`). txAdmin’s panel listens on **40120 TCP** — restrict it to your own IP. Keep the database (3306) closed to the internet. To run several servers on one machine, give each its own game port and txAdmin port (`TXHOST_TXA_PORT` in txAdmin 8+). Test with `http://your-ip:30120/info.json`.

## Key points

- 30120 **TCP and UDP** — both are required.
- 40120 TCP for txAdmin — restrict it.
- 3306 (MySQL/MariaDB) should never be public.
- Change the game port in both `endpoint_add_*` lines.
- `/info.json` on the game port proves TCP is reachable.

If players time out at “Connecting” while the server console looks healthy, a closed port is the most likely cause. FiveM needs very few ports, but it needs both TCP and UDP on the game port — and a couple of ports should never be reachable from the internet at all.

## The ports

| Port | Protocol | Used for | Open to |
| --- | --- | --- | --- |
| 30120 | TCP + UDP | Game connections, resource downloads, server info | Everyone |
| 40120 | TCP | txAdmin web panel | Only your IP (or VPN) |
| 3306 | TCP | MySQL / MariaDB | Nobody outside the machine |
| 22 / 3389 | TCP | SSH / Remote Desktop | Only you, ideally |

## Setting and changing the game port

*server.cfg — second server on 30121*

```cfg
endpoint_add_tcp "0.0.0.0:30121"
endpoint_add_udp "0.0.0.0:30121"
```

Change the port only; keep `0.0.0.0` unless the machine has several network interfaces and you want a specific one. Players then connect with `connect your-ip:30121`.

Since txAdmin 8, txAdmin’s own port is set with the `TXHOST_TXA_PORT` environment variable (default 40120, and it cannot be 30120); the old `+set txAdminPort` convar is deprecated. Hosting panels usually set it for you.

## Firewall examples

*Linux (ufw)*

```bash
ufw allow 30120/tcp
ufw allow 30120/udp
ufw allow from <your.ip> to any port 40120 proto tcp
ufw deny 3306
```

*Windows (PowerShell as Administrator)*

```powershell
New-NetFirewallRule -DisplayName "FiveM TCP" -Direction Inbound -Protocol TCP -LocalPort 30120 -Action Allow
New-NetFirewallRule -DisplayName "FiveM UDP" -Direction Inbound -Protocol UDP -LocalPort 30120 -Action Allow
```

Providers often run a network firewall in front of your server too — open the ports there as well. At home, forward 30120 TCP and UDP on the router to your PC’s local IP.

## Testing the port

*From another machine*

```bash
curl http://<server-ip>:30120/info.json
```

A JSON response means TCP works. UDP cannot be tested this simply — if `/info.json` works but players still time out, UDP is blocked. Also check that `sv_requestParanoia` is not set so high that info requests are refused.

## Questions

### What port does FiveM use?

30120, on both TCP and UDP.

### What port does txAdmin use?

40120 TCP by default.

### How do I change my FiveM server port?

Change the port in both `endpoint_add_tcp` and `endpoint_add_udp` in server.cfg.

### Do I need to open the database port?

No. Keep 3306 closed; the server connects to the database locally.

### How do I run two FiveM servers on one machine?

Give each a different game port (30120, 30121…) and a different txAdmin port.

## Related

- https://fam-tools.com/guides/fivem-linux-server-setup
- https://fam-tools.com/guides/fivem-windows-server-setup
- https://fam-tools.com/guides/fivem-ddos-protection
- https://fam-tools.com/guides/txadmin-setup-guide
