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?
1. Telnet shutdown
2. Telnet client shutdown
3. Computer shutdown and reboot
4. Autologin (starting all the servers up again)
5. 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:
<timersmuclient_version="4.70"world_file_version="15"date_saved="2011-04-05 14:32:04"><timer enabled="y" hour="00" minute"1" second="0.00" offset_second="0.00" send_to="12" at_time="y" ><send>DoCommand Save("")DoCommand Exit("")</send></timer><timer enabled="y" hour="12" minute="1" second="0.00" offset_second="0.00" send_to="12"at_time="y" ><send>DoCommand Save("")
DoCommand Exit("")</send></timer></timers>
reboot.cmd:
@echo offecho Shutting downshutdown.exe -f -r -t 30
autolock.cmd:
@echo offecho Locking computerrundll32.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!
No comments:
Post a Comment
Comment loud, comment often. But comment on the content!
All comments are filtered through to my email, so your spam will never make it. Unless, of course, you wanted to try injection attacks into my email, which would probably not happen since Blogger just tells me that a comment is awaiting moderation and doesn't bother to tell me what it says. I trust Blogger like that..