Volume 2 Modifying Server For External Access

From OuroDev

Prerequisites

  • 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.

IP addresses

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.

Port forwarding

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):

  1. Select File->New->Query with Current Connection
  2. Paste the following code into the window, and change "1.2.3.4" into the local or public IP for your server.
    UPDATE cohauth.dbo.server SET ip=1.2.3.4 WHERE ID=1;
    
  3. Click on Execute. You should get a message "(1 row affected)" if it succeeded.
  4. 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=1.2.3.4 (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:

AdvertisedIp 1.2.3.4

Where you replace 1.2.3.4 with the same local or public IP address that was set in cohauth.dbo.server above.

Relaunch server

The following servers need to be manually started, in this order:

  1. authserver.exe
  2. dbserver.exe
  3. launcher.exe

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 1.2.3.4 -console -fullscreen 0

Where you replace 1.2.3.4 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.

Troubleshooting

  • 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 "1.2.3.4" public IP addresses in the instructions on this page.