For some weird reason, I found that my router (Netgear WNR3500L) (or my connection) was giving me problems…every so often it my LAN connection would completely reset and require me to reboot the computer, just to get the webserver back online (it would become completely unreachable via No-IP DNS -and- the external IP address..some 5xx connection reset error or something).
Recently I found that the problem was my router. The DHCP server built into it has a set lease time of what my connection says is 24 hours, although it only lasts about 12. I found a workable solution, yet it was rather annoying. I set up my Telnet server to automatically shut down every 12 hours, as well as the client that was accessing it. On top of that, I used Windows Scheduler to run reboot.cmd a minute after the server was shut down, and then used TweakUI to automatically log me back in, plus another command-line script that would autolock the computer after logging in. This way all the applications would be preloaded, but the computer would still be secured.
Got all that?
- Telnet shutdown
- Telnet client shutdown
- Computer shutdown and reboot
- Autologin (starting all the servers up again)
- Autolock
- DHCP is renewed, the connection is reset, and 100% accessible over the web.
The Telnet server is called PennMUSH, which is a Multi-User RPG engine which uses the common MUSHCode language to program.
For archival purposes, here’s the detailed setup:
PennMUSH:
@@ @listen Shutdown Machine = ^-*: @switch [or([strmatch(%0,00)],[strmatch(%0,12)])] = 1,{@wizwall Shutting down.;@dump;@wait 30=@shutdown};@@ * is passed from the clock hourly as timefmt($H) <= The 24-hour hour code.
MUSHClient:
DoCommand Save("") DoCommand Exit("") DoCommand Save("") DoCommand Exit("")
reboot.cmd:
@echo off echo Shutting down shutdown.exe -f -r -t 30
autolock.cmd:
@echo off echo Locking computer rundll32.exe user32.dll, LockWorkStation
Scheduled Tasks:
Add one task to run reboot.cmd. Copy the event within the single task and schedule them to run at 12:02 am and 12:02 pm.
Complicated enough? I figured out a MUCH easier solution
Ctrl Panel > Network Connections > Local Area Connection > Internet Protocol (TCP/IP) > IP Address: 192.168.0.2, Subnet: 255.255.255.0, Gateway: 192.168.0.1, DNS: 192.168.0.1
In essence, setting a static IP behind the router turned of the DHCP lease time for this connection. I had to do a bit of tweaking in the router config, like releasing the reserved IP for both the laptop (which was using 161.0.0.2) and the server computer (which was using 161.0.0.3) and reserve the first to the server computer based on its MAC. This way the router won’t try to assign my manually-entered IP address to another computer and cause an IP conflict error (which can happen).
I’ve now had the server on for a day and a half (turning off all of this automatic shutdown-reboot stuff) and everything has continued to run with success!
Leave a Reply