Volume 2 Modifying Server For External Access
- 1 Prerequisites
- 2 IP addresses
- 3 Port forwarding
- 4 Shut down server
- 5 Set local or public IP for the authserver
- 6 Set local or public IP in servers.cfg
- 7 Relaunch server
- 8 Connecting a client to the server
- 9 Troubleshooting
- 10 (Optional) Using a second public IP address for your server
- 11 (Optional) Dynamic DNS setup
- Make sure you complete all of the steps in Volume 2 Getting Started first, and have a server which is working on 127.0.0.1.
- If you have a networking setup with a modem connected to a router, your modem needs to be in bridged mode.
- Your router needs to support the Network Address Translation (NAT) loopback feature, with that feature turned on in order for you to be able to connect to your server from within your own Local Access Network (LAN). Without that feature, the CoH server will only allow connections from outside your LAN. NAT loopback is also known as NAT hairpinning or NAT reflection.
There are 3 IP addresses you need to know.
- Localhost, or 127.0.0.1: this is the generic IP address that works on any computer, which is only used for a computer to connect to itself. Most of the IP addresses in the .cfg files are set to this.
- Local IP address, in the form of 192.x.x.x (replace the x's with numbers). This is the IP address that other computers on a LAN can connect to. Cannot be connected to by any computers from outside the LAN. You can find this by opening a command prompt and typing "ipconfig". It will show up as your IPv4 address.
- Public IP address. This is the IP address that other computers from outside your LAN can connect to. Usually there is a single public IP address for your router. Other people will connect to this public IP address, and then the traffic on ports will either be forwarded along to specific computers within your LAN , or blocked by the router. The easiest way to find your Public IP address is to google for "What's my IP", the search results will find sites that show you what it is.
- Note about domains: If you have your own domain, you can substitute your domain instead of your Public IP address in these instructions. The benefit of this is that the domain name will never change even if the IP address it is referring to does change. See #(Optional) Dynamic DNS setup for more details.
Set up port forwarding on your router, so that traffic arriving at your public IP address and meant for your CoH server is allowed through the router and sent to your server. This is done by connecting to the Admin page for your router in a web browser (usually 192.168.1.1, may differ slightly depending on the brand of router), and setting up port forwarding rules (often under the WAN section).
Set up 2 port forwarding rules, with the external ports as below and the Local IP Address as that of your CoH server (192.x.x.x, replace the x's with your address).
- External Port 2106, Protocol: TCP
- External Ports 7000 through 7200 (usually set as 7000:7200 in the settings), Protocol: UDP
See Volume 2 Ports for more details on which ports are used by the various servers.
Shut down server
If your CoH servers are running, shut them down before the next steps. The easiest way might be to switch to each window (click on the icons in the windows taskbar) and press Ctrl+C to stop them. I find shutting down the launcher.exe first is best, or it might keep restarting new processes as you try to shut down the other servers. The order of shutting them down doesn't matter after that.
Set local or public IP for the authserver
Here you need to decide if you want to set up your server to be accessible only to client machines within your own LAN, in which case you should use your local IP. Or if you want to to be accessible by clients on the internet, in which case you should use your public IP. Whichever IP you choose needs to be set in the cohauth database.
In SQL Server Manager Studio(SSMS):
- Select File->New->Query with Current Connection
- Paste the following code into the window, and change "22.214.171.124" into the local or public IP for your server.
UPDATE cohauth.dbo.server SET ip=126.96.36.199 WHERE ID=1;
- Click on Execute. You should get a message "(1 row affected)" if it succeeded.
- Verify that your settings are correct. In the Object Explorer in SMSS, expand SQLEXPRESS>Databases>cohauth>Tables. Right-click on dbo.server, and select "Select Top 1000 Rows". This should show you the entry for your server, with id=1, name=ShardName (Paragon by default), ip=188.8.131.52 (should be your local or public IP here).
Set local or public IP in servers.cfg
The local or public IP address for your server needs to be set in the C:\Ouroboros\data\server\db\servers.cfg file. Add the line:
Where you replace 184.108.40.206 with the same local or public IP address that was set in cohauth.dbo.server above.
The following servers need to be manually started, in this order:
The rest of the servers are started by loadBalanceShardSpecific.cfg.
Connecting a client to the server
Launch the client with the following parameters:
Ouroboros -auth 220.127.116.11 -console -fullscreen 0
Where you replace 18.104.22.168 with the local or public IP address that was set in cohauth.dbo.server above.
Watch the console for messages about if your connections to the server succeed or not, particularly when you click on Login, and when you click on your server in the server list. Those are the common points of failure.
- If you are unable to login at all, and your console shows a failure to connect to the auth server, make sure the auth server is running. If it is, then probably your port forwarding on your router is not working, or your modem is not set to bridged mode.
- If you are able to login, but you get a "Can't connect to DBserver error" when you click on your server in the server list, then NAT loopback is probably either disabled in your router settings, or is not supported by your router at all.
(Optional) Using a second public IP address for your server
One way to get around a router which does not support NAT loopback is to use a second public IP address for your server, if your internet provider supports that. Usually this is done by plugging your server directly into the second ethernet port on your modem, then rebooting the server. If your internet provider supports this, you will then have the old public IP address still being provided to your router and your LAN as before. And your CoH server will then get a second public IP address provided for it. The server will then be outside of your LAN entirely, exposed to the internet and not protected by your router's firewall. Make sure you have your windows firewall enabled on the server. You will not need to forward any ports to your server.
(Optional) Dynamic DNS setup
If you're hosting a server from a machine that you own, chances are that you've got a dynamic public IP address that can change from time to time, usually after a power outage or reboot of your modem. Which then makes you have to change your settings to the new IP address. You can get around this through use of a Dynamic DNS service. There are free ones out there which you can register your server with, and download a lightweight client which periodically contacts the DNS service to confirm your current IP address or notify that it has changed. They are usually very easy to set up, just register and then add a new domain name with them, and optionally download and install any client they might provide. Duckdns.org is one that is known to work, but any of the services should work.
Once set up with a domain name for your server, you can then use your new "examplename.domain.org" in place of the "22.214.171.124" public IP addresses in the instructions on this page.