dallaway.com - Writing - ADSL |
My notes on getting ADSL up and running on RedHat GNU/Linux 7.1 using the Alcatel SpeedTouch USB modem.
Original: September 2001. This version: $Revision $Date: 2002/01/11 10:40:34 $
Changes
2001/11/20: Added notes on reconnecting after a line drop, how to shutdown a server gracefully, and comment on
alternative drivers.
The starting point for this project was a P3 500 Intel box running RedHat 7.1 (2.4.2-2 kernel). I signed up for BTInternet's home USB/ADSL solution, and then started tinkering to get the machine running as a router, firewall and file server.
These notes are here mostly to remind me of what I have to do the next time I need to set up ADSL on a RedHat machine. They were written after the event, so I can only hope (but not promise) to have remembered the order for some of these steps. Disclaimer: you need to know what you're doing because just about everything in this document can lead to bust machines, lost or corrupt data or worse, and I have no way of knowing how it will pan out for you... so take care. I recommend you don't try anything in this document.
These are the steps you need to go through:
As an alternative, I'm hearing good things about Smoothwall. This appears to be a Linux distribution set up just to run as a firewall but with all the right magic patches to run the USB ADSL modem. I've not personally tried it yet.
I've also been told that the Benoit drivers allow you to get ADSL running without having to mess with your kernel. I've not looked at this yet and this document does not relate to the Benoit drivers.
Thanks to Johan Verrept for answering my dumb questions.
The objective of this first step is to make sure we can build a clean kernel. Once we have a working kernel we'll go on to patch it for ADSL support.
I downloaded the 2.4.9 kernel from kernel.org. I'd previously tried to patch and recompile my RedHat shipped 2.4.2 kernel, and it all went horribly wrong for me due to my lack of experience in building kernels. I ended up reinstalling RedHat.
I extracted the kernel to my home directory, ~/linux-2.4.9/
, and ran make menuconfig
.
These are the options I selected, but of course they are specific to my hardware. You almost certainly don't want to copy these. Rather, figure out what you need and set the kernel options accordingly.
Processor: SMP N SCSI Y scsi generic M scsi cdrom M ramdisk support Y initial ram disk support Y Low-level SCSI: aic6xxx M Networking: 3Com 3c905 Y File systems: DOS FAT fs support Y VFAT fs support Y Networking options/Network packet Y IP Netfilter config: Connection tracking Y FTP support Y IP tables support Y MAC address support Y Netfilter MARK match support M Connection state support Y Multiple port match support Y Packet filtering Y Reject support M Mirror support N TOS match support Y Limit match support M tcpmss match support M Full NAT Y Masquerade Y Redirect M MARK target M TCPMSS target M LOG target M Packet Mangling M TOS target M PCMCIA N PNPBIOS support Y Power manamgnet support Y Advanced power management BIOS support M Enable PM at boot Y
With those options set and saved, the kernel was built using:
make dep make bzImage make modules as root: make install make modules_install cd /boot mkinitrd initrd-2.4.9.img 2.4.9
I then set up Lilo to boot into the new kernel by editing /etc/lilo.conf
and adding the following lines:
image=/boot/vmlinuz-2.4.9 label=linux-2.4.9 initrd=/boot/initrd-2.4.9.img read-only root=/dev/sdb1
If you're feeling brave, you can make the 2.4.9 kernel the default by setting default=linux-2.4.9
. I ran lilo -v
then rebooted.
The objective here is to apply a patch to add in support for ADSL. This is well documented in the SpeedTouch HOWTO. So, all I'll add here is that the patch command I had to run was slightly different: patch -p1 -E --fuzz=3 < pppoatm-1
.
The aim of this step is to rebuild the kernel with the new patch, and switch on some options to enable ADSL
Again, this is well documented in the SpeedTouch HOWTO. I made some changes:
I then recompiled the kernel and rebooted (that's the last reboot, BTW).
Again, this part is well documented in the SpeedTouch HOWTO. I seem to remember the exact command sequence was a bit fiddly, so I'll document my command sequence:
# Download sarlib-0.2.4.tar.gz tar zxf sarlib-0.2.4.tar.gz # Rename folder to name expected by speedtouch mv sarlib-0.2.4 sarlib cd sarlib make cd .. # download speedtouch-1.5.tar.gz tar zxf speedtouch-1.5.tar.gz cd SpeedTouch make as root: make install
If you're trying out various kernel recompiles, each time you run make modules_install
the speedtch
driver is removed from /lib/modules/2.4.9/kernel/drivers/usb
. The fix for this is to simply go back to the SpeedTouch folder and run that final make install
.
This part is fully described in the SpeedTouch HOWTO. When I ran the make
on this
part, I was told "Warning: Object was compiled with libc-2.1.92, you APPEAR to be using libc-2.2.2". I ignored this.
Clue: The HOWTO talks about the mgmt
command. This now seems to be speedmgmt
.
I edited /etc/fstab
and added the following line:
none /proc/bus/usb/ usbdevfs defaults 0 0
Then, as root, ran: mount -a
.
There's more to do yet, but I found it useful to pause at this point to see how much was working.
So, I ran the following two commands as root...
modprobe speedtch modprobe usb-uhci
...and then put those two lines in /etc/rc.d/rc.local
so they happen each time my machine boots.
/var/log/messages
showed the following messages, which all looked pretty reasonable:
kernel: usb-uhci.c: $Revision: 1.1.1.1 $ time 09:05:09 Sep 7 2001 kernel: usb-uhci.c: High bandwidth mode enabled kernel: usb-uhci.c: USB UHCI at I/O 0xef80, IRQ 10 kernel: usb-uhci.c: Detected 2 ports kernel: usb.c: new USB bus registered, assigned bus number 1 kernel: hub.c: USB hub found kernel: hub.c: 2 ports detected kernel: usb-uhci.c: v1.251:USB Universal Host Controller Interface driver /etc/hotplug/usb.agent: ... no drivers for USB product 0/0/0 kernel: usb.c: registered new driver Alcatel SpeedTouch USB
I plugged in the USB modem and ran the speedmgmt
command, and the log said:
kernel: hub.c: USB new device connect on bus1/2, assigned device number 2 Speedmgmt[1160]: Alcatel SpeedTouch USB Management daemon started. Speedmgmt[1160]: (C) Alcatel 2001, Version 1.3.4 kernel: usb_control/bulk_msg: timeout kernel: usbdevfs: USBDEVFS_BULK failed dev 2 ep 0x85 len 512 ret -110 Speedmgmt[1160]: Preceding (timeout) error messages are normal. kernel: usb_control/bulk_msg: timeout Speedmgmt[1160]: Modem initialised at 576 kbit/s downstream and 288 kbit/s upstream
This all looks good. Note that the timeout and USBDEVFS_BULK messages are normal.
The final step is to install and configure a PPPoA-aware pppd to connect to BTInternet. The steps in the HOWTO explain this.
As root I installed the software with: rpm -i --force ppp-2.4.0b2-2.i386.rpm
. When I tried the command without --force
rpm complained about various pppd files being used by
some other install. I guess I should have tracked that down, but I didn't.
The configuration of pppd is as given in the HOWTO. In /etc/ppp/options
I added the usepeerdns
option.
Running pppd
started the PPP connection to BTInternet and my ADSL line was working. I think I may have copied the contents of /etc/ppp/resolve.conf
into etc/resolve.conf
to get name resolution working.
Two warnings I did see was: "modprobe: Can't locate module net-pf-4" and "modprobe: Can't locate module net-pf-5". To get rid of these warnings I edited /etc/modules.conf
and added the following lines:
alias net-pf-4 off alias net-pf-5 off
These modules seem to have something to do with Appletalk and IPX, neither of which I used. I also had to run depmod -A
after changing modules.conf
.
I had a few problems getting pppd running, which turned out to be typos I had in the chap-secrets file. One thing that helped me track down what was going on was to stop pppd and run it in a debug mode:
killall pppd pppd nodetach debug
To see the debug messages you'll have to turn on logging by editing /etc/syslog.conf
to add the following lines:
# Debugging, added for getting ADSL running: daemon.debug /var/log/messages
Then restart the logger: killall -HUP syslogd
I wanted to stop anyone coming in through the ADSL line, but allow my Linux machine to handle internet traffic for my laptop. This section documents the simple firwewalling and NAT set up I started out with, just to get me going.
The first step was to edit /etc/sysconfig/network
and change FORWARD_IPV4 to the value "yes".
Next up I created /etc/rc.d/rc.firewall
to hold my firewall configuration:
echo "1" > /proc/sys/net/ipv4/ip_forward echo "1" > /proc/sys/net/ipv4/ip_dynaddr iptables -F FORWARD iptables -F INPUT iptables -P FORWARD ACCEPT # not sure if next two are needed or not iptables -A INPUT -i eth0 -j ACCEPT iptables -A INPUT -i lo -j ACCEPT iptables -A INPUT -i ppp0 -p tcp --syn -j DROP iptables -t nat -F POSTROUTING # next rule is wrong, but DHCP fails if ACCEPT is DROP iptables -t nat -P POSTROUTING ACCEPT iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
I edited /etc/rc.d/rc.local
to run the rules at boot time by adding the following line to the end of the file: /etc/rc.d/rc.firewall
. I then made the rules executable and ran them:
chmod +x /etc/rc.d/rc.firewall /etc/rc.d/rc.firewall
I configured DHCP so my laptop could get an IP address and know where to go for anything internet related. In my network I decided that the server would be 192.168.0.10 and the laptop would be somewhere between 192.168.0.20 and .40. To get this running I created /etc/dhcpd.conf
:
subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.20 192.168.0.40; default-lease-time 2592000; option domain-name-servers 192.168.0.10; option routers 192.168.0.10; }
I then enabled dhcpd to start at boot time, and started it manually for now:
chkconfig dhcpd on /etc/rc.d/init.d/dhcpd start
The default RedHat install seems to be configured to run a caching name server. So I started it:
chkconfig named on /etc/rc.d/init.d/named start
For reasons I don't yet understand, connecting to the server for the first time takes a long time (I'm thinking named issues with reverse DNS lookups of some kind) and (b) if I want to telnet or ftp to the server I have to chkconfig ftp off and then chkconfig ftp on. Not sure why that happens at all.
With that little lot in place, the laptop can see the server and also straight out onto the internet for web and email and any other services.
Sometimes the ADSL line will drop. This always seems to be when my service provider (BT) are
having "difficulties". A typical message in /var/log/messages
will be something like this:
pppd[1535]: No response to 7 echo-requests pppd[1535]: Serial link appears to be disconnected. pppd[1535]: Connection terminated. pppd[1535]: Connect time 6.6 minutes. pppd[1535]: Sent 39783 bytes, received 243494 bytes. pppd[1535]: Exit.
To reconnect I run this command: killall pppd; sleep 1; pppd
as root. This kills off the PPP daemon and then restarts it. If BT are having problems, you may have to do this a number of times until it reconnects. I find it worth trying a few times, then leaving it for 15 mins or so before trying again. Sometime's it's good to call the BT Broadband service information line (0800 169 0199) so you can be told that, yes, there is a problem and BT are looking into it.
A known issue with these ADSL drivers is that your machine will panic and crash during a shutdown
. My solution is to run the following as root to shutdown my machine:
killall pppd killall speedmgmt /sbin/rmmod usb-uhci /sbin/rmmod speedtch poweroff