Author: | JD (captsens at gmail dot com) |
---|---|
Date: | 2 July 2005 |
TPG (an Australian ISP) give away a more-or-less free ADSL modem (a D-Link DSL-200) with some of their ADSL plans. Although my research (read 'aimless surfing') revealed many problems getting USB ADSL modems going under Linux, I thought I'd at least give it a good try before bailing out and buying an ADSL router.
Well, I did manage to get it all working nicely, but it was a painful process - it took me 2 days, and I needed some help from the developers of the modem drivers. So, here's the important information I learnt through the process, in the hope that it might help someone else...
And my recommendation? Yes, it's possible, and hopefully with the help of this page (and a bit of judicious googling) you'll manage it in a lot less time than it took me. But unless you're particularly poor or cheap, I suggest you go out and buy something like a Billion ADSL router - everyone says that they're trivially simple to get working.
There are many different ADSL, modem and computer configurations, so here's mine - if yours are at all similar, these instructions could be for you:
- Modem: D-Link DSL-200 Rev B1, USB connection
- ADSL encapsulation: PPPoE, bridged mode
- OS: Fedora Core 3, full install, with all latest updates (as at June 2005).
So, you've got this wee plasticky thing that claims to be an ADSL modem, sitting in the box in front of you - how will you persuade it to provide you with an internet connection? Well, in my case the pieces of the puzzle look something like this:
- The modem makes the ADSL connection (remember to install line filters on other phones, POTS modems etc.) to the ISP
- The computer's USB hub and the Linux USB utils mediate access to the modem
- The eciadsl package provides drivers for the modem, as well as scripts to start and stop the modem connection. The modem connection is presented as a virtual network interface called tap0
- The Roaring Penguin PPPoE suite provides a PPP daemon that layers PPP over the modem connection, as well as a script to start the daemon. This creates the ppp0 network interface, which talks TCP/IP to your ISP and from there to the rest of the internet.
The main gotchas I found in getting all this to work (other than my own lack of knowledge on the subject) were:
Just because the modem synchronises OK doesn't mean that it will connect to the Access Concentrator - you'll probably have to experiment with different synchronisation files to find one that works reliably
The verion 0.10 nortek drivers cause glibc errors (double free etc.), although I'm not sure if that's a real issue
- If you have to create your own synch file (under Windows):
- You don't use the eciadsl Windows driver (use the D-Link one instead)
- You need to use a special command-line switch when generating the synch file from the usbsniff log
And the big gotcha (for me anyway) - there was a bug in the eciadsl-start script. This was only fixed in CVS on 26/6/05. Until I got the fix, my connection was much slower than dialup, with massive packet loss. In other words, unusable. This applies if you use PPPoE
The DSL-200 B1 has a Nortek GS7470 chipset (apparently). Drivers for it are provided by the eciadsl project (http://eciadsl.flashtux.org/index.php?lang=en). Note that in version 0.10 of eciadsl, the Nortek drivers were a separate distribution, whereas in CVS they're part of the mainline.
Start by getting and reading the documentation and FAQ for the project - these are at http://eciadsl.flashtux.org/doc.php?lang=en and http://eciadsl.flashtux.org/faq.php?lang=en respectively. There's also a beginners tutorial that's worth looking at.
If you want to do any more reading ahead, the place to go is the forum at http://eciadsl.sourceforge.net/scripts/forum/index.php.
Don't plug the modem in until you've removed dabusb in the Configuration step.
First, the software - because of the bug that kolja fixed for me, you'll have to get the latest version from CVS. Version 0.10 won't work, and neither will the 6 June 2005 CVS snapshot (packaged as eciadsl-usermode-cvs-0.11rc).
Create a suitable directory, and suck the CVS repository down using the cvs command-line tool.
$ cd /usr/local/src $ mkdir eciadsl-usermode-cvs $ cd eciadsl-usermode-cvs $ cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/eciadsl co usermode cvs checkout: Updating usermode ... $ ls usermode $ cd usermode $
Now build and install the drivers - this part's easy (or at least it was for me):
$ ./bootstrap ... $ ./configure ... $ make ... $ su Password: # make install ...
This installs the eciadsl-* scripts in /usr/local/bin, and puts the configuration in /etc/eciadsl. Get familiar with that latter path - you're going to spend some time there...
You're not finished downloading yet - the synchronisation files you need aren't present in the CVS repository. You have to download the eciadsl-usermode-0.10-nortek-alpha bundle from the eciadsl home page, untar it somewhere, and copy the GS7470_SynchFiles directory to /etc/eciadsl
$ cd /usr/local/src $ tar xvzf eciadsl-usermode-0.10-nortek-alpha.tar.gz ... $ su Password: # cp -a eciadsl-usermode-0.10-nortek-alpha/GS7470_SynchFiles /etc/eciadsl
All this needs to be done as root.
Run the eciadsl-config-tk program (I'm assuming you're in X here). First, click the button to remove dabusb (read the doco to find out what and why). Alternatively, the doco explains how to do this by hand via /etc/hotplug/blacklist, which I did).
You can see my config file here (although note that it's hand-edited).
You can set the synch files from this app as well, but I chose to do that directly in the config file. Click on Create config, which shows an information dialog about what it changed (a nice touch), then exits.
For PPPoE support, you need software to run PPP on top of the link provided by eciadsl. FC3 ships with rp-pppoe, from Roaring Penguin. Make sure it's installed.
Run the program adsl-setup (you guessed it, as root). I made the following choices:
- Interface tap0
- Continuous mode
- DNS entries as in /etc/eciadsl/eciadsl.conf (see previous section)
- User yourname@L2TP.tpg.com.au
- User control
- No firewall (I already have a basic one running, using system-config-security)
This stores the main configuration file in /etc/sysconfig/network-scripts/ifcfg-ppp0.
TODO:
- Document use of /etc/ppp/chap-secrets or pap-secrets for password.
- Document what authentication failure looks like, and how to deal with it.
At this point, you're ready to plug the modem in and try to get it to synchronise. Get the feel of the crappy little USB plug on the back of the modem - before the day is out you'll have plugged and unplugged the thing more times than you care to think. Personally, I'd like to epoxy mine in place so it can never be unplugged again...
Plug the modem in. The lower green LED (power) should light.
Run /sbin/lsusb, and the modem should show up:
$ /sbin/lsusb Bus 005 Device 001: ID 0000:0000 Bus 004 Device 001: ID 0000:0000 Bus 003 Device 001: ID 0000:0000 Bus 002 Device 002: ID 2001:5100 D-Link Corp. [hex] Bus 002 Device 001: ID 0000:0000 Bus 001 Device 001: ID 0000:0000
So, to work - you need to identify which synch files work with your modem and line. The tools you'll use are eciadsl-probe-synch (lets you try many files in one run) or eciadsl-synch (one file only). You'll point the scripts at the /etc/eciadsl/GS7470_SynchFiles directory you copied earlier, which has all the synch files for this modem. After each attempt, you'll have to unplug and replug the modem. And remember, you're still root.
The program reports that synchronisation failed
The program reports (very quickly) that synchronisation succeeded, but the sync light on the modem isn't lit. It's lying - you're not synchronised
The program goes off into la-la land and doesn't return. If this happens, open another shell as root, and:
# killall eciadsl-synch
I suggest you start by trying the following files first, since I was able to synchronise using both of them:
- gs7470_synch06.bin
- gs7470_synch14.bin
Remember to unplug the modem after each file.
# eciadsl-synch /etc/eciadsl/GS7470_SynchFiles/gs7470_synch06.bin ...
The program should tell you whether it managed to synchronise, and as well both modem lights should stay lit. If these don't work, try all the files in GS7470_SynchFiles using eciadsl-probe-synch:
# eciadsl-probe-synch --try-all /etc/eciadsl/GS7470_SynchFiles ... Type in a directory where to find the synch .bin [default is /etc/eciadsl/GS7470_SynchFiles]: ...
The results I got with these were as follows:
File | Synch? | Connect to AC? |
---|---|---|
gs7470_synch01a.bin | Claimed | N/A |
gs7470_synch01b.bin | No | N/A |
gs7470_synch01.bin | Hangs | N/A |
gs7470_synch02a.bin | Claimed | N/A |
gs7470_synch02b.bin | No | N/A |
gs7470_synch02.bin | Hangs | N/A |
gs7470_synch03.bin | Yes | No |
gs7470_synch04.bin | Yes | No |
gs7470_synch05.bin | Yes | No |
gs7470_synch06.bin | Yes | Yes |
gs7470_synch07.bin | Hangs | N/A |
gs7470_synch08.bin | Hangs | N/A |
gs7470_synch09.bin | Hangs | N/A |
gs7470_synch10.bin | Yes | No |
gs7470_synch11.bin | Hangs | N/A |
gs7470_synch12.bin | Hangs | N/A |
gs7470_synch13.bin | Hangs | N/A |
gs7470_synch14.bin | Yes | Yes |
Once you've found a synch file that seems to work, you need to plug it into /etc/eciadsl/eciadsl.conf. You can either do this the fast way, with a text editor (the SYNCH= entry, remember to use a full path), or using eciadsl-config-tk again.
You can then try to start the modem. Once more as root, run the eciadsl-start program, and hopefully you'll get a result something like that shown below:
# eciadsl-start [EciAdsl 1/5] Setting up USB support... Preliminary USB device filesystem is OK [EciAdsl 2/5] Uploading firmware... Process skipped .. no more needed firmware loaded successfully [EciAdsl 3/5] Synchronization... OK eciadsl-synch: success Synchronization successful [EciAdsl 4/5] Connecting to provider... Connection successful [EciAdsl 5/5] Setting up route table... Waiting for tap0... ERROR: couldn't set your static IP or your external gateway If you don't use PPPoE, please check your configuration.
Note that the 'ERROR' above isn't an error if you're using PPPoE (I am) - it's just telling you that there's more to do before you have an internet connection.
If you see any error messages, you can try restarting after:
- Unplugging and re-plugging the modem (getting used to it now, aren't you?)
- Killing any eciadsl* processes running
- killing any pppoe processes running
By now, if eciadsl-start was successful, you should have a tap0 interface:
# ifconfig ... tap0 Link encap:Ethernet HWaddr 42:FF:9B:91:2B:AC inet6 addr: fe80::40ff:9bff:fe91:2bac/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:47664 errors:0 dropped:0 overruns:0 frame:0 TX packets:29178 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:14236501 (13.5 MiB) TX bytes:3332169 (3.1 MiB) ...
(Your receive and transmit totals will be very low - don't be alarmed).
Now that you've got to this point, the next thing is to check whether you can connect to an Access Concentrator. As (old faithful) root:
# pppoe -I tap0 -A Access-Concentrator: qcb1-charlotte Got a cookie: 0a 40 0d 4d fc b2 1d 90 ee 04 d7 fa 2c ca 3a 28 AC-Ethernet-Address: 00:90:1a:40:35:53 --------------------------------------------------
This shows that we were successful. If instead you get messages about timeouts waiting for PADO packets, your synchronisation file isn't good enough - you'll have to go back to the Synchronisation step and find another synch file. If you can't find one that works for you, you'll have to make your own under Windoze - see later section.
Note: The tap0 interface is sniffable, using a packet capture utility like Ethereal. If you set up a capture before trying the Access Concentrator connection above, you'll see the PADI request(s) going out, and hopefully the PADO responses coming in.
If you got an answer from an Access Concentrator, you should be able to bring the PPPoE up. As your favourite superuser:
# adsl-start
And with any luck, you're now connected to your ISP. This will provide you with a ppp0 interface, in addition to tap0:
# ifconfig ... ppp0 Link encap:Point-to-Point Protocol inet addr:220.245.127.78 P-t-P:202.7.162.157 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1492 Metric:1 RX packets:297 errors:0 dropped:0 overruns:0 frame:0 TX packets:270 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:299901 (292.8 KiB) TX bytes:15714 (15.3 KiB) tap0 Link encap:Ethernet HWaddr AE:90:63:F2:79:E8 inet6 addr: fe80::ac90:63ff:fef2:79e8/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:319 errors:0 dropped:0 overruns:0 frame:0 TX packets:295 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:500 RX bytes:307859 (300.6 KiB) TX bytes:22770 (22.2 KiB) ...
If this is what you see, CONGRATULATIONS, you're connected!
Now that you've got a functioning internet link, you should check to ensure that you're getting the speed you expect. Find a decent-sized file to download from a fast local internet site (I chose to get postgres 8 from one of the big mirror sites in Australia), and check the kB/s you get on the download. If it's about what you expect (ie. somewhere just over 10% of the line speed in k bits/sec), you're away - the only other thing you might like to do is set up your ADSL link to start when the OS boots.
If your download speed is absolutely woeful (which was my case), check for packet loss and its relation to packet size. Get the IP address of the remote point-to-point node from ifconfig (it's under ppp0, labeled 'P-t-P'), ping it and check packet loss:
$ ping -c 50 202.7.162.157 ... --- 202.7.162.157 ping statistics --- 50 packets transmitted, 50 received, 0% packet loss, time 49068ms rtt min/avg/max/mdev = 12.148/18.649/71.748/8.591 ms, pipe 2
Now repeat with increasing sizes of ping packet, using the -s (size) option:
$ ping -c 50 -s 1000 202.7.162.157
Don't bother going above about 1400 bytes, since the MTU for PPPoE is 1492 bytes.
In my case (because of the bug in eciadsl-start), the packet loss rose hugely as the packet size increased, maxing out at over 60%.
If you haven't managed to get reliable synchronisation using the files supplied with eciadsl, and you can't find someone else's generated synch file that works for you (see link below to my file), you'll have to make your own under Windows. If you're a Linux diehard this can be a pain - I had to borrow a friend's Windows machine to do this.
For the DSL-200, there are a couple of crucial omissions from the documentation provided with eciadsl. I've flagged them in the steps below (which mostly follow the documented process).
Use the DLink CD and TPG instructions to install the ADSL modem on the Windows box. Important note: don't plug the modem in until asked!
DO NOT INSTALL the eciadsl drivers (eci_drv_106_win.zip) - for the Nortek chipset, the modem's own drivers have to be used
Start usb-sniff, which installs its driver on the first invocation
'Install' usb-sniff on the modem (just select the modem in the list and click on 'Install').
Copy the usb-sniff log file to Linux
Run the perl script to generate a synch file from the usb-sniff log. NOTE THE EXTRA PARAMETER REQUIRED.
$ eciadsl-vendor-device.pl usbsnoop.log -chipset=GS7470
Note that the output filename is gs7470_synch999.bin
Install the file in eciadsl.conf, and try connecting.
Here is the synch file I generated: gs7470_synch999-00.bin. I probably didn't need to do it, but I've yet to test the provided synch files with the bug-fixed version of eciadsl.
The eciadsl distribution includes a script called rc.adsl, which you can plug into your Linux distribution's init process to bring the ADSL link up. Unfortunately, it doesn't have everything required for PPPoE, since it doesn't start the pppoe program to bring up ppp0.
My modified startup script includes the required extras to run pppoe after eciadsl-start. Note that eciadsl-start thinks it's failed at step 6 (and therefore exits with return code 6), so the script looks for that as the normal state. I've also added some very basic lines at the top to make the script installable with chkconfig (this makes installation and control much easier). These lines have the ADSL link started at runlevels 3 and 5, starting at number 84.
As root:
# cp adsl /etc/rc.d/init.d # chkconfig --add adsl # chkconfig --list adsl adsl 0:off 1:off 2:off 3:on 4:off 5:on 6:off
The link should now start automatically. You can control it manually using the service command:
# service adsl Usage: adsl {start|stop|status|restart} # service adsl restart ...