4th February 2006

Netgear DG384G Firewall

Netgear DG834G Wireless RouterOwners of the Netgear DG834G wireless router who use their connection a lot will notice that twice a day they get disconnected from the Internet for a brief period. This has been annoying me for some time now, so I decided it was time to sort it.

After a bit of tinkering I found that the router is running Linux and the disconnect is caused by the firewall (which happens to be iptables) restarting at 2200 and 0300 hours. This is all fine except that the router web config. doesn't offer any way to change what times it restarts the firewall. All is not lost, but this bodge does require a web server to get the new config to the router. If you know of a text editor that is available on the router, please let me know.

The Hack

As I said, the router runs Linux and after a bit of Googling, I found it has a debug mode which enables telnet access to the router. This could have made life nice and easy except there doesn't seem to be a text editor installed, so modifying the cron schedule proves a little difficult.

To enable debug mode (telnet), login to the router config, the URL in your browser should be something like "", change the URL to "". You should get a boring page saying "Debug Enable!".

Telnet into the router using the command "telnet", you'll be presented with the BusyBox console. Type in "cat /etc/crontab" to view the current crontab schedule.

BusyBox v0.61.pre (2005.05.16-03:05+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.
# cat /etc/crontab
0 12 * * * root /usr/sbin/rc ddns start
0 3 * * 0,1,2,3,4,5,6 root /usr/sbin/rc firewall restart
0 22 * * 0,1,2,3,4,5,6 root /usr/sbin/rc firewall restart
0 9 * * 5 root killall -1 syslogd

Copy and paste the output into a text editor. You'll notice the two lines:

0 3 * * 0,1,2,3,4,5,6 root /usr/sbin/rc firewall restart
0 22 * * 0,1,2,3,4,5,6 root /usr/sbin/rc firewall restart

These are the culprets for disconnecting you. Cron is a service that runs on the router and executes commands on a schedule, such as the command above to restart the firewall. Each line is in the format of "minute, hour, day_of_month, month, dow, user, command". You can use an asterisk (*) to imply every month, every day etc. So the first line above would run the command "/usr/sbin/rc firewall restart" at 03:00 every day. The line below runs the same command at 22:00.

Since I'm not usually up at 4-5am, I decided that one daily reboot at this time shouldn't interrupt my 'net use. So I took out the bottom line and changed the top line to read:

30 4 * * 0,1,2,3,4,5,6 root /usr/sbin/rc firewall restart

This sets the firewall restart to happen at 04:30 in the morning, while I'm happily in the land of nod. Save your file (keeping a copy of the original) as moo.txt or whatever name you want except crontab. Upload the file to a web server making note of the URL to access it.

Update the Config

Back in telnet on the router, type "cd /etc/" to move into the etc directory and run the command "wget www.yoururl.com/yourfile.txt" to download the new config file to the router. You must be in the /etc/ directory as most of the filesystem on the router is read-only.

Now type "mv yourfile.txt crontab" to overwrite the current configuration. Now type "reboot" to restart the router and disable debug mode.