01
What a domain name brings
A name like play.example.com is easier to remember than an IP address, and it survives a move: if the server changes address, you edit the DNS record and your players keep the same command. It is the address to pin on your Discord and your website.
Two limits to know from the start:
- The name does not hide the IP address. Anyone can find it by querying DNS. Protection against attacks is a separate topic: see protecting a game server against DDoS.
- The name does not put the server in the FiveM list. The list depends on the licence key and on the server's page on the Cfx.re portal (see below).
02
Create the A record
In your domain's zone editor, add an A record:
- Name (or host): a subdomain, for example
play, which gives play.example.com;
- Value: the server's public IPv4 address, the one after
endpoint_add_tcp and endpoint_add_udp, or the one shown by your host;
- TTL: 3600 seconds is fine; 300 if you plan to change the address soon.
If your domain uses a DNS service that offers a proxy (Cloudflare's "orange cloud", for example), set this record to "DNS only". With the proxy, the name points to that service's servers and not to yours, and game traffic is not relayed. The only proxy setup provided by Cfx.re is described in the last part.
Check the record from a terminal with dig +short A play.example.com (or nslookup play.example.com on Windows): the command should print the server's IP address. A new record usually answers within a few minutes; a change can take until the TTL of the old answer runs out.
03
Connect with F8
In FiveM, press F8 to open the game console, then type:
connect play.example.com
According to the Cfx.re documentation, a name typed without a port is completed with port 30120, the default port of FiveM servers. If your server listens on another port, add it:
connect play.example.com:30121
Before giving the address to your players, test it in a browser: http://play.example.com:30120/info.json should display the server's information in JSON format. If this test fails while connecting by IP address works, the DNS record is at fault. If it also fails by IP address, port 30120 is not open in TCP and UDP: see game server ports.
The server's port is set in the endpoint_add_tcp and endpoint_add_udp lines of server.cfg, explained in the guide FiveM server.cfg.
04
What about an SRV record?
For Minecraft, an SRV record lets you hide a port other than the default one (see the SRV record for Minecraft). For FiveM, the official Cfx.re documentation describes no SRV record: its page on proxies, which details how the game finds a server, only mentions the address provided by the list, an IP address or a name, with or without a port, and a web address.
Unofficial tutorials still suggest an SRV record for FiveM. Without Cfx.re documentation, we do not recommend it: undocumented behaviour can change without notice. The two safe ways are:
- keep the server on port 30120, so that
connect play.example.com is enough;
- otherwise, give the full address with the port,
connect play.example.com:30121, or the server's cfx.re/join link.
05
The cfx.re/join link, the list and proxies
The cfx.re/join link. A server listed in the FiveM list has a short code, the one of its page in the list. The command connect cfx.re/join/ followed by the code works in F8, and the link https://cfx.re/join/ followed by the code can be shared on Discord. This code is tied to the server's licence key. txAdmin can show it in the status message of its Discord bot: see showing your server's status on Discord.
The page in the list. The name, description, tags and icon shown in the list are now set on the Cfx.re portal (portal.cfx.re), with the account that owns the key. If the server does not appear, follow the guide FiveM server missing from the list.
Proxies. The Cfx.re documentation (Proxy Setup page) describes an advanced setup: an HTTPS web proxy on port 443, for example behind Cloudflare with nginx, receives the first step of the connection and passes it on to the server. It comes with server.cfg settings:
sv_forceIndirectListing true: the list no longer advertises the server with its real IP address;
sv_listingHostOverride: the name the list queries instead of the IP address;
sv_proxyIPRanges: the proxy's addresses, allowed to pass on the players' real address;
sv_endpoints: the address and port, or the game proxies, that players then use to play.
This setup only handles the connection: the game itself then goes through the address given in sv_endpoints, directly or through a separate TCP and UDP proxy. For an ordinary server, add none of these lines: a simple A record is enough.
06
On CloudFive
On a FiveM hosting plan, from €2.50 a month, the server's IP address and port are shown in the customer area manager.cloudfive.fr: these are the values to use for the A record and the connect command. txAdmin is included, ESX, QBCore or Qbox install in one click, and Anti-DDoS Premium is included, with a profile specific to FiveM.
The shared Patreon key we provide at no extra cost, limited to 48 players, is unlisted: the server does not appear in the public list and your players connect by its address, which is where a domain name helps. For the list and its cfx.re/join link, set your own key (see FiveM licence key). If your domain is with us, its name servers are free and its zone is managed in the customer area.
07
Frequently asked questions
How do I connect to a FiveM server with a domain name?
Create an A record pointing a name, for example play.example.com, to the server's IP address. In FiveM, open the console with F8 and type connect play.example.com. If the server does not use port 30120, add it: connect play.example.com:30121.
Do I need to type port 30120 after the domain name?
No. According to the Cfx.re documentation, a name typed without a port is completed with port 30120. You only need to write it if the server listens on another port.
Can I use an SRV record for FiveM?
The official Cfx.re documentation describes no SRV record for FiveM. So we do not recommend it: keep port 30120 so the name is enough, or give the address with its port, or the server's cfx.re/join link.
Does a domain name hide my FiveM server's IP address?
No. Anyone can find the IP address from the name. The proxy setup described by Cfx.re hides the address in the list, but it is meant for advanced configurations; against attacks, what matters is the server's anti-DDoS protection.
Why does my domain name not work in F8?
Check that dig or nslookup returns the server's IP address, that the DNS service's proxy is disabled on the record, and that the port is right. Also open http://play.example.com:30120/info.json in a browser: if it shows nothing, the problem comes from DNS or ports.