How to get HLDS to work over the internet

counter-strike

I'm trying to make counter-strike 1.6 dedicated server.

When I run HLDS.exe, I choose Internet but the server is only running on a local IP address.

How do I get it to work over the internet, not just my local network?

Best Answer

On most home networks, there's only one "public" IP address, and it's assigned to whatever's connected directly to your cable or DSL modem. This device is usually a router of some sort.

This router box "shares" the single IP with all the devices on your local network through a set of technologies and protocols called Network Address Translation, or NAT.

NAT works seamlessly when computers on your local network are making connections to the internet, but it usually requires configuration if computers on the internet want to make connections to your local network. This configuration is typically referred to as "port forwarding."

For every server port you wish to make available to the internet on one of your local machines, you'll need to set up a port forwarding rule. The way you do this depends on your router make and model, so you'll want to read the documentation that came with your router. I believe some people have used PortForward.com when their documentation wasn't readily available.

The port you'll want to forward is probably 27015, although this is configurable on the command line to HLDS.exe, so it might vary. You'll want to forward it to the IP address of the local machine that is running the server.

For instance, if your local machine's IP is 192.168.0.50, and you've got HLDS set up on 27015, you'd need to set the router up to forward both TCP and UDP on 27015 to IP address 192.168.0.50.

Then, your friends over the internet could connect to your server by specifying your internet IP address (which is the IP address your router is getting from the modem) and port 27015.

There are a lot of thorny network issues that can also get in the way here. Be prepared to do some experimentation, as this is likely to be a learning experience for you :)