---
title: "Using a Domain Name for Your Server (DNS + connect)"
excerpt: "How to point a domain at your CS 1.6 server so players connect by name instead of a raw IP, why GoldSrc resolves hostnames, the A-record setup, and the non-default-port caveat."
category: "hosting"
tags: "dns, hosting"
image: ""
read_time: "8 min read"
---
<p>Handing players a raw <code>203.0.113.10:27015</code> is fragile: it is hard to remember, hard to type, and if your server ever changes IP every advert and forum post is suddenly dead. A domain fixes both problems — players connect to <code>play.yourserver.net</code>, and if the IP changes you update one DNS record instead of chasing every listing. GoldSrc resolves hostnames in the <code>connect</code> command, so this works with no client-side setup. Here is how to wire it up.</p><h2>1. Point an A record at your server IP</h2><p>In your domain registrar or DNS provider, create an <strong>A record</strong> mapping a subdomain to your server's public IPv4 address:</p><pre>Type: A
Name: play (becomes play.yourserver.net)
Value: 203.0.113.10
TTL: 3600</pre><p>Use a subdomain like <code>play</code> or <code>cs</code> rather than the bare domain so you keep the root free for a website. Keep the TTL moderate (an hour); if you plan to move servers soon, drop it to 300 seconds a day ahead so the change propagates fast when you flip it.</p><h2>2. Connect by name from the console</h2><p>Once DNS has propagated, the game resolves the name exactly like an IP. In the client console:</p><pre>connect play.yourserver.net</pre><p>The engine looks up the A record, gets <code>203.0.113.10</code>, and connects to the default port 27015. This is the same <code>connect</code> flow as <a href="/tutorials/cs16-connect-via-console">connecting via console</a> — the only difference is a name in place of the number.</p><h2>3. Handle a non-default port</h2><p>Here is the trap. DNS resolves names to IP addresses only — it carries no port. If your server runs on anything other than 27015, players must still append the port after the resolved name:</p><pre>connect play.yourserver.net:27016</pre><p>A plain A record cannot hide a non-default port. If you run several servers on one box (see <a href="/tutorials/multiple-cs16-servers-one-vps">multiple servers on one VPS</a>), give each a memorable subdomain pointing at the same IP, and publish each with its port. Do not expect an SRV record to help here; the GoldSrc client does not consult SRV records for game connections, so the port must be in the connect string.</p><h2>4. Keep the hostname and domain consistent</h2><p>Set the in-game <code>hostname</code> and advertise the domain together so players associate the two:</p><pre>hostname "YourServer.net | Classic CS 1.6"</pre><p>Put the connect domain in your <a href="/tutorials/motd-txt-html-guide">MOTD</a>, GameTracker page, and Discord. When everything points at <code>play.yourserver.net</code>, a future IP move is a one-record edit rather than a re-advertising campaign.</p><h2>5. Home hosting with a changing IP</h2><p>If you host from a home connection, your ISP may hand you a dynamic IP that changes on reconnect — a static A record goes stale every time it moves. The fix is dynamic DNS: a small updater client on the host machine (or built into your router) watches the public IP and rewrites the A record automatically whenever it changes, so <code>play.yourserver.net</code> always tracks the current address. Many DNS providers support this on a subdomain. Home hosting has other trade-offs — upload bandwidth, NAT port-forwarding, and no DDoS filtering — but for a small server among friends, dynamic DNS keeps a memorable name working through IP churn without manual edits.</p><h2>6. If you use DDoS protection or a proxy</h2><p>Filtered hosting often gives you a protected IP or hostname that fronts your real server. In that case the A record should point at the <strong>protected</strong> address, not your origin, or you defeat the filtering. See <a href="/tutorials/ddos-protected-hosting">DDoS-protected hosting</a> for how the proxy address relates to your origin; the domain always advertises the front, never the box behind it.</p><h2>Common errors</h2><ul><li><strong><code>connect</code> hangs then fails on the name but works on the IP</strong> — DNS has not propagated yet, or the A record has a typo. Wait for the TTL, then re-check the record value.</li><li><strong>Name resolves but connection is refused</strong> — the port is wrong or blocked. A non-default port must be in the connect string, and the firewall must pass that UDP port; see <a href="/tutorials/cs16-server-firewall-ports">server firewall ports</a>.</li><li><strong>Works for you, not for others</strong> — you have a local hosts-file entry or cached DNS; others hit the real record. Verify the public record with a DNS lookup, not your own machine.</li><li><strong>Points at the wrong server after a move</strong> — you updated the server but not the A record. The domain is the source of truth; update it whenever the IP changes.</li><li><strong>Tried an SRV record for the port</strong> — GoldSrc ignores SRV for game connects. Publish the port explicitly.</li></ul><h2>Verification</h2><p>From a machine that is not yours, resolve the name and confirm it returns your server IP, then run <code>connect play.yourserver.net</code> (with the port if non-default) and confirm you land on the server. Change the in-game map and confirm the domain still connects — it should, since nothing about the map affects DNS. Finally, simulate a move on paper: if you had to change IP, confirm you know exactly which one A record to edit. If that record is the only thing you would touch, the domain is doing its job.</p>