Jump to content
Maintenance : Final step ×

Hosting a server from home with Dynamic IP (Are we good to go?)


Recommended Posts

Hi!

It's been a long time since I paid a VPS Server from a hungarian company called JZT Kft. I don't opened the server for public, it was just in test and development phase.
The original idea was to open the server with this VPS, but when we tested with 2-3 people kicks and lags occured.
In the last year the FTP connection went so slow, sometimes 3MB/s was the total downstream speed from the server (the average was 30-60MB/s).
I restricted the autopatcher folder in my webserver to 50Kb/s so if I released a patch if the file size is up to 20-90MB the download time was 10-20-30 minutes!
(I made this decision because I know the VPS's poor network connection.) The only upside was the VPS had Static IP address so the domain was easy to manage:
A record was the static IP of the VPS
CNAME record was the www.servername.com which pointed to the A record.

So, long story short I decided I will end the VPS subscription in next month and move to my I think pretty good desktop PC:
CPU: AMD FX6350 (6 core 3.9GHz CPU with 125W maximal power consumption)
RAM: 16GB SAMSUNG 1600MHz DDR3 memory modules in dual channel (4 pieces each RAM is 4GB)
MOBO: ASUS M5A97
PSU: It's a simple 400W one with replaced brand new air went.
GPU: A 64MB or 128MB (sorry don't know exactly) PCIE one with no air vent
Network connection: 9-14 miliseconds of ping, nearly 900-950MB/s Down/Upstream (I have a pretty good optical connection so the patcher can take 300MB/s from it.)

But... I have dynamic IP address to make this good facts worse.
I try to workaround this so I set up a tplinkdns address (similar to No-IP) which is updated by my router if the ISP decides to give me another IP than before.
Let's start with the Domain address, I deleted the A record and only use a CNAME record which is redirected to the tplinkdns address which tracks down my IP if it changes.
The only downside is my website is unreachable if you type it similar like this: https://metin2.com it's only reachable when you type it like this: https://www.metin2.com so the www. is needed I think because the missing A record which we can't set because the IP is changing weekly or in 2-3 days.
So why don't you buy a static IP from your ISP guess you ask me, sadly the ISP don't offer static IP address to home users even if you want to pay for it (it's Magyar Telekom (T-Com) btw.), so only businesses can only have static IP from this ISP (sadly in Hungary the government closed that opportunity where you can start a self employed mini business with only 50K HUF ~125EUR tax per month it was named "KATA self employment" if I translate it correctly, now the smallest option is start a Bt. (general partnership company) or a Kft. (limited partnership company) where you need millions of Forint's to just start the company. The KATA self employment option is sadly only avaliable for those who's only job is the self employment company so you can't make a KATA if you have a main job like me (I work at te hungarian railway company (don't laugh at me please) as a manual road crossing gate operator and I operate track switch by levers).

So I manged to configure the Apache and the PHP server, pointing to the machine's local IP address, and it works well.
The server core's set to PROXY IP: servername.tplinkdns.com (I don't use the BIND IP variable).
I have a fear if the IP changes I need to restart or reboot the server because the cores only set the PROXY IP's when the gameserver boot's up if the IP changes when the server online I guess it will kicks out the players and you can not login to it.
I set the autopatcher and the client's serverinfo.py also to the tplinkdns address, my only fear is the game cores.

Thanks for the suggestions, have a nice day!

  • Think 1
Link to comment
Share on other sites

  • 2 weeks later...

Just rent a VPS for 15 eur from Hetzner or OVH.. forget JZT, their equipment is old, network is shit.

You don't need to worry about any of these IP things or power/network outage and running a machine in the corner of your house just for this purpose.
If there is some load and lets say the PC consuming 100w from the outlet thats around 3000FT / month just for the electricity. Add 3000 more and just rent a VPS.
 

Edited by Matteo
  • Good 1

System Administrator @ Hungarian Government
System Administrator @ Land of Heroes
Freelancer Developer @ Various projects

Link to comment
Share on other sites

  • Premium

Hosting your server locally might seem like a good idea, but it’ll likely cost you more in electricity than a VPS would. Plus, ISPs don’t have the optimized traffic routes VPS providers do, so you could run into performance issues, especially with players connecting from different regions. There are plenty of FreeBSD VPS providers out there that can meet your needs without the hassle of running and maintaining a local server. It’s a smarter, more efficient choice overall. You could try anything like royalehosting, ovh(i've heard that they do not allow you to install custom images through kvm anymore on VPS, not sure, someone else could correct me), or you could actually rent an ECO(https://eco.ovhcloud.com/) type of dedicated server from OVH themselves and install FreeBSD yourself on it. There are few tutorials on how to do that.
 

Engineer @ CNH Industrial

Link to comment
Share on other sites

  • 2 weeks later...

Thanks for the replies, finally I made a shell script for the public IP address change.
I want to share it with you (please if someone expert see this revise my code), so I put this at the end of my etc/crontab file (this will run the usr/game/ipcheck.sh shell script every 10 minutes):

#
#Check for IP change
#
*/10	*	*	*	*	root	(cd /usr/game/ && sh ipcheck.sh)

The ipcheck.sh file:

#! /bin/sh
detectedIpAddress=`curl -s checkip.dyndns.org | sed -e 's/.*Current IP Address: //' -e 's/<.*$//'`
if [ -z "$detectedIpAddress" ];
then
	exit 0
fi
if test -f /tmp/ipaddress
then
	previousIpAddress=`cat /tmp/ipaddress`
else
	previousIpAddress="0.0.0.0"
fi
if [ "$detectedIpAddress" != "$previousIpAddress" ]
then
	if pgrep 'db' > /dev/null
	then
		while pgrep "game"; do
			killall -6 game
			sleep 3
			echo `date +"%Y-%m-%d %T"` ": IP address changed, gamecore shutting down." >> /tmp/state
		done
		if ps ax | grep -v grep | grep 'game' > /dev/null
		then
			echo `date +"%Y-%m-%d %T"` " Game not running." >> /tmp/state
		else
			cd /usr/game/auth 
			./auth &
			sleep 2
			echo `date +"%Y-%m-%d %T"` ": AUTH restarted." >> /tmp/state
			cd /usr/game/channel1
			./game &
			sleep 2
			echo `date +"%Y-%m-%d %T"` ": CH1 restarted." >> /tmp/state
			cd /usr/game/game99
			./game &
			sleep 2
			echo `date +"%Y-%m-%d %T"` ": CH99 restarted." >> /tmp/state
		fi
	else
		echo `date +"%Y-%m-%d %T"` ": DB not running." >> /tmp/state
	fi
	echo $detectedIpAddress > /tmp/ipaddress
fi

If you want to use it, I give you some note, please remove the -6 argument from the killall -6 game if you want safer operation (my gamefile with the default -1 killall don't want to properly shutdown, it's starting and endless killprocess which never ends so that's why I use the -6 (abort) argument).
So, this shell script will create an ipaddress file to your tmp folder and also a state file for logging.
If you want to test out the script delete the ipaddress file and it behaves like the public IP changed.
The script only takes action when your server is running ("if pgrep 'db' > /dev/null" checks your DB core is running, if not it throws a "DB not running message" every 10 minutes, it's 34byte so it takes time to grow huge).
The script also won't shutdown the DB core because when the IP changes the only problem we facing is the game throws back us to the serverselecting menu screen so the DB shutdown I think don't necessary.
I use PROXY_IP: servername.tplinkdns.com at the core config files, I don't have BIND_IP entry!

Some sidenotes which I worry about:
-This script and the IP change can cause items/progression loss for the players (7-10 minute maximum), because we can't execute ingame /shutdown command from outside (and the -6 argument which I mentioned before)
-The server downtime maybe is 10-20 minutes while this script brings back the server online, but it's automatic so that's not a problem if you're not at home
-I don't know what happen if the script runs exactly when the IP changing happen, I think the script behaves well when the IP change occurs minutes before the script runs down

I bought a 600VA Legrand UPS to protect the server PC and our fiber optic Internet moden  from the micro power outages, but I can't bring NUT to work.
If someone is experienced with NUT, you are welcome to tell what I need to config to get start working (NUT is a FreeBSD service which communicates with the UPS via the USB-A (PC side) USB-B (UPS side) cable, if the UPS sends a message like Power level is 25%, FreeBSD can execute a graceful shutdown to prevent data loss which is only fixable with FSCK command.) I tested the 600VA UPS, it can run the internet modem and the server for 15 minutes, but I really need the working NUT configuration to achieve communication with the UPS.

I can agree with you FrenchForeignLegion the traceroute maybe better when you own a VPS (my hop number from outside is above 8).
And for the end a funny note: the owner of the JZT Kft. made a phone call with me. He spoke about it cannot be the case which I mentioned for them about their shitty network, he told me maybe I misconfigured my FreeBSD and that's the case why the lags and kicks happen. He offered a free trial month of a Ryzen VPS (and he also told me the XXL VPS is not enough for a Metin2 server which I was rent from them for years). He also mentioned my server will not be optimal for handling 100-150 players with my home connection.

Link to comment
Share on other sites

There is also the option to buy a physical server and place it in a datacenter, that way you won't have to worry about power outages and other things. It should be somewhere around 150 euros, being exactly what you need. The even better part is that if you have a reasonably performing server you can create multiple virtual servers.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.