My Zyxel 660 router started to get increasingly flaky, dropping the ADSL connection for a couple of seconds every 30 or so, and also the ethernet links started to drop occasionally. So I decided to get a Dlink DSL-320B, ADSL modem, which I noticed going for €34.29 inc. VAT and shipping, at (it was an opened package).

Operating mode

I tried first to get this to act like a router, to replace my Zyxel without needing to mess with the internal linksys router setup. Now this was a case of a bit of knowledge being a dangerous thing as I saved the logs and determined that since it was running a Linux kernel, that it had the necessary smarts to NAT between the LAN and WAN ports.

Now even though it has an internal DHCP server which serves out local 192.168.1.x addresses when not connected to the ISP, the mode changes when it does connect, and it just uses DHCP to propagate the ISP provided address to the LAN port, with a /32 netmask and a gateway of This hack is known as half bridged mode I believe.

One could also operate this modem as a true bridge and just forward ethernet packets to the ISP. This would require enabling PPPoE on the linksys WAN port, and while I suspect this would work since my ISP also uses PPPoE, I decided to get the default half bridge mode to work.

Command line interface

I noticed that the LAN configuration page on the dlink web interface was unresponsive to changes when firefox was used. I also tried opera, which had even more issues. It's ironic that the web interface for this Linux device is only fully operable under Microsoft Internet explorer. So to mess with the DHCP settings I logged in over ssh (note this only seems possible when not connected to the ISP), and ran the following:
> dhcpserver config 60
app: netctl dhcpserver config 60 2> /var/dhcpsrverr
app: echo 0 > /var/isdft_cfg
app: rm /var/dhcpsrverr

> lan config --dhcpserver enable
app: netctl lan config --dhcpserver enable 2> /var/lanerr
app: echo 0 > /var/isdft_cfg
app: rm /var/lanerr

> save
app: netctl save 2> /var/psierr
app: echo 0 > /var/isdft_cfg
Note as can be seen above, I changed the dlink to use the network so as to avoid any clashes or routing issues with the linksys LAN network.

Linksys configuration changes

Now I was a bit surprised that I was not getting internet connectivity after doing the above, but logging in over ssh, I could see that there was no default route to the WAN port.
# ip route ls dev br0  proto kernel  scope link  src dev lo  scope link 
Once I set up the route with the following standard GNU/Linux commands, I had full internet connectivity.
ip route add dev vlan1
ip route add default via

Now the above commands need to be run after the linksys brings up the WAN interface (vlan1), and the handiest place to do that is in the dd-wrt rc_firewall script which is run each time interface addressing changes etc. There is even a web interface to set this, so I just had to add the above 2 commands to "Administration" → "Commands" → "Save Firewall".

I then powered down both dlink and linksys boxes to ensure they rebooted with full internet connectivity, and ... no!. It looks like the linksys gets a 192.168.2.x address for the WAN port from the dlink as it has not brought up the ISP connection in time. Even though the DHCP lease is only set to 60s by the dlink, the linksys doesn't get a new one on renewal, and requires an explicit release to negotiate the new address. I'm not sure is the issue here with the linksys or the dlink, but my hack for the moment is to ping (twice) google's DNS server ( every 3 mins, and reboot the linksys if we get no response. That can be configured in the linksys web interface too at "Aministration" → "Keep alive" → "WDS/Connection Watchdog".

© Jan 31 2011