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 2.6.8.1 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 192.168.1.1. 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 192.168.2.33 192.168.2.64 60 app: netctl dhcpserver config 192.168.2.33 192.168.2.64 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_cfgNote as can be seen above, I changed the dlink to use the 192.168.2.0 network so as to avoid any clashes or routing issues with the linksys LAN 192.168.1.0 network.
Linksys configuration changes
- Connect the dlink to the WAN port of the linksys, rather than one of the LAN ports
- Enable the WAN port in DHCP mode, so it uses DHCP to get the ISP provided address
- Enable DHCP for the LAN linksys
- Disable DNS server and set google (8.8.8.8) as the DNS server
# ip route ls 192.168.1.0/24 dev br0 proto kernel scope link src 192.168.1.3 127.0.0.0/8 dev lo scope linkOnce I set up the route with the following standard GNU/Linux commands, I had full internet connectivity.
ip route add 192.168.2.1 dev vlan1 ip route add default via 192.168.2.1
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 (8.8.8.8) 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".