Configuring pppd in Linux, Part II
In Part I of this article (see the February 2002 issue of LJ), I explained how to configure the modem. At the end of the article you ended up with a symbolic link called /dev/modem that pointed to the right device file for your modem. You were sure that everything worked fine, as you connected to your internet service provider (even though you didn't establish a PPP connection). In this article I go further, explaining how to connect to the Internet. You are advised to read the previous article first. If you can't, just make sure that your modem is configured correctly, and that you do have a symbolic link called /dev/modem that points to the right device file in /dev.
In order to make any use of this article you should have all the login information about your provider, including the phone number you should dial to connect, your login and password, and a valid DNS server address (this is optional, as it can be assigned automatically by your provider).
This article assumes that your provider accepts PAP authentication. PAP is a way of sending your login and password information to the provider through the PPP protocol; it saves the users from the more complicated (and often manual) login procedures required by some internet service providers in the past. The vast majority of ISPs today will require you to use PAP. This article also assumes that you have a standard modem and not a Winmodem. Configuring a Winmodem is possible but can be tedious and is outside the scope of this article.
First of all, you must be logged in as root to configure your internet connection. A connection to the Internet via the modem is established using PPP (point-to-point protocol), which is used to encapsulate common TCP/IP packets so that they can be sent through a serial line (in fact, TCP/IP packets are meant to be transmitted over a network medium and wouldn't fit, as they are on a serial connection without being serialized first).
This article assumes that you have the following software installed: the kernel module that handles the PPP connection (every distribution I know of comes with a kernel that includes the PPP module, so you probably don't need to worry about it); the program pppd, which initializes the kernel modules after establishing the connection; the program chat, which is responsible for establishing the connection; and the program minicom, a very simple terminal program that lets you talk to the modem. To check if you have all of these programs, you can use the which command. This command tells you if the programs are available in one of the directories listed in the $PATH environment variable:
which pppd /usr/bin/pppd which chat /usr/bin/chat which minicom /usr/bin/minicom
If you don't have some of these programs, you should grab the right package and install it. You also might want to disable the call waiting for your telephone line. If it is active, an incoming call could cause the line to drop while you are connected.
Once we configure the modem, how do we connect to the Internet? We have to use (and configure) a program called pppd (point-to-point protocol dæmon). The following is what happens when you run pppd (assuming that chat is used as the dialer program and that pppd is correctly configured).
The dæmon starts. It sets the serial port parameters (speed, etc.). Then it runs an external program (chat) to establish the connection, which sends the connection command to the modem (ATDT followed by the provider's number). Then it waits for the string CONNECT from the serial port. At that point the connection has been established, and it's as if there were a serial cable running from your computer to the provider's computer. Once chat has finished its job, the program pppd takes over again. If the connection could not be established, pppd will exit and return an error. Otherwise, it will talk to the PPP dæmon on the other side of the line (the PPP handshake that you saw earlier as a bunch of indecipherable symbols) and will be assigned an IP address. A login and a password normally are required to complete this stage successfully (login information is sent during the PPP handshake). The program pppd makes sure that a kernel network interface is created and that the network traffic is directed to it.
The two programs that you need, pppd and chat, are not interactive. They are run and then send any messages to the system log dæmon, syslogd. The syslogd will then write the received messages on the hard drive. There are several classes of messages, and the different classes usually are stored in separate files. The exact place they are stored depends on your syslogd configuration.
Now, you should configure syslogd so that you are 100% sure that the debugging information from the dæmons pppd and chat actually are stored on disk—and that you know where they are. The configuration file for syslogd is /etc/syslog.conf. All you have to do is enter one extra line to it. To do that, just type the command:
vi /etc/syslog.conf
Of course, you may use any editor you like (vi, Emacs, joe, pico, etc.). Now, insert the following line:
daemon.debug;*.info /var/log/ppp_articleRemember that there should be a tab between info and /var/log/ppp_article.
Now, you have to make sure that the dæmon syslogd knows about the change in its configuration file. To achieve this, run the command:
killall -HUP syslogd
The file /var/log/ppp_article should have been created and should contain one line that tells you that syslogd has been restarted. To check that this is true, you can type the following command:
cat /var/log/ppp_article Aug 4 19:28:46 merc_linux syslogd 1.3-3: restart.Instead of the cat command, which just reads a file, you can use the command tail with the option -f. This will keep on reading a file and will print on the screen any new information added to it. This means that as soon as syslogd writes anything on the file ppp_article, tail will show it on the screen:
tail -f /var/log/ppp_article Aug 4 19:28:46 merc_linux syslogd 1.3-3: restart.From now on, any logging information recorded by pppd or chat will appear on the screen automatically. You really should keep this console open always, and check for messages whenever you need to.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- A Topic for Discussion - Open Source Feature-Richness?
- Home, My Backup Data Center
- RSS Feeds
- What's the tweeting protocol?
- New Products
- Trying to Tame the Tablet
- Dart: a New Web Programming Experience
- Reply to comment | Linux Journal
14 hours 51 min ago - Reply to comment | Linux Journal
17 hours 24 min ago - Reply to comment | Linux Journal
18 hours 41 min ago - great post
19 hours 16 min ago - Google Docs
19 hours 38 min ago - Reply to comment | Linux Journal
1 day 27 min ago - Reply to comment | Linux Journal
1 day 1 hour ago - Web Hosting IQ
1 day 2 hours ago - Thanks for taking the time to
1 day 4 hours ago - Linux is good
1 day 6 hours ago
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




Comments
Re: Take Command: Configuring pppd in Linux, Part II
Really helpful