DD-WRT Wireless stops working after a while


This is a bit of an odd one for the knowledgebase - its here because we fell over the problem and, at the time of writing, it isn't so easy to find an answer by Internet search.

Many people around the world have chosen to replace the standard firmware in wireless routers with DD-WRT. There are other alternative firmwares out there and the best choice varies depending on the router in question.

Once installed, DD-WRT usually performs well. However, it has a feature (defect?) that crops up if the router is not powered off for some time.

DD-WRT logs traffic statistics into its non-volatile memory (NVRAM) and this is usually only 32k in size. Irrespective of how much or how little of the NVRAM you are using for your DD-WRT set-up, this means that the NVRAM will eventually get filled up with traffic logs. When it does, the traffic logger unfortunately doesn't leave a bit of space spare, but goes to the limit. This then triggers a very strange piece of behaviour - the WPA algorithm flips from the AES that you have almost certainly set it to to TKIP. This has the effect of making your wireless connection appear to have vanished!

There is a script suggested to run at start-up to stop the problem. This doesn't actually help though if you don't power cycle the router - it will go wrong first, and power cycling will mysteriously fix the issue:

#!/bin/sh
T=0
D=`nvram show|grep traff-|cut -f1 -d=|awk -F"-" '{print $3,$2}'|cut -b-4,6-`
for d in $D
do
if [ $T -lt $d ]
then
T=$d
fi
done
T=`expr $T - 100`
for d in $D
do
if [ $T -gt $d ]
then
N=traff-`echo ${d}|cut -b5-`-`echo ${d}|cut -b-4`
nvram unset $N
fi
done

The 100 is the number of days to keep - and is too big for the DD-WRT configuration we were using. We had to change the value to 50.

We suggest not putting this in the startup script, as the link above initially suggests, but instead using cron, as mentioned later in the link text. This does then mean that the problem can be avoided in the first place, rather than the router going wrong and having to be power cycled.

 

Alternatively, if you don't need the traffic statistic data, then turn off the ttraff daemon using the radio buttons at the bottom of the "Services" tab.