A 10-Minute Guide for Using PPP to Connect Linux to the Internet

 in
Having trouble connecting to the Internet? Here's an easy way to do it using PPP.
Dropping a Connection

To drop a connection you just need to kill pppd. When it exits, it will hang up the line, if you've configured the modem as I've suggested.

On most distributions this will be as simple as:

# killall -HUP pppd
Making PPP Automatically Redial

If you are lucky enough to have a semi-permanent connection to your ISP, i.e., one where you can stay connected for as long as you like, you may want to have your Linux automatically redial if the telephone call drops out for some reason. Here is a simple way of doing this that assumes you have configured your PPP link to be activated by root.

The first very important step is to add this line to your /etc/ppp/options file:

-detach

This line tells pppd not to go into the background after it has successfully connected. The next step is to add a line to your /etc/inittab file that looks like this:

pd:23:respawn:/usr/sbin/pppd
Put this line down with the other lines that are similiar to it—the ones that run the login program.

This line simply tells the init program that it should automatically start the /usr/sbin/pppd program and that it should automatically restart it if it dies. Provided you have your modem configured to raise Data Carrier Detect and you have configured pppd as I have described, init will ensure the pppd program is always running and re-run it if it terminates.

A word of warning—this is simple, but provides no safeguards against problems that might cause the telephone call to be successfully made and then hang up. If you experience this problem, the init program will quite happily keep re-running the pppd program until you tell it to stop. You could run up quite a telephone bill if something nasty goes wrong.

Conclusion

This article describes a basic PPP configuration. There are many excellent documents that provide more detailed and comprehensive information on the subject. This article should be sufficient to get you connected to the Internet in a typical configuration. If you have any problems you cannot diagnose, I strongly recommend you read the PPP-HOWTO by Robert Hart at:

http://sunsite.unc.edu/LDP/HOWTO/PPP-HOWTO.html

Robert has done an excellent job in rewriting the HOWTO, and it should be of assistance to you.

Terry Dawson is the author of a number of Linux HOWTO documents including the AX25-HOWTO, IPX-HOWTO and the NET-2-HOWTO. Terry has been an advocate of Linux from the moment he booted Linux 0.12 and saw the potential for Linux to significantly enhance experimentation in networking protocols in Amateur Radio. He can be reached via e-mail at terry@perf.no.itg.telecom.com.au.

______________________

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

regarding GPRS modem connection and ppp link

Anonymous's picture

Dear Sir,

I am able to establish a ppp connection through modem but when i kiil the process then i am not able to reconnect .

I am havingppp-on entry in the inittab file aslo. all options are set correct. Modem doesnot process AT commands untill hard reseted i.e power downing the modem.

Any help & suggestions would be highly appreciated.

Anil

White Paper
Linux Management with Red Hat Satellite: Measuring Business Impact and ROI

Linux has become a key foundation for supporting today's rapidly growing IT environments. Linux is being used to deploy business applications and databases, trading on its reputation as a low-cost operating environment. For many IT organizations, Linux is a mainstay for deploying Web servers and has evolved from handling basic file, print, and utility workloads to running mission-critical applications and databases, physically, virtually, and in the cloud. As Linux grows in importance in terms of value to the business, managing Linux environments to high standards of service quality — availability, security, and performance — becomes an essential requirement for business success.

Learn More

Sponsored by Red Hat

White Paper
Private PaaS for the Agile Enterprise

If you already use virtualized infrastructure, you are well on your way to leveraging the power of the cloud. Virtualization offers the promise of limitless resources, but how do you manage that scalability when your DevOps team doesn’t scale? In today’s hypercompetitive markets, fast results can make a difference between leading the pack vs. obsolescence. Organizations need more benefits from cloud computing than just raw resources. They need agility, flexibility, convenience, ROI, and control.

Stackato private Platform-as-a-Service technology from ActiveState extends your private cloud infrastructure by creating a private PaaS to provide on-demand availability, flexibility, control, and ultimately, faster time-to-market for your enterprise.

Learn More

Sponsored by ActiveState