How to Port Forward Half-Life 2 Steam Server
In this article
Port forwarding your Half-Life 2 server lets friends join your game directly over the internet, bypassing the need for a third-party hosting service. You'll need access to your router's admin panel and a static or reserved local IP for your PC. Below are the exact steps for Steam version of Half-Life 2 (including Episode One and Two, and the Source engine).
What You'll Need
- Your router's admin username and password (often printed on the router or in its manual).
- Your PC's local IP address (e.g., 192.168.1.10).
- The port numbers used by Half-Life 2: TCP 27015 (game traffic) and UDP 27015 (for Steam query). Some guides also mention UDP 27020 (Source TV) and UDP 26900 (Steam matchmaking), but for a basic server, 27015 TCP/UDP is enough.
- Optional: A static IP reservation for your PC in the router's DHCP settings, so the IP doesn't change.
Step-by-Step
- Find your PC's local IP address. On Windows, open Command Prompt (Win+R, type
cmd, press Enter) and runipconfig. Look for "IPv4 Address" under your active network adapter (e.g., 192.168.1.10). Write it down. - Set a static IP (recommended). To prevent your IP from changing, either set a static IP in Windows network settings or, better, reserve the IP in your router's DHCP reservation list. The exact menu varies by router, but it's usually under "DHCP" or "LAN Setup." Enter your PC's MAC address (found via
ipconfig /all) and the IP you want to keep. - Log into your router's admin panel. Open a web browser and enter your router's IP (often 192.168.1.1 or 192.168.0.1). Enter the admin username and password. If you don't know them, check the router's label or manual. Common defaults are "admin/admin" or "admin/password."
- Find the port forwarding section. Look for "Port Forwarding," "Virtual Server," or "NAT" in the router's menu. The exact name varies by router brand (e.g., TP-Link, Netgear, Asus).
- Create a new port forwarding rule. Click "Add" or "Create New." You'll need to enter:
- Service name: e.g., "HL2 Server" (any name is fine).
- Protocol: TCP and UDP (or "Both" if available).
- External port: 27015 (the port people will connect to).
- Internal port: 27015 (same as external, unless you change the server port).
- Internal IP: your PC's local IP (e.g., 192.168.1.10).
- Save and apply the rule. Click "Save" or "Apply." Some routers require a reboot; others apply instantly.
- Configure your Half-Life 2 server. If you're hosting a listen server (from within the game), go to Options > Keyboard/Mouse > Advanced, and enable "Allow developer console." Then press ~ to open the console and type
sv_lan 0to make the server public. If you're using a dedicated server (HLDS or srcds), add-port 27015to the launch options and setsv_lan 0in the server.cfg file. - Test the port forward. After starting your server, visit a port checking website (e.g., portchecker.co) and enter port 27015. If it says open, your forward works. Alternatively, ask a friend to try joining via your public IP (find it by searching "what is my IP" on Google).
Common Mistakes
- Using the wrong local IP. If your PC's IP changed after a reboot, the rule points to the wrong device. Always set a static/reserved IP.
- Only forwarding TCP or only UDP. Half-Life 2 uses both TCP and UDP on 27015. Forward both, or select "Both" if your router supports it.
- Forgetting to disable Windows Firewall. Windows may block incoming connections. Go to Control Panel > System and Security > Windows Defender Firewall > Allow an app through the firewall, and check both Private and Public for the game and/or srcds.exe.
- Using the wrong public IP. Your public IP changes unless you have a static IP from your ISP. Use a dynamic DNS service (like No-IP) to map a domain name to your IP.
- Router's "Port Triggering" instead of "Port Forwarding." Port triggering is different and won't work for a dedicated server. Use port forwarding specifically.
Tips
- Use a dedicated server for stability. Running a listen server (from the game) ties the server to your game client; if you close the game, the server closes. Download the dedicated server via Steam > Library > Tools > "Half-Life 2: Dedicated Server" (or "Source Dedicated Server").
- Set a static IP on your PC as well. Even if you reserve the IP in the router, also set a static IP in Windows to avoid conflicts. Go to Control Panel > Network and Sharing Center > Change adapter settings > right-click your adapter > Properties > Internet Protocol Version 4 (TCP/IPv4) > Properties and enter the IP, subnet mask (usually 255.255.255.0), and default gateway (your router IP).
- Use a dynamic DNS service. If your public IP changes, sign up for a free dynamic DNS hostname (e.g., yourname.ddns.net) and install the updater on your PC. Then friends can join via that hostname.
- Test with a friend on a different network. Local testing (using your LAN IP) doesn't confirm port forwarding. Always test from an external network.
Troubleshooting
If the port check shows closed, try these in order:
- Restart your router and PC. Sometimes the router needs a reboot to apply the rule.
- Check Windows Firewall. Temporarily disable it (Control Panel > Windows Defender Firewall > Turn off) and test. If it works, re-enable and add an exception for the game and srcds.exe.
- Confirm the server is actually listening. On the server PC, open Command Prompt and run
netstat -an | findstr 27015. You should see a line with "LISTENING" on 0.0.0.0:27015. If not, the server isn't bound to that port. - Check if your ISP blocks port 27015. Some ISPs block common game ports. Try forwarding a different port (e.g., 27016) and change the server's port accordingly. If that works, your ISP is blocking 27015.
- Try a different port. Change the external and internal ports to something like 27016, and in the server launch options use
-port 27016. Update the port forward rule accordingly. - Reset the router to factory defaults. If you've made many changes, a reset can clear conflicting rules. Note: this will erase all settings, so back up your config if possible.
Frequently Asked Questions
Do I need to forward both TCP and UDP?
Yes. Half-Life 2 uses TCP for game data and UDP for Steam query and matchmaking. Forward both to 27015.
Can I host a server without port forwarding?
No, not directly. Without port forwarding, external players can't reach your server. Alternatives include using a VPN (like Hamachi) or renting a dedicated server.
Why can I join my own server but my friend can't?
That's normal. Your own connection bypasses the router. The issue is external access, so test from a friend's network or use an external port checker.
What is the default port for Half-Life 2?
The default is 27015. You can change it with the -port launch option, but you must update the port forward rule accordingly.
Does my public IP change?
Yes, unless you have a static IP from your ISP. Use a dynamic DNS service to keep a consistent hostname.
Can I host a server on a laptop with Wi-Fi?
Yes, but Wi-Fi can be less stable. For better performance, use a wired Ethernet connection.