Skip to main content

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:

TypeNameValueTTL
AfivemYOUR_SERVER_IPAuto

Example:

TypeNameValueTTL
Afivem51.91.123.45Auto

Step 2: Create an SRV record​

Then add an SRV record with the following parameters:

FieldValue
TypeSRV
Name_cfx._udp
Service_cfx
ProtocolUDP
Priority0
Weight0
PortYOUR_SERVER_PORT (e.g., 30120)
Targetfivem.yourdomain.com

Complete example:

TypeNamePriorityWeightPortTargetTTL
SRV_cfx._udp0030120fivem.myserver.comAuto

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:

  1. Go to DNS > Records
  2. Click Add record
  3. For the A record:
    • Type: A
    • Name: fivem
    • IPv4: SERVER_IP
    • Proxy: Disabled (grey cloud)
  4. For the SRV record:
    • Type: SRV
    • Name: _cfx._udp
    • Priority: 0
    • Weight: 0
    • Port: 30120
    • Target: fivem.yourdomain.com
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