Internal PCI ADSL Modem setup with Linux


I bought a Dynalink ALH-110 internal PCI ADSL modem in December 2001 to give my linux box a permanent internet connection.  Dynalink is also known as Askey.

The Dynalink uses the Apollo 3 chipset internally, made by Itex, and I hear that most other PCI modems use the same chipset, so these instructions should work for them, and are based upon a downloaded Itex driver package (I looked on the Itex webpage but could find nothing there).

I'm using this in New Zealand where it cost me about $300. In Singapore it's a lot cheaper (should be below $200), Australia is similar and in the UK it's supposed to be available at less than UKP100.

The ADSL modem connects through a RJ11 connector on the wire supplied to a standard phone socket (BT-style in NZ, UK, Australia and RJ-11 style in Singapore). Your telecom company needs to give you an ADSL line first, and may charge a one-off fee for setup (usually $99 in NZ, or wait for the free installation month every year) and an extra monthly charge ($29 in NZ).

You will also need an internet service provider who is compatible with ADSL - not all of them can do it.  In NZ, and probably the rest of the civilised world (i.e. the Commonwealth) you probably need to run something called PPPOA (PPP over ATM where PPP is "Point-to-Point Protocol", usually used for old-stlye modems, and ATM is "Asynchronous Transfer Mode" a fast networking system for the telecoms companies). According to the documentation, the Itex module also copes with PPPoE (PPP over Ethernet) but I haven't tried that.


These instructions will get you working with PPPOA. I fully acknowledge and thank Itex for releasing the driver and their instructions in the first place.  Despite this, getting the ADSL modem to work was by far the hardest part of the job. I started with an installation of Linux Mandrake 8.1 (kernel 2.4.8), then tried Linux Mandrake 8.0, RedHat 7.0 and finally got it working on Redhat 7.1.

Under various combinations I had tried many standard and custom compiled kernels;
2.4.8 Mandrake
2.4.4 Mandrake, RedHat
2.4.3 Mandrake
2.4.2-2 RedHat
2.4.2 Mandrake, RedHat
also some 2.2.x (which definitely won't work)

The only combination to work properly was the 2.4.2 kernel on Redhat 7.1

You CAN NOT use the kernel source that comes with RedHat 7.1 (i.e. the kernel-source RPM, or the Mandrake RPMs for that matter), you really need to download a fresh 2.4.2 source from www.kernel.org.  This is explained in the instructions in download no.2 below.

Warning: if you don't follow the instructions properly, you WILL end up crashing your system when you try to load the driver/start pppd. I know, I did this many times. It's always useful before doing the "insmod itex1577-2.4.2.o" or before the "pppd" to do a "sync" so that if you crash, at least the hard discs won't suffer too much.



Everything you need is listed here. This is the ingredients. The recipe follows below it.

1. RedHat 7.1, installed, stable and running on your PC.
2. This zipfile modified from one from Itex which contains full instructions (originally in MSWord format, but I've converted this to .pdf), kernel patches, atm-0.78 and ppp-2.4.0b2 with patches. Finally it includes the itex1577-2.4.2.o driver module for the ADSL card and some example script files.
3. The kernel 2.4.2 source code (in .tar.bz2 format). The kernel is 20MBytes in size.....so you need a fast internet connection to download this, but you can't get the fast connection going UNTIL you've downloaded this.... There is a solution though, you can grab;
4. My precompiled 2.4.2-adsl kernel. [only get this if you can't compile your own yet] This works well for me and should do for you - at least well enough to get the system going initially for you to download the kernel source.....you should of course build your own kernel eventually.

5. A script for automatic startup of the ADSL when you boot.
6  A script for IP masquerading. If you have a home computer network (of any type) and want these to all access the internet through a single machine which has the ADSL card, then you will want to use IP masquerading. If you run this on your ADSL machine, it lets your ISP give you a single IP address, and all your other computers can share this address to access the internet....if also allows you to build some sort of security into the system by preventing (or at least making if more difficult for) crackers to penetrate your systems.  Up until recently people used somthing called ipchains for masquerading, but now threre is a more powerful too - iptables.


An overview of what you need to do with some hints and tips along the way.


1. Install RedHat 7.1, boot into linux, log in as root



2. You should download item 2 above (the Itex zipfile). Unpack it and read the pdf document in conjunction with the notes here.


3. Either download the kernel source, or my own precompiled kernel.
If you want to make your own kernel right now, skip to step 3.
If you download my precompiled kernel, then continue;

copy the downloaded kernel to the /boot directory;

cp vmlinuz-2.4.2-adsl /boot

then, if you use lilo as your bootloader (quite likely) edit /etc/lilo.conf and add an extra section to boot the new kernel by default.  My /etc/lilo.conf looks like;
 
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
prompt
timeout=50
message=/boot/message
default=ADSL

image=/boot/vmlinuz-2.4.2-2
        label=RedHat_original
        read-only
        root=/dev/hda1
        append="hdd=ide-scsi"

image=/boot/vmlinuz-2.4.2-adsl
        label=ADSL
        read-only
        root=/dev/hda1
        append="hdd=ide-scsi"

Things that I changed/added are in bold.  The new section I added at the bottom should be exactly the same as the existing default section except it's name and the image it refers to.  Keep the old kernel so you can boot this if things don't work out.  Save this and execute:

/sbin/lilo

If this gives an error DO NOT REBOOT UNTIL YOU FIX IT otherwise you won't be able to load linux.  Look at "man lilo".

Now skip to step 4.



3. Doing your own kernel

Follow the Itex instructions from 2.2.  Note that if you got the bzip2 (.bz2) kernel instead of the gzipped one (.gz), then change the tar command to:

tar jxvf linux-2.4.2.tar.bz2

Continue with the instructions. Apply the PPPoA patch as mentioned.  In the download from here, the patch is not gzipped, so skip the unzip command.

WARNING: if the patch command returns any error or comment you have a problem.  It's likely that the build won't work and indicates that you are either using the wrong patch file or downloaded the wrong kernel.  This is serious.  If you got it wrong here, don't waste a few hours trying to get it working - just give up now.

When it comes to step 2.3 (Configuring the kernel), you can save time by downloading my working kernel configuration. You can download this and just copy the file (called .config) into /usr/src/linux, overwriting the existing file.

Then you can skip the "make menuconfig".  However if you still want to configure for yourself (or fine tune mine - and this I recommend - turn off whatever you don't need), then do everything mentioned in the Itex instructions, but here are some attitional tips:
i) Make sure Hotplugging is DISABLED
ii) ENABLE PPP over Ethernet

After exiting the menuconfig program do the usual;

make dep
make bzImage
make modules
make install
make modules_install

As mentioned, if there is any serious problem compiling, you can do a

make mrproper

follow this by;

make oldconfig
make dep
make bzImage
make modules
make install
make modules_install

If all that worked, reboot.  If not, you may have not installed something needed for the kernel compilation.  You will need to track down what is NOT installed and find the RPM for that on your install CD.



4. Reboot

5. Install the ATM package.  As Itex mention, this might fail during make...but don't worry, do the make install anyway.

6. If necessary make the /dev/ppp device

7. Patch and compile the ppp-2.4.0b2 package.
Note that when you copy the atmdev.h, atmppp.h and atm.h files, you might be asked if you want to overwrite.  You do.

8.  Put your own config into the /etc/ppp/ setup files:

You will need some information from your ISP:
A username, domain and password.  Mine is something like:
username:    gdzn2301
domain:        acct.co.nz
password:    tryandguess

The first two are sometimes written:   gdzn2301@acct.co.nz

You also need to know about the connection method, the so-called PVC settings.  In New Zealand these are:
VPI=0, VCI=100, Framing=VC MUX

Your ISP and/or your ADSL modem supplier should have told you this.

For your information, my /etc/ppp/pap-secrets file looks like:
# Secrets for authentication using PAP
# client        server  secret                  IP addresses
gdzn2301@acct.co.nz  *  tryandguess  *
And this is identical to my /etc/ppp/chap-secrets.

My /etc/ppp/options file is:
lock
noauth
defaultroute
usepeerdns
proxyarp
asyncmap 0
name gdzn2301@acct.co.nz
user gdzn2301@acct.co.nz
plugin /home/PPPOA/ppp-2.4.0b2/pppd/plugins/pppoatm.so
0.100

Notice the extra commands I added in bold.

"usepeerdns" is used if your ISP is used to Windows users.  Windows gets the DNS (domain name servers - you know if these are wrong when you can ping an IP address but not a hostname) addresses automatically during the authentication process.

The information from the usepeerdns will be used by my adsl script later.



9. Now you are ready to test things out.  If anything went wrong the Itex module will totally crash your machine.  So do a

sync

Before inserting the module to write all recent data back to the hard discs. Then;

insmod itex1577-2.4.2.o

You will get something similar to the details given in the Itex instructions.
Wait for the SHOWTIME_L0.  If your computer crashed, reboot and try again. If it crashes a second time you went wrong somewhere....

If the module loaded OK then do a;

sync
pppd

If pppd didn't crash then things are looking good! See what your IP address is with;

ifconfig

This should show a ppp0 connection (if you were already using a dial-up account called ppp0 then you should now have a ppp1 as well).



This is where Itex finish their instructions.  From here on it depends what you're doing with your machine.

For me, I have a home network connected to a cheap ethernet hub.  The hub connects to the machine with the ADSL card.  This machine acts as my gateway to the internet.  It is also a web and other service server and acts as my firewall to protect me from all those crackers out there.  If you have a different configuration you are on your own, but can probably work something out from my settings.



10. To start up ADSL automatically when the machine boots, you need to copy the adsl script to your init directory;

cp adsl /etc/rc.d/init.d

and then link this into your default runlevel.  If you boot into X-windows when you startup, this is runlevel 5, otherwise it's probably 3 (you can check by looking inside /etc/inittab).  For runlevel 5 you do a;

ln -s /etc/rc.d/init.d/adsl /etc/rc.d/rc5.d/S16adsl

This starts the adsl service after any other scripts numbered S0 to S15 and before any scripts numbered S17 to S99.

You need to then look inside the script to customise it: especially to replace my path with your own path to where you keep the itex1577-2.4.2.o module!

My adsl script is a complete hack. It doesn't conform to any known standard. Is suboptimal, a bad example of shell scripting and a disgrace to all programmes worldwide...but it works for me!



11. If you want IP masquerading on the ADSL machine
This is generally a good thing.  It means other machines on your home network can have a fixed IP address.  In my setup those machines can have any address 192.168.0.x where x is usually numbered somewhere between 2 to 254.

To those other machines, your adsl box will have the fixed IP address 192.168.0.1 but in really it may have a different address assigned each time it connects up.

To get IP masquerading working, copy the iptables script to your init directory, but first, if you have a script already, back it up;

mv /etc/rc.d/init.d/iptables  /etc/rc.d/init.d/iptables-original

cp iptables /etc/rc.d/init.d/

Now edit the script to put in your own settings.  It's well commented and quite self explanatory thanks to the great Linux Journal article I copied most of it from...

Now make sure it starts automatically at bootup;

ln -s /etc/rc.d/init.d/iptables  /etc/rc.d/rc5.d/S08iptables

Oh, and make sure you have the iptables package installed!!

rpm -qa | grep iptables

should return something like;

iptables-1.2.1a-1

If not, it's time to go back to the installation CDs to grab this.

It's worth while, at this point, adding the IP addresses you have assigned for all your home network machines to /etc/hosts.  These should be numbered consecutively from 192.168.0.2 upwards (with the ADSL gateway machine itself traditionally being numbered 192.168.0.1)

Also manually setup routes to all 192.168.0.x machines on your eth0 port rather than the default ppp0 port.



12. Finally you need to set up other machines on your network.  If these are running linux (and I certainly hope they are), you will need to either use a good setup tool like linuxconf, or manually start up your network cards with fixed IP;

ifconfig  eth0  192.168.0.2  up

add the ADSL gateway machine to /etc/hosts
...
add the DNS servers manually to /etc/resolv.conf
...
set your default gateway to the ADSL machine: 192.168.0.1
...