-
[Tutorial]Patch zone server to run it behind router
This is not the prettiest fix but it does the trick of running zoneserver behind router.
I assume you have gone through the trouble of setting up the server and making login and world servers WAN accessible.
The Conflict
Zone server IP ext_address from FFDB1 > serverstatus table is used by clients connecting to the zone server and by the zone server itself when it is starting. So we have two cases:
Case 1: ext_address is set to LAN IP
Zone server will start and will listen on ext_address LAN IP successfully.
When client selects the character to enter the game it will attempt to connect to ext_address LAN IP and in result it will fail.
Case 2: ext_address is set to WAN IP
Zone server will start but fail to listen on WAN IP because there won't be network interface with that IP available.
However, when client selects the character to enter the game it will attempt to connect to ext_address WAN IP.
Edit zoneserver
Open zoneserver with hex editor and do following:
Code:
Find: 0F 84 94 01 00 00 BF 18 00 00 00 4C 8D A4 24 E0
Replace with: 0F 85 94 01 00 00 BF 18 00 00 00 4C 8D A4 24 E0
Start the server
- Change FFDB1 > serverstatus > ext_address for zone server to WAN IP
- Start world server
- Change FFDB1 > serverstatus > ext_address for zone server to LAN IP
- Start zone server
The Workaround
My workaround simply tricks world server into sending WAN IP for the zone server, and because it loads that WAN IP address at startup we can change it in database for zone server to start with proper LAN IP.
Without the patch zone server will complain about ticket mismatch, and that is what patch does. It makes server ignore mismatched tickets.
Warning
The patch simply replaces jz (jump if zero) with jnz (just not zero). As a result this will make server think that tickets mismatch if zone server WAN IP that clients connects to and zone server LAN IP that server listens on do infact match.
Before
Code:
if ( v5 != ResolveTicket.ServerIP || lapis::CGlobalInfo::ZoneServerPort != ResolveTicket.ServerPort )
After
Code:
if ( v5 == ResolveTicket.ServerIP || lapis::CGlobalInfo::ZoneServerPort != ResolveTicket.ServerPort )
Disclaimer
Use at your own cost and risk. I do not guarantee this to work nor be safe or secure.
-
Re: [Tutorial]Patch zone server to run it behind router
-
Re: [Tutorial]Patch zone server to run it behind router
Seems like you do need to have the wan ip setup to the router ip and not the local vm ip. Just tried it out and the game can't connect to my local server without reverting back the changes.
Also your patch has been included in my program for easy patching. Good job.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
Seems like you do need to have the wan ip setup to the router ip and not the local vm ip. Just tried it out and the game can't connect to my local server without reverting back the changes.
Is your local VM on a different subnet than router?
-
[Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
Is your local VM on a different subnet than router?
If that means no internet connection then yes. I run the vm locally without internet.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
If that means no internet connection then yes. I run the vm locally.
So I think there is double routing/natting or something along those lines. I guess you have 192.168.0.0/24 as your primary lan at home and your VM is on different subnet setup by VMware, like 192.168.200.0/24 If so, why bother with it and not just bridge interfaces? Have VM on the same subnet as your home lan.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
So I think there is double routing/natting or something along those lines. I guess you have 192.168.0.0/24 as your primary lan at home and your VM is on different subnet setup by VMware, like 192.168.200.0/24 If so, why bother with it and not just bridge interfaces? Have VM on the same subnet as your home lan.
Ah, I see! The subnet is actually on 192.168.128.x. I'll give it a go later. Thanks man!
-
Re: [Tutorial]Patch zone server to run it behind router
Some terminology is getting misused and it's causing issues in trying to follow this conversation along.
The subnet is not the IP address of the machine, that's just the IP. The subnet is the portion of the IP that determines where the network begins and ends. When you see X.X.X.X/24, that's called CIDR notation (Classless Inter-Domain Routing). CIDR notation is used when creating a custom subnet for a network that does not fit within the confines of the class networks.
Class A IP - 1 ~ 126 Subnet - 255.0.0.0 /8
Class B IP - 128 ~ 191 Subnet - 255.255.0.0 /16
Class C IP - 192 ~ 223 Subnet - 255.255.255.0 /24
Class D IP - 224 ~ 229 Subnet - 255.255.255.255 /32
These are the classic Classed networks and their CIDR notations. The left side of the network is the "Network mask" segment and the right side is the "Host mask" segment. In the Class C subnet 255.255.255.0, you can see that the first three octets are for the network (255.255.255) and the last octet is for the hosts (.0) A class C IP range will allow 253 hosts. If you stack the IP range on top of the subnet, any IP octet that is above a 255 does not change, and is outside of your network. Any IP octet that is above a 0 in the subnet is dynamic, and is part of your network. You will always need to subtract two from the hosts. One for the gateway, and one for the broadcast. In typical network setups, the gateway is the first address in the network (192.168.0.1) and the broadcast is the last (192.168.0.255).
When you need more hosts than a network allows, that is when CIDR comes into play, as using subnetting math allows you to create a custom classless subnet that would allow you to stay within a Class C IP range, however have more than 253 hosts.
If you're not using a custom network, using the CIDR notation is unnecessary, as the IP address you provide tells you that it's a class C address range and that the subnet is going to be 255.255.255.0
-
Re: [Tutorial]Patch zone server to run it behind router
Here is a second note about using this workaround. For those that run multiple world&zone servers, be careful when you restart because once second world server is stopped and started again it will force first world server to reload zone server IPs from world table. So when restarting second world&zone server change ext_address for all zone servers to WAN IP and only then start second zone server. Wait it out a bit, and change that IP back to LAN IP and start second zone server.
-
Re: [Tutorial]Patch zone server to run it behind router
Must Try this + Eperty123's cool app... :)
Also i was thinking of working on a Startup script to Read the Public IP... modify the Files. then Do the Majic with the DB etc....
I have seen some scripts here to minipulate some of the other files.
So must give this a Go (Learning Experiance + Learn some Tricks with Running Postgres Querry's from command Line.
If i get anything working i'll share it with the Comunity.
Great work guys.
-
Re: [Tutorial]Patch zone server to run it behind router
I am getting a Error with my Zone Server...
What i Have
Accounts : Sites : LAN IP
---
FFDB1: serverstatus : WAN IP untill Worldserver is done.
Then LAN IP : Load Zoneserver
I still can't login from WAN Side (VPN)
Zoneserver Shows this in the Log
Code:
286,2016/10/13 14:25:49,[ZoneServerDB.cc:115],Connected to database [192.168.1.6].
393,2016/10/13 14:25:49,Service OK
395,2016/10/13 14:25:49,Service OK
398,2016/10/13 14:25:49,Service OK
400,2016/10/13 14:25:50,RSA size(n) = 256 size(e) = 2
401,2016/10/13 14:25:50,RSA size(n) = 256 size(e) = 2
402,2016/10/13 14:25:50,Cannot assign requested address 122.59.28.166:10021
403,2016/10/13 14:25:50,SOCKET 33: closed.
404,2016/10/13 14:25:50,[SJFramework.cc:111],ERROR: #Network# CSJFramework::InitNetwork -- Network Initial Error
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
count0nz
I am getting a Error with my Zone Server...
What i Have
Accounts : Sites : LAN IP
---
FFDB1: serverstatus : WAN IP untill Worldserver is done.
Then LAN IP : Load Zoneserver
I still can't login from WAN Side (VPN)
Zoneserver Shows this in the Log
Code:
286,2016/10/13 14:25:49,[ZoneServerDB.cc:115],Connected to database [192.168.1.6].
393,2016/10/13 14:25:49,Service OK
395,2016/10/13 14:25:49,Service OK
398,2016/10/13 14:25:49,Service OK
400,2016/10/13 14:25:50,RSA size(n) = 256 size(e) = 2
401,2016/10/13 14:25:50,RSA size(n) = 256 size(e) = 2
402,2016/10/13 14:25:50,Cannot assign requested address 122.59.28.166:10021
403,2016/10/13 14:25:50,SOCKET 33: closed.
404,2016/10/13 14:25:50,[SJFramework.cc:111],ERROR: #Network# CSJFramework::InitNetwork -- Network Initial Error
Zone server log is showing that you did not change ext_address for zone server to LANIP after starting world server.
If you are using navicat or alike software to change IP, make sure yo apply the change because I had that happen to me.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
Zone server log is showing that you did not change ext_address for zone server to LANIP after starting world server.
If you are using navicat or alike software to change IP, make sure yo apply the change because I had that happen to me.
it was my Sleep 60 statment in the wrong place...
still can't login from Wan but i get the Login screen ok... so have a feeling its port related or my cfg files... i'll go click the Clean files. and see whats different.
Thanks again for you're help... :)
-
[Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
Zone server log is showing that you did not change ext_address for zone server to LANIP after starting world server.
If you are using navicat or alike software to change IP, make sure yo apply the change because I had that happen to me.
Another option might be creating a new row in the SQL spefically for the LAN then make sure ZS's original IP lookup is set to it.
Don't know if WS actually does anything with the ext_address though, but worth a try.
The thing is that once using your patch, Bimmer, I assume you must have the WAN to LAN setup for this to work? Since the error 6 occurs if applying the patch.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
Another option might be creating a new row in the SQL spefically for the LAN then make sure ZS's original IP lookup is set to it.
Don't know if WS actually does anything with the ext_address though, but worth a try.
The thing is that once using your patch, Bimmer, I assume you must have the WAN to LAN setup for this to work? Since the error 6 occurs if applying the patch.
WS doesn't seem to do anything with its own ext_address, it is using ZS ext_address to send to clients so they can connect after character selection.
Ohh by the way, for this to work server files must be patched for correct LAN IP and WAN patch must be applied, and only then zone server is patched with this patch.
-
[Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
WS doesn't seem to do anything with its own ext_address, it is using ZS ext_address to send to clients so they can connect after character selection.
Ohh by the way, for this to work server files must be patched for correct LAN IP and WAN patch must be applied, and only then zone server is patched with this patch.
I see. In theory you can actually use another row specifically for the patch since in your tut, you have to edit the ext_address for ZS to your LAN IP efter WS has started, right? So that ZS loads IP from that row instead.
You mention patching the files to the correct LAN IP, that means all files in general, right? My program already does this since in the beginning, but just gotta have this confirmed.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
I see. In theory you can actually use another row specifically for the patch since in your tut, you have to edit the ext_address for ZS to your LAN IP efter WS has started, right? So that ZS loads IP from that row instead.
You mention patching the files to the correct LAN IP, that means all files in general, right? My program already does this since in the beginning, but just gotta have this confirmed.
Yes, that is what I meant by patching the files to the correct LAN IP.
How would you make it load from different row? I tried added additional column wan_address and making world server load zone server's wan ip from there, but did work out.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
Yes, that is what I meant by patching the files to the correct LAN IP.
How would you make it load from different row? I tried added additional column wan_address and making world server load zone server's wan ip from there, but did work out.
Just search for ext_address and replace it using a hex editor.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
Just search for ext_address and replace it using a hex editor.
Tried it. Crashes right away, but maybe you will have better luck. Ohh, and I see now that you were talking about changing column not row
-
[Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
PancakeBimmer
Tried it. Crashes right away, but maybe you will have better luck. Ohh, and I see now that you were talking about changing column not row
Oh yeah. My mistake haha.
Edit:
Mine works though.
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
Originally Posted by
Eperty123
Oh yeah. My mistake haha.
Edit:
Mine works though.
Ohh neat, then this IP switching method may not be needed afterall, just the patch for ticket mismatch.
-
Re: [Tutorial]Patch zone server to run it behind router
Column number -1 is out of ranger
从我的 iPhone 发送,使用 Tapatalk
-
Re: [Tutorial]Patch zone server to run it behind router
Quote:
374,2017/07/02 02:38:14,Ticket 0x760900001913C67C191D2573BF150C66E15969983C64, 2422, 0x7CC61319, 0x73251D19, 0x15BF Sent
375,2017/07/02 02:38:14,Use Ticket 0x760900001913C67C191D2573BF150C66E15969983C64, 2422, 0x7CC61319, 0x73251D19, 0x15BF
This is the error we get if we don't use this Patch Zone Server ?
Just wanna make sure that this Patch is what i need :(:
-
Re: [Tutorial]Patch zone server to run it behind router
-
Possible to update this to support v7 hxsy's?