Volume 2 Modifying Server For External Access: Difference between revisions

From OuroDev
Red Nile (talk | contribs)
Added information on configuring to use a free dynamic DNS
Red Nile (talk | contribs)
Changed this guide to focus on setting up your server with either your Local IP or your Public IP, to be connected to by clients either from your LAN or from the internet.
 
Line 1: Line 1:
== Prerequisites ==
== Prerequisites ==
* Make sure you complete all of the steps in [[Volume_2_Server_Setup|Volume 2 Getting Started]] first.
* Make sure you complete all of the steps in [[Volume_2_Server_Setup|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.
* 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.
* 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.
Line 27: Line 27:
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.
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 ==
== Set local or public IP for the authserver ==


The public IP address for your server needs to be set in the cohauth database.
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):
In SQL Server Manager Studio(SSMS):
# Select File->New->Query with Current Connection
# Select File->New->Query with Current Connection
# Paste the following code into the window, and change "1.2.3.4" into the Public IP for your server.  <syntaxhighlight lang="sql">UPDATE cohauth.dbo.server SET ip=1.2.3.4 WHERE ID=1;</syntaxhighlight>
# Paste the following code into the window, and change "1.2.3.4" into the local or public IP for your server.  <syntaxhighlight lang="sql">UPDATE cohauth.dbo.server SET ip=1.2.3.4 WHERE ID=1;</syntaxhighlight>
# Click on Execute.  You should get a message "(1 row affected)" if it succeeded.
# 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=1.2.3.4 (should be your Public IP here).
# 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 public IP in servers.cfg ==
== Set local or public IP in servers.cfg ==


The public IP address for your server needs to be set in the C:\Ouroboros\data\server\db\servers.cfg file.
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:
Add the line:
  AdvertisedIp 1.2.3.4
  AdvertisedIp 1.2.3.4
Where you replace 1.2.3.4 with the Public IP address that was set in cohauth.dbo.server above.
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 ==
== Relaunch server ==
Line 59: Line 59:
  Ouroboros -auth 1.2.3.4 -console -fullscreen 0
  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.
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.
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.
Line 72: Line 72:


== (Optional) Dynamic DNS setup ==
== (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.  Duck DNS is one that is known to work, but any of the services should work.
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.
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.

Latest revision as of 18:29, 3 July 2019

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.