[Home] [Credit Search] [Category Browser] [Staff Roll Call] | The LINUX.COM Article Archive |
Originally Published: Friday, 31 August 2001 | Author: Randy le Jeune |
Published to: learn_articles_firststep/General | Page: 1/1 - [Printable] |
Connecting To The Internet With Linux
Sometimes getting on line with Linux can be challenging, especially for the new users. This article from Linux.com Learn section clears up the line.
|
Page 1 of 1 | |
The /etc/ppp/options FileThe options file is used to specify certain options (big surprise there!) for your method of connection. Mine looks like this:
The first line is the serial port that your modem is on. My modem is on serial port ttyS0 (or COM1 in Windows). By the way, make sure you only have one device specified as your modem. Some people get confused and try to use both /dev/ttyS0 and /dev/modem as the device file for their modem. This will produce an error. It would be OK, however, to make /dev/modem a symbolic link (shortcut) to refer to your modem. The "connect" line specifies the name and location of the chat script that I will describe below. You may have to figure which one yours is on by trial and error, or with t a tool like kermit or minicom. The next line specifies the speed at which the transmissions are to take place . . . I have a Rockwell 56K modem and the standard speed for a 56K is 115200. The "lock" option writes out a lock file to the /var/lock directory that ensures that no one else can use the modem while I am using it. Linux does this with a number of devices; if you use a device like a modem once and then find that when you try to dial out a second time, you get an error message, chances are that your modem lock file is not being deleted when you relinquish control of the device. This may seem a bit uncalled for, but remember that Linux is a multi-user system -- only one person can have exclusive access to some devices at a time. My ISP uses a version of PAP and so I need the line "user {username}". If your ISP uses a different authentication protocol, you may not need this line. The line "crtscts" means that the modem is using hardware flow control (this is almost always true under Linux). The "defaultroute" option adds a default route to your local routing table using the remote IP address as the gateway. The "noipdefault" line is used because I connect using a modem and not a cable, and my machine does not have one fixed IP address, but is assigned one from a pool of available IP addresses each time I dial in to Earthlink. If you have problems connecting, then place "debug" at the end of this file and it will write out error messages to the /var/log/ppp log and if you read over it, you will get some idea of what is going wrong. Once you've found the problem, however, remove the "debug" line from this file or it will keep writing out messages to your log file and it will get larger and larger, taking up more space without performing any useful function. Your /var/log/ppp file should look something like this:
Although slopping through this output may not look like the most enticing of activities, it usually will give you some hints as to where you went wrong, or whether the authentication server was expecting something that it didn't receive, and may give you the chance to make allowances for it, or to try something else. (By the way, you are generally best off by using as few of these "options" as is necessary to get your PPP connexion to work . . . if you don't need it, don't use it!) The Chat Script FileThe chat script is the file that actually does the handshaking with your ISP. Unfortunately, it is rather difficult to say exactly what information you need in this file as the details depend somewhat on your ISP. This script can have a variety of names, but is located in the /etc/ppp directory. The name of this chat script will need to be placed in your options file after the "connect" command (as shown above). I use Earthlink as my ISP, so I call my chat script earthlink-connect, but I could have chosen any name I wanted to as long as I specified it in the options file. Your ISP may be of some help in telling you what their authentication daemon expects to see in this file -- you may want to ask them whether their server requires the use of a script with certain specific expect/send pairs (what you send must be what the authenticating server expects to receive -- otherwise the server won't understand the information you are sending to it) -- if so, ask them to specify exactly what they are, so that you can configure your script correctly. Again, do not be surprised if you are given some incorrect information -- this sometimes requires a good bit of trial and error in order to figure out exactly what the server expects. by the way, this was the most annoying aspect of the whole operation to me, but once you figure out the correct options to be used, you'll find that it was rather simple all along. These expect/send pairs represent command responses that must be passed by the script in order to turn on the PPP server at the ISP but it usually looks something like this:
This probably looks a little mysterious, so let me try to explain it a little. The crunches (#) signify that the line is a comment. The "exec /usr/sbin/chat -v" line means that the program called chat, located in /usr/sbin will be executed (this is necessary for connexion to take place). The -v option stands for verbose -- this specifies that any output in the logs will be more easily readable by humans -- extremely helpful when reading and trying to troubleshoot the connexion by reading the message logs. The next few lines deal with the modem. "TIMEOUT" is the time (in seconds) before the dial-up attempt is aborted (OK, I'll admit that two minutes is a bit excessive, but if you have problems, you may want to increase the number . . . the default is usually like 30 seconds or something -- usually, but not always.). The next two lines tell the chat program to "abort" the attempted dial-up if the phone line is busy or if there is no dial tone. The next line resets the modem to the factory defaults. The next line actually dials the ISP phone number (keep in mind that this number can change with little warning). If this line doesn't work, you may want to check your ISP's dial-up number, or if you have a pulse rather than a tone telephone line, replace the "ATDT" with "ATPT". I don't think the hyphen separating the two sections of the number is necessary . . . remember to include the area code if you are dialing long-distance. The next line is the instruction to actually complete the connexion, and the next two lines are my login and password (don't try using it as I have changed them for security purposes!). With Earthlink, you need to prefix ELN/ to your username -- this is just one of the peculiarities of dealing with that ISP; this is because the Earthlink server that I dial into is an Windows NT server and it requires that you put the domain name before your username and Earthlink's domain name happens to be "ELN". Others may not require this, or may expect something different, so try to find out what your ISP expects. The reason the initial letter is left off of "login" and "password" is to allow for the fact that your ISP may use upper-case or lower-case initial letters for these words. By omitting the first letter, you avoid this difficulty. Again, there may be some difficulty here, as your ISP may expect "Name" or "userid" instead of "login". If you try a number of these and nothing works, ask them and find out. mentioning "AOL" in your conversation with a rep often works wonders, by the way. If you try to connect, but are unsuccessful, add the "debug" line at the end of yout /etc/ppp/options file like I mentioned above, then check your /var/log/ppp and /var/log/messages files. If you see something like "auth pap" or "auth chap", then you need to use those authentication protocols. CHAP and PAP are "authentication protocols" which determine that you are really the person who should be using your account. Your pap-secrets and chap-secrets files are located in the /etc/ppp directory and should look something like this (with the appropriate username and password, of course).
I think I should mention that there are many versions of each of these protocols and this might not work for each and every one, and of course some ISP's may require you to log on using more than one of these authentication schemes, so if none of this works, ask them. The ppp-on FileOne last files that you have to add is your ppp-on file, which will be located in your /usr/sbin or / directory. This is what actually turns on PPP. I couldn't start my PPP services without this file, and as it turned out, this was my main problem in getting connected. The same rules apply as before, but you need to know the subnet mask of your ISP (most are class "C" masks nowadays; that is, 255.255.255.0).
TELEPHONE=344-0514 The /etc/hosts FileNormally the /etc/hosts file isn't used for much if you have a nameserver, and if you don't have a nameserver, you probably won't be going very far, as one single hosts file cannot possibly take the place of the worldwide DNS database. But you should put the name of your local host machine in here and the internal loopback address. Any aliases that you use in your other configuration files (such as /etc/hosts.deny) must also be specified in here.
| |
Page 1 of 1 |