maxicroma Posted November 15, 2018 Posted November 15, 2018 Basically i need to setup a L2OFF server with a dynamic ip(this ip changes every time that the modem restarts) I have a no-ip service,and vangath files ,so i use a noip of 15 letters (it can't containt more than 15 lettters on the dbo.server table) Example serv67.ddns.net So When Hauth Loads the server it says External IP "127.0.0.1" ,why not serv67.ddns.net? No problem i tried to log in the server but it get stucked on the server seleccion screen. Both ports are open Quote
0 eressea Posted November 21, 2018 Posted November 21, 2018 14 hours ago, maxicroma said: The Hauthd have a reload option ,there its some way to call this function every x time ? Probably there is some way but this is much easier: #!/usr/bin/env python from urllib import urlopen from json import loads from sys import stderr from time import sleep from subprocess import Popen from socket import inet_aton from threading import Thread period = 60.0 # seconds serverId = 1 # server ID sqlcmd = "C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\SQLCMD.EXE" # put correct path here! server = "(local)\SQLExpress" # put correct server string here! database = "lin2db" # database name hauthd = "C:\\l2\\auth\\hauthd.exe" # put correct path here! class HauthdThread(Thread): def __init__(self): Thread.__init__(self) self.hauthdProcess = None self.doRun = True def run(self): while self.doRun: self.hauthdProcess = Popen([hauthd]) self.hauthdProcess.wait() self.hauthdProcess = None def stop(self): self.doRun = False if self.hauthdProcess != None: self.hauthdProcess.kill() def restart(self): self.hauthdProcess.kill() currentIp = None ipUpdated = False hauthdThread = None try: while True: try: newIp = loads(urlopen("https://api.ipify.org?format=json").read())["ip"] if newIp != currentIp: inet_aton(newIp) # check IP print >> stderr, "New IP address:", newIp currentIp = newIp isUpdated = False except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't get current IP address, will retry later" sleep(period) continue if isUpdated: sleep(period) continue try: popen = Popen([sqlcmd, "-S", server, "-d", database, "-Q", "UPDATE dbo.server SET ip='%s' WHERE id=%s" % (currentIp, serverId, )], shell = True) popen.wait() isUpdated = True if hauthdThread == None: hauthdThread = HauthdThread() hauthdThread.start() else: hauthdThread.restart() except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't update IP address, will try later" sleep(period) except: hauthdThread.stop() hauthdThread.join() raise Quote
0 maxicroma Posted November 15, 2018 Author Posted November 15, 2018 i tried in both ip to put 127.0.0.1 ,but its the same it stucks on the server selection Quote
0 madocter Posted November 15, 2018 Posted November 15, 2018 Maybe a program could update the table each time it needs. I do not see other fix. Quote
0 Smith Posted November 20, 2018 Posted November 20, 2018 LOL ... in the table place the actual ip of your dedicated. And point the NO-IP to your dedicated, simple ip. You do not need to put the ip of your DDNS or NO-IP in the settings, settling to point to pro IP enough. So simple and they break the head with it! Quote
0 eressea Posted November 20, 2018 Posted November 20, 2018 (edited) #!/usr/bin/env python from urllib import urlopen from json import loads from sys import stderr from time import sleep from subprocess import Popen from socket import inet_aton period = 60.0 # seconds serverId = 1 # server ID sqlcmd = "C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\SQLCMD.EXE" # put correct path here! server = "(local)\SQLExpress" # put correct server string here! database = "lin2db" # database name currentIp = None ipUpdated = False while True: try: newIp = loads(urlopen("https://api.ipify.org?format=json").read())["ip"] if newIp != currentIp: inet_aton(newIp) # check IP print >> stderr, "New IP address:", newIp currentIp = newIp isUpdated = False except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't get current IP address, will retry later" sleep(period) continue if isUpdated: sleep(period) continue try: popen = Popen([sqlcmd, "-S", server, "-d", database, "-Q", "UPDATE dbo.server SET ip='%s' WHERE id=%s" % (currentIp, serverId, )], shell = True) popen.wait() isUpdated = True except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't update IP address, will try later" sleep(period) EDIT: You'll also need to restart hauthd somehow... Edited November 20, 2018 by eressea Quote
0 rteshima Posted November 20, 2018 Posted November 20, 2018 Pase por el mismo problema con advext64 y te comento como funciona. Tu licencia se asocia a una direccion IP o dominio, ahi es cuando te registras en NO-IP, te dan un dominio gratuito y dentro de la pagina de NO-ip le asignas tu IP de ISP. (cualesmiip)... Esta misma ip la pones en el campo IP en dbo.server. Ej NO-IP: hostname: l2xx.ddns.net IP / TARGET: le pones el ip de tu isp (cualesmiip). En la base de datos, en IP pones tu ip de ISP tambien. Quote
0 maxicroma Posted November 20, 2018 Author Posted November 20, 2018 5 hours ago, eressea said: #!/usr/bin/env python from urllib import urlopen from json import loads from sys import stderr from time import sleep from subprocess import Popen from socket import inet_aton period = 60.0 # seconds serverId = 1 # server ID sqlcmd = "C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\SQLCMD.EXE" # put correct path here! server = "(local)\SQLExpress" # put correct server string here! database = "lin2db" # database name currentIp = None ipUpdated = False while True: try: newIp = loads(urlopen("https://api.ipify.org?format=json").read())["ip"] if newIp != currentIp: inet_aton(newIp) # check IP print >> stderr, "New IP address:", newIp currentIp = newIp isUpdated = False except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't get current IP address, will retry later" sleep(period) continue if isUpdated: sleep(period) continue try: popen = Popen([sqlcmd, "-S", server, "-d", database, "-Q", "UPDATE dbo.server SET ip='%s' WHERE id=%s" % (currentIp, serverId, )], shell = True) popen.wait() isUpdated = True except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't update IP address, will try later" sleep(period) EDIT: You'll also need to restart hauthd somehow... The Hauthd have a reload option ,there its some way to call this function every x time ? Quote
0 maxicroma Posted November 22, 2018 Author Posted November 22, 2018 13 hours ago, eressea said: Probably there is some way but this is much easier: #!/usr/bin/env python from urllib import urlopen from json import loads from sys import stderr from time import sleep from subprocess import Popen from socket import inet_aton from threading import Thread period = 60.0 # seconds serverId = 1 # server ID sqlcmd = "C:\\Program Files (x86)\\Microsoft SQL Server\\Client SDK\\ODBC\\130\\Tools\\Binn\\SQLCMD.EXE" # put correct path here! server = "(local)\SQLExpress" # put correct server string here! database = "lin2db" # database name hauthd = "C:\\l2\\auth\\hauthd.exe" # put correct path here! class HauthdThread(Thread): def __init__(self): Thread.__init__(self) self.hauthdProcess = None self.doRun = True def run(self): while self.doRun: self.hauthdProcess = Popen([hauthd]) self.hauthdProcess.wait() self.hauthdProcess = None def stop(self): self.doRun = False if self.hauthdProcess != None: self.hauthdProcess.kill() def restart(self): self.hauthdProcess.kill() currentIp = None ipUpdated = False hauthdThread = None try: while True: try: newIp = loads(urlopen("https://api.ipify.org?format=json").read())["ip"] if newIp != currentIp: inet_aton(newIp) # check IP print >> stderr, "New IP address:", newIp currentIp = newIp isUpdated = False except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't get current IP address, will retry later" sleep(period) continue if isUpdated: sleep(period) continue try: popen = Popen([sqlcmd, "-S", server, "-d", database, "-Q", "UPDATE dbo.server SET ip='%s' WHERE id=%s" % (currentIp, serverId, )], shell = True) popen.wait() isUpdated = True if hauthdThread == None: hauthdThread = HauthdThread() hauthdThread.start() else: hauthdThread.restart() except KeyboardInterrupt, e: raise except: print >> stderr, "Couldn't update IP address, will try later" sleep(period) except: hauthdThread.stop() hauthdThread.join() raise Great how should i run this script ,(seriously ,have no idea )? Quote
0 eressea Posted November 22, 2018 Posted November 22, 2018 4 hours ago, maxicroma said: Great how should i run this script ,(seriously ,have no idea )? Download and install Python 2.7 https://www.python.org/downloads/release/python-2715/ - use Windows x86-64 MSI installer. Then just run the script as if it was normal application. Quote
0 maxicroma Posted November 22, 2018 Author Posted November 22, 2018 3 hours ago, eressea said: Download and install Python 2.7 https://www.python.org/downloads/release/python-2715/ - use Windows x86-64 MSI installer. Then just run the script as if it was normal application. Awesome its working ,thx you dude :) Quote
Question
maxicroma
Basically i need to setup a L2OFF server with a dynamic ip(this ip changes every time that the modem restarts)
I have a no-ip service,and vangath files ,so i use a noip of 15 letters (it can't containt more than 15 lettters on the dbo.server table)
Example serv67.ddns.net
So When Hauth Loads the server it says External IP "127.0.0.1" ,why not serv67.ddns.net?
No problem i tried to log in the server but it get stucked on the server seleccion screen.
Both ports are open
11 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.