Adding a default route to a TP-Link TD-8817 ADSL router/modem

Once upon a time l was trying to talk to my TP-Link TD-8817 ADSL router/modem. I couldn’t, but I worked out that the reason I couldn’t was because the poor thing lacked a default route. The full story is here, but this blog entry is about how I added the necessary default route. You wouldn’t think that would be a big deaI, but it turns out that adding specifically a default route to one of these units is surprisingly tricky.The default route is the route you use when you have no more specific route. A typical device will have a route to all the networks it is directly connected to, and a default route that points to an upstream router. Packets to off-subnet destination just get sent to the upstream router, which figures out where to send them next.

This is what my laptop’s IPv4 routing table looks like right now, and you can see that it follows exactly that pattern – a route for the directly connected network it is in (192.168.1.0/24) and a default route that points to my home router at 192.168.1.1.

default via 192.168.1.1 dev wlan0 proto static
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.196 metric 9

I tried to add a default route to the TD-8817 via the Advanced Setup/Routing configuration screen in the web interface. To my surprise, it didn’t seem to be possible, The interface complained that 0.0.0.0 was an “invalid IP address”. Of course it is – except when it’s a default route. Anyway, that avenue seemed closed.

I knew the TD-8817 had a telnet interface, so I tried logging in via telnet. That worked fine. The command line interface to the router is very primitive though – it’s like an 80’s adventure game. By dint of educated guesswork and lots of use of the question mark, I figured out that I could set a default route like this:

   ip route add default 192.168.222.2 1

For various reasons I won’t go into, 192.168.222.2 is the IP address of the router interface the TD-8817 is connected to.

Looking at the routes in the web interface, everything seemed fine:

td8817_default_route_1And the default route worked, too. So everything seemed rosy. Until a few weeks later, when I wanted to check the SNR on the ADSL link and found I couldn’t log in to the TD-8817 any more. What the…?

I could reach the unit, but only from the directly-connected MikroTik router, or from my laptop if I directly connected to the unit via its USB interface. In other words, it looked a lot like there was (again) no default route. Checked with the web interface – yep, the default route was gone.

It seemed that the ip route add command did not add a persistent route. Sometime since I’d run that command the ADSL modem had been reset, and the default route had vanished. Hmmm.

Back to the drawing board, and I noticed that one of the subcommands to ip route was addrom. That looks pretty darn permanent, I thought. A bit of online searching found a very useful page by one Nikki Locke:

http://trumphurst.blogspot.com.au/2009/02/adding-second-internet-connection.html

I might have been able to figure the whole addrom thing out on my own, but Nikki’s page took a whole lot of the pain out of it, so thanks, Nikki 🙂

Basically you have slots into which you can write routing information. The slots are referenced by an index number. The index numbers can be seen in the web interface – they are the numbers at far left in the routing table.

To add a route using addrom you need to explicitly specify the slot you want to use. Unless you are writing the entire routing table, just choose the next available index number – that is, the index with a value one higher than the highest current index in the routing table.

The following commands did the trick:

   ip route addrom index 1
   ip route addrom name lan
   ip route addrom set 192.168.222.0/24 192.168.222.1 1
   ip route addrom save
   ip route addrom index 2
   ip route addrom name default
   ip route addrom set 0.0.0.0/0 192.168.222.2 1
   ip route addrom save

Checking out the routing table in the web interface after running the above commands shows the two routes we need – one to the connected LAN, and the default route.

td8817_static_routesUnfortunately there doesn’t seem to be any way to tell the difference (at least not in the web interface) between a persistent route and a non-persistent route.

Now for the big test: Reboot the TD-8817. Wait a while for it to finish booting… and yep – still pingable. All is well.

Update: This works as well – default is shorthand for 0.0.0.0/0:

   ...
   ip route addrom index 2
   ip route addrom name default
   ip route addrom set default 192.168.222.2 1
   ip route addrom save
   ...

Update: This is how you can look at an existing entry:

   ...
   ip route addrom index 2
   ip route addrom display
   ip route addrom freememory
   ...

The freememory command (or save if appropriate) is necessary before you can choose another slot. I told you the command ine interface was primitive…

2 thoughts on “Adding a default route to a TP-Link TD-8817 ADSL router/modem

  1. I decided to add a W8961N as a wireless access point in bridge mode to my existing router and this piece proved invaluable to resolving the missing link – resolving the default route problem -, so I could get my wifi device traffic out past my router. Thanks for taking the time to put this together.

Leave a Reply

Your email address will not be published. Required fields are marked *