Matt Wright Consulting
Greg Ferguson - Converted the mini-HOWTO from HTML to Docbook 3.1 (SGML).
This HOWTO exists because a mate of mine needed to easily set up an Internet connection to BTinternet and here is a quick and concise way to get a running PPPd to Btinternet. This HOWTO also briefly covers Howto setup basic IP Masquerading to allow connection sharing.
This document is Copyright 2001 by Matt Wright. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html
Send feedback to firstname.lastname@example.org.
Please note: There is a mailing list available for this howto. If you wish to join please email <email@example.com> with the body:
This will then be followed up by the mailing list bot and subsequent emails should arrive confirming your request. The list is intended to be for annoucing changes to this HOWTO and also to dicuss the finer points of getting pppd to work on BTinternet.
My name is Matt Wright. I'm 16 year-old student in Blackburn, Lancashire. I'm a freelance Linux consultant. I am the proud owner of a Duron 950Mhz (all I could easily afford) with 256MB SDRAM, Voodoo 4 Video Card, ATI All-in-Wonder Pro Video Card. I also have a 266Mhz Cyrix that runs my USB ADSL connection, of which if you are reading this from http://www.consultmatt.co.uk you will be using.
A major thanks of gratitude to the guys at Linuxdoc in particular Greg Ferguson and David Merrill for help with getting this into trusty SGML. Also to Rob Smith the guy behind me writing this :) (As he couldn't sort his own Linux box out :P). A great vote of thanks to Bill Staehle for his input in ironing out some major flaws. Also a thank you goes to TonyC at btinternet.linux and the rest of that newsgroup for originally getting me on my feet with BTi. Finally and most importantly my thanks goto my Lord and Saviour Jesus Christ, without whom I'd be lost.
The following is needed to use this HOWTO:
Right, to start off you will need a working installation of PPPd, I know from experience that Mandrake 8.0 that sometime is doesn't install pppd so check its installed first. Once it is it usually resides in /usr/sbin/pppd check that any users you want to access it have setuid access.
Note: Setuid allows pppd to run as-if root allowing non-superusers to run pppd without less problems. To do this use the command chmod 4750 /usr/sbin/pppd. Beware: Some distributions have a watchdog program that will change the pppd permissions back to normal. I have not tested this but on RedHat derived systems with Linuxconf installed then removing the /usr/lib/linuxconf/redhat/perm/ppp should stop this happening.
The Chatscript is a text file, usually residing in /etc/ppp that contains the commands passed to the modem to make it dial to BTi. If you want to compare this to DUN in Windows then this is the phone number and init commands.
Below is the chatscript used to dial BTi, I've now opted for putting the \T metacharacter in the script. The means when we run chat, inside the pppd command, we can use a -T parameter and supply the needed telephone number.
This script will dial BTi providing you put in the \T so we can added the telephone number later. I suggest saving the chatscript as something like /etc/ppp/chatscript Once you've saved it we can move onto setting up BTi's CHAP authentication.
With PPP dialup's the most widely used authentication method, apparently, is PAP (Password Authentication Protocol). However, just to be a pain in the backside BTi use CHAP (Challenge Handshake Authentication Protocol). To be fair CHAP is a more secure authentication method than PAP but it's still a pain. Now PPPd does support this but not through nice easy to use Linuxconf dialogs.
In the /etc/ppp directory should be a chap-secrets that looks roughly like this when first installed:
We can safely ignore the IP Address column but the others me must worry about. So fill in the gaps like this:
These two extra lines will try and authenticate ANY outgoing PPP connection that responds using CHAP using your BTi details. It goes without saying that you replace firstname.lastname@example.org and mypasswordhere with your details. Also, the second line is not strictly needed but I've found it helps sometimes.
Note: If you're not using BTi at this point you can usually get away with having identical chap-secrets and pap-secrets. If you the same kind of pattern as above it should work.
I suggest that you do a "chmod 600 /etc/ppp/*secrets". It was pointed out to me that it stops pppd shouting about security.
In your /etc/ppp directory there is a file called options. If your open it with your favourite text editor you should see:
And thats it, now we need to add some more settings in here so make it look like:
Don't worry what they do, if you're interested look at the man page for pppd. As a passing note if you would like PPPd to redial dropped connections then add persist to the end of your options file.
Now you've created your Chatscript there are only two steps left till you should be on the Internet. First is getting a working link and second is creating a couple of easy dialup scripts to help you.
To test your link try this command:
pppd ttyS0 connect '/usr/sbin/chat -v -TPHONE_NUM_HERE -f /etc/ppp/chatscript' updetach debug name email@example.com
Now obviosuly if your testing at Daytiem rate add the Daytiem number where instead of PHONE_NUM_HERE and similar with Surftime.
This will tell PPPd to dial the modem on ttyS0 (COM1) using the chatscript. The updetach tells PPPd to only fork away to the commandline after the connection is established and the debug will show all authentication commands onscreen (providing updetach it set) while it trys to connect.
If that connected then move onto the next section and we can make a set of scripts to allow easy dialing.
Here I'll just set out a set of scripts that will let your dial BTi from a command line easily. The following should be self-explanatory, the italic filename is the filename to put the data into and the proceeding text the file contents:
Change any of the filenames to suit what you called them and the username. Do the same with this:
Once you've done that run this command at the command prompt:
chmod a+x /usr/bin/internet
Now you've done, simply type internet daytime/surftime/off and it will connect you to the internet.
I'm sorry, for all you Anytime customers its really hard! NOT! Read all the instructions for Surftime above. They all apply in most places, the only things to watch out for is you obviously don't need any of the Surftime/daytime distinctions. So only have one peers file (using the correct phoen number) and one dialup option in your /usr/bin/internet file. (eg. dial and off)
There is rather a large amount of credit due here, to Chris Jones for writing the Alcatel Speedtouch USB ASDL Modem mini-HOWTO that is now part of the DSL HOWTO. This helped me a great deal when trying to get my Speedtouch to work.
At home I use Linux Mandrake, although the version of the kernel I had was patched with the ATM kernel source I did end up patching a different kernel source to get it working. Please, please inspect your kernel source to see if you have the PPPoATM source patched against your kernel. To do this go into you kernel source directory, usually /usr/src/linux and do a make menuconfig. In the Network Device Support section check for:
If it does exist then make sure it is present it you current kernel and you can skim-read the "Patching you kernel" section to make sure you have the correc toptions compiled in and then carry on.
This was just a minor warning as I orginially had a kernel patched with PPPoATM and without realising managed to trash my kernel tree by trying to force the patch onto it.
I have had reports about different distros that have varying PPPoATM support already builtin to the kernel:
NOTE: From roughly kernel 2.4.16 the PPPoATM patch is included in Linus' main source tree. Therefore you can miss out patching the kernel and just configure it.
To get your Speedtouch USB working in Linux you have a fairly heavyweight task ahead of you, but hey, if I could do it so can you! This is what you'll need to get it working:
To get the Speedtouch working under Linux you will need some software and kernel patches found below:
Once you have the PPPoATM kernel patch (this assumes you use the patch against kernel 2.4.7) you need to make sure you have a working 2.4.7 kernel tree, next unzip the PPPoATM patch by doing:
NOTE: From rougly kernel 2.4.16 (I haven't tested to see hwo far back it goes) the PPPoATM patch is included in Linus' main kernel tree, therefore you may skip the patching below and resume ready to configure the kernel.
gzip -d pppoatm-2.zip
Next we will need to test-patch the kernel using the following commands:
patch -p1 -s -E --dry-run < /point/to/pppoatm-2
If that ran without failure then patch the kernel by removing the --dry-run as such:
patch -p1 -s -E < /point/to/pppoatm-2
That should have patched the kernel good-and-proper so we can go ahead and configure it, make sure the following options are selected along with your personal build options:
You could select any of these as modules or compiled-in but as I followed Chris Jones' HOWTO I compiled the all but UHCI/OHCI as compiled-in code. Save the kernel config and compile the kernel and modules as you normally do.
Now that the kernel will support using PPPoATM we can start compiling the bits to run the modem. Well start with the Kernel mode driver; first decompress the SARlib sources to a build directory. (Personally I build all my non-kernel sources in ~/sources) and do a make on it. There is no need to do a make install with this library.
Next return to your source root and decompress your Speedtouch drivers (from Sourceforge not Alcatel!), go in there and do a make, and then a make install.
Note: If you get an "Error 1" then check the Makefile for a line starting SARLIB:= and check it points to the right directory, the one where you just compiled SARlib.
Next install the Hotplug software and make sure it works. Once you've done that decompress Alcatel's binary management software and do a make on that. Then do a make install, the clever bit here is their installation registers the Speedtouch kernel driver and their binary to be run when the USB device is "hotplugged" (or coldplugged) into the system. Kiss goodbye to the hours of trying to writing modules loading scripts that always fail.
Next install the new PPPoATM aware PPPd program, I had no luck getting it compile from source on my machine so I used the RPM. Sorry you're on your own there!
Warning: The action will remove all the default settings for any previous PPPd connection. (Not that you want them now you've got shiny new ADSL ;P)
In the /etc/ppp directory there is a file called options in that file put the following:
Make sure of the following things:
Next in your /etc/ppp/chap-secrets put:
Next thing to do is get the link up and test it. If you've got a nice distro like Mandrake you should find it will auto-init your USB drivers and filesystem, if not then the following can be used:
mount none /proc/bus/usb -tusbdevfs
Next load the Speedtouch driver by doing: /sbin/modprobe speedtch. Next use the speedmgmt program to get the modem init'ed: /usr/sbin/mgmt. After a while of the lights flashing on the modem the main console (and/or the syslog) should report:
Once the modem has been init'ed now make sure the PPPoATM module is loaded by doing:
Now start the PPP link by typing pppd You should see something similar to this:
Once that's done you're in luck, now just configure the pppd to autodial at startup (beyond the scope of this HOWTO, sorry!). Hopefully HotPlug will get your device up and going before pppd needs it! :).
To allow sharing of your internet conenction you can eitehr use a proxy server or IP Masquerading. I'll cover IP Masquerding as it's simple to set up on the other client machines. I use a 2.4.x generation kernel and in effect I use IPTables. If you use a 2.2.x or 2.0.x kernel then you need the IP Masquerading HOWTO.
This part of the HOWTO assumes that your Netfilter software is modularised, if it isnt then no big deal, either ignore the modprobe lines or recompile your kernel.
Simple now, just run the commands:
iptables -t nat -F POSTROUTING
iptables -t nat -A POSTROUTING -o ppp0 -s 10.0.0.0/16 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
Note: The space between 1 and > is vital. It seems not to activate the IP Forwarding if the space is not there.
Change the ppp0 and/or the 10.0.0.0/16 for your relevant network settings and put that file either before the case "$1" in in the internet file or somewhere in your startup.
Problem: Lynx is unable to access document or ping gives "No route to host" but the link is stable!
Solution: Have a look at the output of route -n you should see a refenence specifing a gateway of either your Remote PPP IP and using the adapter/dev of ppp0. If not here is how to fix it. In your /etc/ppp/ip-up file above exit 0 on the last line type:
Save the file and redial. The problem should be solved.
Problem: Your kernel below 2.4.2 crashes using the Alcatel driver.
Solution: You're probably using a kernel compiled with SMP support either don't use SMP or try here: http://sourceforge.net/project/showfiles.php?group_id=23818
Problem: When PPPd attempts to access the ATM device it crashes.
Solution: The kernel was probably compiled on a different type of processor. I tried to get the kernel compiled quicker by compiling the kernel on my 950Mhz Duron, even with the processor type to suit the target 266Mhz Cyrix the ATM module crashes. So dont take short cuts and compile on the target processor.
Problem: When you have compiled the Speedtouch Kernel driver (speedtch.o) trying to insmod/modprobe returns: "Unresolved symbol: _mmx_memcpy" or similar.
Solution: Right, I haven't got a concrete answer here but I couldn't find it anywhere on the internet so here goes. I found this error come up when I recompiled my kernel once. It did it the first time but I forgot how to fix it. A combination of things fixed it for me:
Problem: When you pick up the phone there are strange noises present, more over the use of the phone line causes the internet to disconnect.
Solution: You seem to have something which I thing is called cross-frequency. The ADSL modem works by sending data down the unused frequencies of you copper phone line. If the hardware is set up so the ADSL and phone ranges overlap the two can receive each other's data. Ring BTO Customer Support and they should be able to help.