DSL Modem Web Interface in Bridged Mode

Since I run my own netfilter-based router, my Zoom ADSL modem operates in bridged mode and I have almost no need for the web-config interface thingy. I say almost because the web interface is apparently the only way to see the actual ADSL sync speed.

Here’s the stanza from my /etc/interfaces which configures the external interface:


auto eth0
iface eth0 inet static
        address 66.114.146.48
        netmask 255.255.255.0
        broadcast 66.114.146.255
        gateway 66.114.146.1

As you can see, I have a static IP of 66.114.146.48. To access the web interface on 10.0.0.2, I’m supposed to configure my PC with a specific IP (10.0.0.4). If I did that, however, it would override my static IP and I’d lose net connectivity.

Last night I discovered a way to have my cake and eat it too:


auto eth0:1
iface eth0:1 inet static
        address 10.0.0.4
        netmask 255.255.255.0
        gateway 10.0.0.2 # Bad idea, see below!

This creates an alias for eth0 with the modem’s preferred IP settings. This virtual interface runs concurrently with the real one, so net connectivity is unaffected. After adding this stanza and performing a quick ifup eth0:1, I could ping 10.0.0.2 from my router.

Browsing to http://10.0.0.2/ from any of the internal machines immediately brought up the modem’s web interface. This surprised me a little at first. I expected to need some extra iptables rules, but it turns out to just work with my existing IP masquerading setup. I think this is because of two facts:

  • eth0:1 automatically becomes the route for pakets targeting the 10.0.0.0/24 network
  • IP masq SNATs the outgoing packets to its interface’s IP (in this case, 10.0.0.4).

Now that I know my actual ADSL speeds, I’m going to give wondershaper a try.

Update:
My original article had a major bug (see the strikethrough text above). If I include that line, I’m essentially telling Linux that I have multiple default routes to the internet, and so my routing tables look like this:


10.0.0.0/24 dev eth0  proto kernel  scope link  src 10.0.0.4
192.168.1.0/24 dev ath1  proto kernel  scope link  src 192.168.1.1
192.168.0.0/24 dev br0  proto kernel  scope link  src 192.168.0.1
66.114.146.0/24 dev eth0  proto kernel  scope link  src 66.114.146.48
default via 10.0.0.2 dev eth0  src 10.0.0.4
default via 66.114.146.1 dev eth0

That penultimate line is the problem. If I omit the gateway declaration, however, I get only one (sensible) default route and everything seems to work.

Advertisements


%d bloggers like this: