[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: PPP to multiple Internet Provider



Some days ago I posted a mail to debian-user mailing list asking for the
following:

> I successfuly installed Debian 1.3.1.r6 and ran pop, poff to connect to my
> provider. I would like to use a command that let me choose between several
> providers, something like "pon atslink" or "pon dadanet".
> I would like also:
>
> - Users in a selected group (e.g. dip) can do po and poff without being
>   superuser.
> - An appropriate "nameserver xxx.xxx.xxx.xxx" line should be put in top of
>   /etc/resolv.conf, so the nameserver of the selected provider is used
>   first (again users should do that not being root).

I received some reply, among them Marcelo E. Magallon
<mmagallo@efis.ucr.ac.cr> wrote:

> The ppp on hamm does this. You can say "pon provider". The newest
> proposal to ppp on hamm, will (I think) address the second
> situation. 

I checked the new ppp_2.3.3-5.deb hamm package, currently it fixes only
the
first problem, so I opted for this solution which is highly compatible
with
the future release of the ppp package:


Mantained the ppp_2.2.0f-23.deb package included in bo 1.3.1.r6.

Removed the /etc/ppp.options_out file and replaced it with a file called
/etc/ppp/peers/provider. This one contains the ppp options for the
default
provider, if you have other providers place additional files with other
names, like /etc/ppp/peers/flashnet (this is also done in the new ppp
package).

Removed the /etc/ppp.chatscript file and replaced it with a file called
/etc/ppp/chatscripts/provider. Others chat scripts can be added in the
same
directory (this is also done in the new ppp package, with the difference
that chatscripts are in /etc/chatscripts).

Changed the /usr/bin/pon script with the following:

   #!/bin/sh
   /usr/sbin/pppd file /etc/ppp/peers/${1:-provider}

It is very similar at the pon in the new ppp package, except it uses the
"file" option of ppd instead of the new "call" option. If pon is called
without parameter it uses the default file /etc/ppp/peers/provider, if
instead is called - say - as "pon flashnet", it uses
/etc/ppp/peers/flashnet.

The /etc/ppp/peers/provider files are like this:

   connect "/usr/sbin/chat -v -f /etc/ppp/chatscripts/provider"
   ipparam /etc/ppp/peers/provider.dns
   defaultroute
   /dev/modem
   57600
   persist
   noipdefault

The connect option points to the proper chatscript. The ipparam instead
is
used to pass a parameter to the /etc/ppp/ip-up script, which is called
just
after the ppp interface is up. This extra parameter is a file name
containing the nameservers directives that must added to
/etc/resolv.conf.
So with those lines in /etc/ppp/ip-up I resolved the nameserver problem
too:

   # Write ISP's and default nameservers in /etc/resolv.conf. No more
   # than 3 nameserver directives are allowed.
   # Filename containing ISP's nameservers is passed as 6th argument
   # by pppd (see ipparam option).
   if [ -r "$6" ]; then
      TFILE=/tmp/ip-up-$$-resolv.conf
      grep -v "^nameserver" /etc/resolv.conf > $TFILE
      cat $6 /etc/ppp/peers/_default.dns | grep "^nameserver" | head -3
>> \
         $TFILE
      cat $TFILE > /etc/resolv.conf
      rm $TFILE
   fi

I just added the required /etc/ppp/peers/provider.dns files and an
/etc/ppp/peers/_default.dns file which contain lines like:

   nameserver 151.99.155.3
   nameserver 151.99.125.2

For the security I put all the users that can dial-uot in the dip group,
files in /etc/ppp/peers and /etc/ppp/chatscripts are owned by root.dip
and
have mode 640, directory /etc/ppp is owned by root.dip, with mode 750.


It is a bit complicate, but it works and it is a step forward the new
ppp
package.


Niccolo

Firenze - Italy



--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: