|
Introduction to Port Forwarding
|
|
Conventionally, people wanting to run any web service would run servers with a public IP address routable anywhere and viewable to anyone on the internet. With the advent and wide distribution of broadband connections, more people realize that they too want to run a small service to share with others out on the web. In this guide I'll attempt to explain what the limitations of home broadband routers are and how to successfully configure it to host an HLDS server.
Internet services rely on two different pieces of information to make a connection, an IP address and a port number. For example if you were to connect to http://www.vadakill.com with your web browser, your machine would first look up my domain via DNS (Domain Name Servers) and translate it to an IP address. It would then connect to the IP address of 208.28.184.222 and your browser, being as smart as it is, would automatically tack on port 80 as a default...you don't see it, but it's there. In this case my machine is directly connected to the Internet, it is using a public IP address and the server handles all requests itself.
Nowadays, most ISP's who have broadband service only allow a single public IP address per account. However, most people want to share the single broadband connection with multiple machines. To get around the single IP limitation many people purchase a broadband router designed for sharing this single public IP address with multiple private machines using DHCP addressing with NAT (Network Address Translation) routing.
Typically you would have the router do your authentication to your cable or DSL provider and it would hold the public IP address on one side. On the other internal side (your home side), it would have a pool of addresses to use to assign machines who ask for a connection out to the internet. If this is confusing, keep reading.
If I was behind a residential router/gateway most likely my router would give me a private IP address. Private IPs are generally not routed over the internet since they are set aside for Local Area Networks (LANs). The most common ranges for private IPs are 192.168.0.0 and 10.0.0.0 range. For this example my server machine will be 192.168.1.100, my internal gateway/router IP will be 192.168.1.1 and my public IP will be 208.28.184.222. Here's a general picture (bad text art ahead):
{The Internet}
||
DSL/CABLE connection
208.28.184.222 (public address the world sees)
||
ROUTER/GATEWAY
||
192.168.1.1 (Private address the LAN computers see as a way out)
||
192.168.1.100 (my server)
Because my server has a private IP address there is no way for a person to connect to my machine by typing in 192.168.1.100 since those IP addresses are generally not allowed to get past most internet routers. Instead we have to use the public IP address of 208.28.184.222 and somehow get the internal server machine to respond to it. To accomplish this task we use something called Port Forwarding. Port forwarding does what it sounds like it does, it forwards incoming packets of information from the internet that arrive on specific ports to a designated machine on the private LAN.
Ok, let's pretend that I'm consolidating my budget and recently purchased DSL for my home. I'm going to take my server off the direct connection and bring it home where I have my home PC that I use for work. My ISP was nice enough to let me keep 208.28.184.222 as my public IP address for my DSL so domain name lookups will still go to the same IP address. To work on my new network I need to reconfigure my server to use the new private IP addresses, when I finish it now uses 192.168.1.100. Since I want people to get web pages from my server machine I log into my router, go into the port forwarding section and tell it that anyone requesting information on 208.28.184.222 on port 80 let them go straight to 192.168.1.100 on port 80. Effectively I'm telling my router that if someone is looking for a connection on port 80 they really want the information from my server at 192.168.1.100. Hopefully this is clear by now.
|
What Ports to Forward
|
|
As far as I know the following ports need to be forwarded to your server's private IP address in order to host a HLDS server.
NOTE: Some people report success simply forwarding 27015 and nothing else, other people report problems with player time outs and other oddities. Since I've never set up a HLDS server behind a router I can't tell you from experience whether all of these ports are required to be open or not. If you can tell me WITHOUT A DOUBT what needs to be open and what protocol it uses please e-mail me at vadakill@vadakill.com and I'll update this guide.
HLDS ports to forward:
1200 UDP (for Steam)
6003 TCP
7002 TCP
27005 UDP
27010 UDP
27011 UDP
27015 UDP (for Internet clients to connect)
27040 TCP+UDP (hlds x.1.1.1, VAC)
|
Your HLDS Startup Command Line
|
|
Since you'll be starting your HLDS server on a private LAN and want people on the public internet to connect you need to register your server with WON. The information your server sends to WON is its best guess based on the information it can gather at startup. If you don't tell it otherwise the HLDS server will report your private IP address to WON which won't work at all. You need to override some of it's guesses by entering them in the command line at startup. Here's an example of how the command line should be laid out:
|
Code
|
./hlds_run -game ns +exec server.cfg +ip xxx.xxx.xxx.xxx +port 2701x +maxplayers 12 +map ns_eclipse
|
|
Here's an example of how I would get my private server to work with WON:
|
Code
|
./hlds_run -game ns +exec server.cfg +ip 208.28.184.222 +port 27015 +maxplayers 12 +map ns_eclipse
|
|
Hope the helps people out there. This guide isn't as polished as my other guides due to the fact I have no personal experience setting up a HLDS server though a broadband router. Let me know if you have a suggestion or comment about what is in this guide. Thanks! Good luck!
|
Further Information
|
|
I found the following sites to be helpful for many people, you may want to check these out if you are still having problems.
PortForward.com - Main Site
PortForward.com Router Configurations - Deals with many common residential routers and configurations.
PortForward.com common Ports - Common Ports for Games.
|
|