Monday, October 11, 2010

Automated reboot of Netgear FVG318

I'm having trouble with some Netgear FVG318 wireless VPN routers. They can't seem to release their DHCP leases without a reboot, and there's no way to schedule a reboot on them.

Other than that, these are really great, reasonably priced little devices.

Hopefully my contacts with Netgear Support will yield a fix so that they don't run out of DHCP leases *for no reason*, but until then I need a workaround.

So, I used some wget magic to script logging in, saving the necessary cookies, and executing the reboot function.

Just replace your.fvg318.ip with your FVG318's IP, replace youradminpassword with your admin password. I doubt the line breaks will come out proper in blogspot, so I'll tell you that there is only one line of command between each comment line -- if it line wraps on here, you will need to make sure your copy that you run does not wrap those lines.

Then just set this up in a cron job to run every night at midnight and voila! No more unhappy uesrs, no more manual reboots.


# Load login page
/usr/bin/wget --no-check-certificate -q -O - --save-cookies /tmp/netgear-cookies.txt --keep-session-cookies 'https://your.fvg318.ip/' > /dev/null

# Log in
/usr/bin/wget --no-check-certificate -q -O - --save-cookies /tmp/netgear-cookies.txt --load-cookies /tmp/netgear-cookies.txt --keep-session-cookies --referer='https://your.fvg318.ip/platform.cgi' --post-data='web0x120010=admin&web0x120011=youradminpassword&umi.loginAuth=Login' 'https://your.fvg318.ip/platform.cgi' > /dev/null

# Reboot
/usr/bin/wget --no-check-certificate -q -O - --save-cookies /tmp/netgear-cookies.txt --load-cookies /tmp/netgear-cookies.txt --keep-session-cookies --referer='https://your.fvg318.ip/diagnostics.htm' --post-data='umi.restartWrap.x=69&umi.restartWrap.y=14' 'https://your.fvg318.ip/platform.cgi' > /dev/null