by Manuel Trujillo Albarral
This article explains how to manually setup an internet
connection using ppp and chap.
Here we have something lots of users face up to in their early stages of setting Linux up: Connecting to the Internet.
We'll see how we can do it, step by step, and in an easy way:
1.) The first thing: check whether your kernel supports the PPP protocol or not; it's the protocol most often used by Internet providers. Check by typing the following:
dmesg | more
Scroll pages by pressing the space key.
You should see a line such as the following:
PPP: version 2.2.0 (dynamic channel allocation) TCP compression code copyright 1989 Regents of the University of California PPP Dynamic channel allocation code copyright 1995 Caldera, Inc. PPP line discipline registered
If you don't have it, don't worry, you'll simply have to recompile the kernel, selecting the appropiate options. How do you recompile the kernel? Well, this issue could well take a whole new article, but you can check it out in the SLUG Linux list or in any other you might be in. It is also well described in the README file distributed with the kernel source code.
2.) Next, go to the /etc/ppp directory, where we'll edit several files.
The first one of them will be the so-called "options"
Edit it with your favorite editor (not a few in Linux, indeed... ;-) and delete everything it may have, surely the word "lock".
Then write the following:
connect /etc/ppp/connect_file_name crtscts modem passive +ua /etc/ppp/ppp_provider_name (only in case you are using Infovia in Spain) noipdefault defaultroute asyncmap a0000 lock lcp-echo-interval 15 lcp-echo-failure 5 mtu 1500 /dev/modem 38400(choose speed: 38400, 57600, 115600. You only have to write the number)
Now, edit the file you wrote in the line connect in the "options" file. In my case, for example, I'll call it "dracnet":
chat -v "" ATE0DTXXXXXXX CONNECT "" login: my_login password: my_password
Next, save the file.
Where it reads ATE0DT, you can simply write
ATDT. I write the E0 option in order to disable
The XXXXXXX refers to your Internet provider telephone number; in case you are using Infovia (Spain), it will be 055.
3.) Now edit the file associated with the line "+ua", in the options file, which in my case I'll call "dracnetppp":
my_login my_passwordDon't forget to press Return after the last line of the file.
4.) Next, go back in the directory tree and position yourselves in the /etc directory, with cd ..
Once there, edit the file "resolv.conf". If you don't have it, no problem. Just write the following (always deleting anything it may contain before; assuming you're not networked with other computers, you can do it peacefully ;-):
domain provider.com nameserver XXX.XXX.XXX.XXXSave this file.
Note that the "domain" section is just the domain your provider uses. In my case it would be "dracnet.es".
In the "nameserver" section you'll put the IP
address of your provider's main name server.
If you don't have these data available, please ask your provider for them, he or she will give them to you.
5.) Now go to /usr/bin (cd /usr/bin), and edit a file called connect, by writing the following:
pppd;tail -f /var/log/messagesSave this and give it execute permission with "chmod +x".
Et voila!! Here we have our Linux box, ready to connect to the Internet. Just execute (from wherever we want) the file "connect", that's all.
When you execute it, you'll see, step by step, the connection process with our provider, thanks to the "tail" command we wrote in the "connect" script. When our IP address has been assigned, we can get out of "tail" by pressing Ctrl-C.
Webpages maintained by the LinuxFocus Editor team
© Manuel Trujillo Albarral, FDL
2002-10-28, generated by lfparser version 2.33