Sunday, 5 June 2005

Bewan PCI ADSL Card

So I finally got around to completing the rebuild of the gateway machine at home. I went through a lot of hassle getting the Bewan ADSL card to work last time, so this time I decided to write up the process properly, in case it is of use to anyone else. Fortunately, with a 2.6 kernel the process at least only requires a lot of sysadmin skills (unlike with 2.4, where I ended up debugging the kernel driver).


First, build your own kernel. Don't waste any time trying to get it working without this — even getting the driver compiled is a nightmare without your own kernel source tree to hand, so it's worth taking the longer route. Build a 2.6 kernel (I used 2.6.11.11 with no problems). Enable "Asynchronus Transfer Mode (ATM)", "Classical IP over ATM", "PPP (point to point protocol) support", "PPP over ATM", and "ATM over TCP" (and don't forget iptables, NAT, and everything else you will need to actually use the connection).

Once you have build this kernel, make a synlink from /usr/src/linux to the kernel source tree. Now get the bast-0.9.0.tgz from Bewan's site & extract. To compile it, you will need, unusually, the g++ compiler. First go into the libm subdirectory and make. Then cd ../unicorn_pci and make.

You don't have to do the above kernel or unicorn module compile on the machine which will actually be the gateway and have the card. In my case, the gateway machine was a very old box without enough disk space to do this compile, so I built both kernel and module on another machine. If so, now is the time to install the finished kernel on the target machine, and copy ove rthe unicorn directory tree.


The install makefile rule for the unicorn driver seems to be broken (for 2.6 kernels, anyway). So just manually copy unicorn_pci_atm.ko, unicorn_pci_eth.ko to /lib/modules/version/extra/ (where version is the version of the new kernel) (and making that directory if it doesn't exist yet). Add pppoatm and unicorn_pci_atm to /etc/modules (or whatever equivalent your distribution has listing modules-to-load).

Reboot the target machine into the new kernel. The unicorn module should load okay — check dmesg and the output of lsmod to see that everything is in place as expected.


Next, we need the userspace supporting software set up. This is much easier these days, because most distributions should ship a new enough pppd that the ppp-over-atm support is already included. For Debian, for instance, it should be sufficient to apt-get install ppp libatm1. Crucially, you should end up with a file like /usr/lib/pppd/2.4.3/pppoatm.so.

Create a new /etc/ppp/peers/dsl file, containing something like this:
noipdefault
defaultroute
sync
user "whoami@lon1-aj2d.demonadsl.co.uk"
noauth
noaccomp
nopcomp
noccp
novj
holdoff 5
persist
maxfail 25
usepeerdns
plugin /usr/lib/pppd/2.4.3/pppoatm.so 0.38
The main things in there are the username (provided by your ISP), the usepeerdns (to add nameservers supplied when you connect to your resolv.conf) and defaultroute (to add a default route going over the DSL line). And of course the pppoatm plugin.

Now add a line to /etc/ppp/chap-secrets setting the password for the username set above:
# Secrets for authentication using CHAP
# client    server  secret          IP addresses
"whoami@lon1-aj2d.demonadsl.co.uk"  "*" "mypass"    "*"

For Debian, you can now just add this ppp provider to /etc/network/interfaces:
auto ppp0
iface ppp0 inet ppp
provider dsl
(obviously omitting the auto line if you don't want it to be started automatically; instead, you would use ifup ppp0)

For other distributions, you can use whatever method it favours, or instead use an init script to call ppp file /etc/ppp/peers/dsl.

0 comments:

Post a Comment