Guest User

ARK Private Server Port Forward Setup

a guest
Jun 8th, 2015
3,576
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.72 KB | None | 0 0
  1. I've dug this forum six ways to Sunday trying to get it figured out. A dozen half/badly written wiki pages, various people with seemly random success stories, and etc. I've finally got it nailed down, working, and repeatable. Here's the scoop on how to have the ARK server running on your PC, along with a game session connected to it (from the same PC), and allowing external connections from both LAN and internet.
  2.  
  3. HOW TO: (version 171.74)
  4.  
  5. STEP 1
  6.  
  7. As other people have referenced around the web, having a server startup .bat file is helpful/essential. Here's mine, executed from:
  8.  
  9. $STEAM_INSTALL_DIR$\steamapps\common\ARK\ShooterGame\Binaries\Win64\ARKServerStart.bat
  10.  
  11. [code]
  12. start ShooterGameServer.exe TheIsland?QueryPort=27015?SessionName=GenericSessionName?MaxPlayers=10?listen?ServerPassword=ConnectPass?ServerAdminPassword=AdminPass? -nosteamclient -game -server -log
  13. exit
  14. [/code]
  15.  
  16. Sadly, I do NOT know what good the extra command options at the end mean, since they don't seem to have made much impact in previous attempts (-nosteamclient, -game, -server, -log). But for right now they don't make the setup fail so I'm leaving them in.
  17.  
  18. STEP 2 - Windows firewall
  19.  
  20. Accept it if prompted by windows to allow traffic through the firewall for 'shootergameserver.exe'. Full disclosure - I'm not sure if this next step makes an impact but it certainly can't hurt, as mentioned earlier this is how I'm setup and it's functional for both LAN connections and internet.
  21.  
  22. Open windows firewall in the control panel and click 'Advanced settings' near the bottom of the left-side pane. Click on 'Inbound Rules' and then 'New Rule' on the right pane, select Port -> UDP -> Specific local ports (enter '7777, 7778, 27015') -> Allow the connection -> (check in all boxes) -> name it what you want (I did 'ARK: Server Ports' just so it gets grouped with the other game entries) ->FINISH
  23.  
  24. This much configuration allowed LAN connections to join my sessions just fine. So if all you want is LAN, you're done with configuration.
  25.  
  26. STEP 3 - Internet connection
  27.  
  28. This will vary depending on your equipment. I personally run a Linux server in my closet with iptables and masquerading/NAT, but the ports are still entirely relevant if not the exact instructions. ANYWAY..
  29.  
  30. While I was trying to figure out why my LAN connections worked but internet did not, I went through the trouble of doing tcpdump captures on the firewall box and wireshark on my windows system. What I found is that it seems like the game client does a port-knocking technique before the server answers. Ever time my LAN client would look for the server it would hit things in the following order :
  31.  
  32. [code]
  33. $CLIENT QUERY SERVER$ -> 27015, 26900, 27016, 26901, 27017, 26902, 27018, 26903, 27019, 26904, 27020, 26905, 4242, 27215 -> $SERVER FINALLY RESPONDS$
  34. [/code]
  35.  
  36. After that last magical '27215' my server would talk back via 27015 and they'd negotiate the password/auth and login. Long story short - I enabled/forwarded these ports to my PC running the server (ALL UDP)
  37.  
  38. 4242
  39. 7777-7778
  40. 26900-26905
  41. 27015-27020
  42. 27215
  43.  
  44. For a point/click interface on your average internet gateway device this should be fairly simple - read your manuals. For my fellow Linux admins out there, here's my iptables ruleset:
  45.  
  46. NOTE-1 - eth2 is my internet facing device, eth0 is my private network device. Obviously change whatever your own PC IP is out for the 192.168.1.15 down below.
  47.  
  48. NOTE-2 - my firewall is white-list only, so I have default traffic drop rule at the end. If yours is the other way around (accept all, black list specific things like http and telnet), make sure you don't have these ports blocked by one of your rules, modify accordingly.
  49.  
  50. [code]
  51. iptables -A INPUT -i eth2 -p udp -m udp --dport 4242 -j ACCEPT
  52. iptables -A INPUT -i eth2 -p udp -m udp --dport 7777:7778 -j ACCEPT
  53. iptables -A INPUT -i eth2 -p udp -m udp --dport 26900:26905 -j ACCEPT
  54. iptables -A INPUT -i eth2 -p udp -m udp --dport 27015:27020 -j ACCEPT
  55. iptables -A INPUT -i eth2 -p udp -m udp --dport 27215 -j ACCEPT
  56. [/code]
  57.  
  58. NOTE-3 - the above just allows the traffic to hit your world-facing IP without getting dropped. Now we need to allow it to traverse networks with these 'FORWARD' rules (again, because I have a white-list only firewall, any traffic not explicitly allowed is dropped):
  59.  
  60. [code]
  61. iptables -A FORWARD -i eth2 -p udp --destination-port 4242 -d 192.168.1.15 -j ACCEPT
  62. iptables -A FORWARD -i eth2 -p udp --destination-port 7777:7778 -d 192.168.1.15 -j ACCEPT
  63. iptables -A FORWARD -i eth2 -p udp --destination-port 26900:26905 -d 192.168.1.15 -j ACCEPT
  64. iptables -A FORWARD -i eth2 -p udp --destination-port 27015:27020 -d 192.168.1.15 -j ACCEPT
  65. iptables -A FORWARD -i eth2 -p udp --destination-port 27215 -d 192.168.1.15 -j ACCEPT
  66. [/code]
  67.  
  68. NOTE-4 - and finally - you need to setup NAT rules to mangle packets so they now how to travel properly to and then have a legitimate return path once they are done. Replace aa.bb.cc.dd with whatever your world-facing IP is.
  69.  
  70. [code]
  71. iptables -t nat -A PREROUTING -p udp -d aa.bb.cc.dd --dport 4242 -j DNAT --to-destination 192.168.1.15
  72. iptables -t nat -A PREROUTING -p udp -d aa.bb.cc.dd --dport 7777:7778 -j DNAT --to-destination 192.168.1.15
  73. iptables -t nat -A PREROUTING -p udp -d aa.bb.cc.dd --dport 26900:26905 -j DNAT --to-destination 192.168.1.15
  74. iptables -t nat -A PREROUTING -p udp -d aa.bb.cc.dd --dport 27015:27020 -j DNAT --to-destination 192.168.1.15
  75. iptables -t nat -A PREROUTING -p udp -d aa.bb.cc.dd --dport 27215 -j DNAT --to-destination 192.168.1.15
  76. [/code]
  77.  
  78. ALMOST THERE!!!
  79.  
  80. Now - before you try to fire up a server and go to town, you'll want to do a couple things:
  81.  
  82. 1 - start the game client, pick 'host/local' and set the server options how you want (difficulty, hardcore, PvE, map, etc). Then instead of picking 'local' you pick 'host' and your client will close and the server will start up. This is important because if you haven't done it before the game will spawn ini files and etc. Give it about 10 minutes (check task manager for 'shootergameserver.exe' and make sure it's got about 4-5gb memory taken up) and then just close the window.
  83.  
  84. 2 - NOW is when you can kick off that .bat file from way back at the beginning. Shortcut it to your desktop or something to save you digging through the folders to find it.
  85.  
  86. 3 - For yourself and LAN folk, you should be able to just start the game client and choose 'Join ARK' and then find the little drop down in the lower left (official, unofficial, etc) and choose 'LAN'. Bingo, you're in. For internet it's a bit more fussy because the public server lists are horrid to search through. Give a link like this to your friends:
  87.  
  88. steam://connect/aa.bb.cc.dd:27015
  89.  
  90. This will target them directly to your system. If they are using normal settings (not low memory) they can login and play immediately. If using one of the alternate bootstrap options is needed - have them login via the URL and create a throw-away character (just hit 'create' for the default caveman), then once they're in the game quit out completely and start through the steam interface and pick the necessary low mem/alt option.
  91.  
  92. When they want to get back to your system, pick 'My Survivors' rather than 'LAN' from the drop down and their session should be found - once they login just have them get eaten by a dino and they can create a new character on the spot.
  93.  
  94. I hope this helps a bunch of folk, because it's had me banging my head on the desk for nearly a week and cussing the devs out for not providing documentation. I am a sysadmin for a living so I wasn't going to let this shit defeat skills I've been honing for the past 15 years - :]
  95.  
  96. DEVS: If you're reading this - I STILL WANT PROPER DOCUMENTATION but hopefully this will prove useful for getting other people up and running.
Add Comment
Please, Sign In to add comment