Volume 2 Modifying Server For External Access

From OuroDev
Revision as of 09:11, 20 June 2019 by Red Nile (talk | contribs) (Moved the part about using a second public IP to its own section for readability)

Prerequisites

  • Make sure you complete all of the steps in Volume 2 Getting Started first.
  • 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.

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

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 public IP for the authserver

The public IP address for your server, 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 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 Public IP here).

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