Dial-up Networking (PPP) II
Summary:- Testing Your Configuration
- Running pppd As A User
- Running Programs After Connect/Disconnect
- Making pppd Connect Automatically
Testing Your Configuration
Believe it or not, but you are (quite) set ;-). Still being 'root', issue the commandpppd call {peerfilename}
pppd call isp1
ping
First try your ISP's name server(s). Take one of the IP values the PPP program has entered in '/etc/ppp/resolv.conf' and type
ping {IP-Number}PING {IP-NUMBER} ({IP-NUMBER}): 56 data bytes<br> 64 bytes from {IP-NUMBER}: icmp_seq=0 ttl=39 time=239.2 ms<br> 64 bytes from {IP-NUMBER}: icmp_seq=1 ttl=39 time=230.0 ms<br> 64 bytes from {IP-NUMBER}: icmp_seq=2 ttl=39 time=230.0 ms
ping 216.71.159.34
ping netscape.com
PING netscape.com (207.200.75.200): 56 data bytes<br> 64 bytes from 207.200.75.200: icmp_seq=0 ttl=39 time=229.3 ms<br> 64 bytes from 207.200.75.200: icmp_seq=1 ttl=39 time=230.1 ms
killall pppd
Running pppd As A User
Since the PPP daemon needs access to vital parts of the system, it can only be run by 'root'. It is possible however to change this. This involves changing permissions and some editing for the sake of system security. In Unix it is possible to give programs permissions that differ from those of the user who started the program. The program gets a fixed user identification number (UID), therefore this process is called 'setuid'. It is usually done to give programs 'root' permissions. Needless to say that such programs are a security-threat, so it is advisable to restrict access to this program to a specified group of users. That's what you are to do now. You need to be 'root'.chmod 4750 /usr/sbin/pppd && chown root:pppusers /usr/sbin/pppd
ls -l /usr/sbin/pppd
-rwsr-x––- 1 root pppusers
Compile a list of all users that should be able to connect to the Internet. Edit '/etc/group' and add them to the 'pppusers' group by adding their names to the appropriate entry.
As long as you've not logged out and back in, the system doesn't know about the change in '/etc/group'. Therefore, type
newgrp pppusers
Now run:
/usr/sbin/pppd call {name}
killall pppd
Running Programs After Connect/Disconnect
Create scripts called 'ip-up.local' and 'ip-down.local' in '/etc/ppp' and put the commands you want to have executed in there. Keep in mind that every program you start from there runs with 'root'-privileges. Some suggestions:- Automatically send and receive mail and news every time you connect.
- Run mirroring tools (e.g. 'rsync') to keep your website in sync with local files.
- Resume down- or uploads.
#1.1 / bin/sh
chmod +x
Making pppd Connect Automatically
Wouldn't it be nice if you wouldn't have to dial each time you want to connect?It's quite easy to configure this. Your '/etc/ppp/options' file should look like this:
lock<br> defaultroute<br> demand<br> nopersist<br> 192.168.0.3:192.168.0.4<br> ipcp-accept-remote<br> ipcp-accept-local<br> holdoff 5<br> idle 30
The clever thing is to reset these bogus addresses with the next two lines, so that your machine will accept the local and remote IPs assigned by your ISP upon connection.
holdoff 5
idle 30
You can now run the pppd command from '/etc/rc.d/rc.local' on boot. Now every time you request an outbound connection by clicking a link or query for mail, pppd will automatically connect to your ISP. Notes:
- Please test this first1.1 Have a look at your modem and see if it connects to your ISP without you demanding it. System services like Samba or Sendmail may try to do DNS queries and so activate the link. Consult the documentation of the offending program for ways to turn off these queries.
- There is also a distinct program for this functionality available, called diald. Its configuration is somewhat more involved and prone to errors. Use it for advanced tasks like masquerading a larger network.
- The 'nopersist' option seems to be a good means to prevent pppd from dialing at random. (Thanks to Mandrake Linux user Michael Siepmann for this hint)
Related Resources:
man pppd
man chat
man pppstats
Author: Tom Berger Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Dial-up Networking (PPP) II
Version 1.3 last modified by AdminWiki on 22/03/2004 at 09:44
Version 1.3 last modified by AdminWiki on 22/03/2004 at 09:44
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!
Mandriva.com
Store
Club

