Configure a domain for FiveM (SRV)
This guide explains how to configure a custom domain for your FiveM server using an SRV record.
Prerequisites​
- A domain name (e.g.,
myserver.com) - Access to your registrar's DNS panel or Cloudflare
- Your FiveM server IP address and port
Step 1: Create an A record​
First, create an A record pointing to your server's IP:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | fivem | YOUR_SERVER_IP | Auto |
Example:
| Type | Name | Value | TTL |
|---|---|---|---|
| A | fivem | 51.91.123.45 | Auto |
Step 2: Create an SRV record​
Then add an SRV record with the following parameters:
| Field | Value |
|---|---|
| Type | SRV |
| Name | _cfx._udp |
| Service | _cfx |
| Protocol | UDP |
| Priority | 0 |
| Weight | 0 |
| Port | YOUR_SERVER_PORT (e.g., 30120) |
| Target | fivem.yourdomain.com |
Complete example:
| Type | Name | Priority | Weight | Port | Target | TTL |
|---|---|---|---|---|---|---|
| SRV | _cfx._udp | 0 | 0 | 30120 | fivem.myserver.com | Auto |
Step 3: Wait for DNS propagation​
DNS propagation can take from a few minutes to 24 hours. You can verify with:
nslookup -type=SRV _cfx._udp.yourdomain.com
Step 4: Connect​
Once propagation is complete, players can connect with:
connect yourdomain.com
tip
With a properly configured SRV record, players no longer need to specify the port!
Cloudflare configuration​
If you're using Cloudflare:
- Go to DNS > Records
- Click Add record
- For the A record:
- Type:
A - Name:
fivem - IPv4:
SERVER_IP - Proxy: Disabled (grey cloud)
- Type:
- For the SRV record:
- Type:
SRV - Name:
_cfx._udp - Priority:
0 - Weight:
0 - Port:
30120 - Target:
fivem.yourdomain.com
- Type:
warning
Cloudflare proxy (orange cloud) must be disabled for the A record used by FiveM, otherwise the connection will not work.
Common issues​
Connection doesn't work​
- Check that Cloudflare proxy is disabled
- Wait for DNS propagation (up to 24h)
- Verify the port is correct
"Could not resolve host" error​
- DNS record hasn't propagated yet
- Check domain spelling
- Verify SRV record configuration