Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Nov 2000 06:46:55 +1000
From:      "Doug Young" <dougy@gargoyle.apana.org.au>
To:        "Haikal Saadh" <wyldephyre2@yahoo.com>, <newbies@FreeBSD.ORG>
Subject:   Re: Here's an idea...
Message-ID:  <00fd01c051a0$b5808590$837e03cb@dougy>
References:  <20001118013730.26761.qmail@web1605.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
If you want a 30 second fix that AFAIK works for all ISP's,
try the attached "ppp_script.sh". I can't speak for others but
I can't imagine why anyone (apart from one of those linux 
types anyway) would want a complicated solution when theres
something this simple available. 


----- Original Message ----- 
From: "Haikal Saadh" <wyldephyre2@yahoo.com>
To: <newbies@FreeBSD.ORG>
Sent: Saturday, November 18, 2000 11:37 AM
Subject: Here's an idea...


> I've been tearing my hair out recently, trying to get
> a FreeBSD box connected to the internet, and the
> hardest part of it was, getting my ppp.conf right.
> 
> So here's an idea: Hows about someone have a site
> somewhere we can submit our ppp.conf files, so that
> other people can look up which config works for which ISP?
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Calendar - Get organized for the holidays!
> http://calendar.yahoo.com/
> 
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-newbies" in the body of the message
> 
> 

[-- Attachment #2 --]
#!/bin/sh
# -*- sh -*-

PATH=/usr/bin:/bin; export PATH

#  ppp-setup  -- a script to automatically setup user ppp.
#  Most of the text in this script was derived from the FreeBSD Handbook.
#  Many thanks to Brian Somers for his input

clear

#  Check to see if we are root
ME=`whoami`
if [ ! "$ME" = "root" ]; then
	echo "Sorry, you must be root to run ppp-setup."
	exit 1
fi

cat << EOS
  |----------------------------Unleash the Daemon---------------------------|
  |     -------------------------------------------------------------       |
  |       PPP SETUP   06.23.98  *** The Easy Way to set up User PPP         |
  |     -------------------------------------------------------------       |
  |                                                                         |
  |                         hacked by Mike Jackson                          |
  |                                                                         |
  |                              muck@ida.net                               |
  |                                                                         |
  |                      Tue Jun 23 13:43:23 MDT 1998                       |
  |                                                                         |
  |                    --------------------------------                     |
  |                                                                         |
  |                ****  ***   ****  ****  ***    ***  ***                  |
  |                *     *  *  *     *     *  *  *     *  *                 |
  |                ****  ***   ****  ****  ****   **   *  *                 |
  |                *     * *   *     *     *  *     *  *  *                 |
  |                *     *  *  ****  ****  ***   ***   ***                  |
  |                                                                         |
  |                                                                         |
  |                                                                         |
  |                       [ Press Enter to continue ]                       |
  |_________________________________________________________________________|
EOS

read tmp

clear

cat << EOS
  |----------------------------Unleash the Daemon---------------------------|
  |                                                                         |
  |    This script automagically sets up user ppp for your particular       |
  |    system's setup according to questions that you answer.  It will      |
  |    then write the appropriate files in /etc/ppp/ for you so that        |
  |    you can easily be on your way to dial up network connectivity.       |
  |                                                                         |
  |                                                                         |
  |                                                                         |
  |                                                                         |
  |                 The following files will be modified:                   | 
  |                                                                         |
  |    /etc/ppp/ppp.conf    Information about your ISP, modem, etc.         |
  |    /etc/ppp/ppp.linkup  Used after a connection is established.         |
  |    /etc/ppp/ppp.secret* Allows you to change ppp on the fly.            |
  |    /etc/hosts           Contains the IP addresses of your machines.     |
  |    /etc/host.conf       Instructions for the resolver.                  |
  |    /etc/resolv.conf     Tells the resolver how to behave.               |
  |                                                                         |
  |                         *Will not be written.                           |
  |                                                                         |
  |                       [ Press Enter to continue ]                       |
  |_________________________________________________________________________|
EOS

read tmp

clear

cat << EOS
  |----------------------------Unleash the Daemon---------------------------|
  |                                                                         |
  |    Before you start, it is assumed you are roughly in this position:    |
  |                                                                         |
  |  * You have an account with an ISP ,and your modem already configured.  |
  |                                                                         |
  |  * You know your ISP's phone number(s).                                 |
  |                                                                         |
  |  * You know your login name and password.                               |
  |                                                                         |
  |  * You know the IP address of your ISP's gateway.  If you don't know    |
  |    it, don't worry.  We can make one up.                                |
  |                                                                         |
  |  * Your ISP's netmask setting.  Again, if you don't know it, we can     |
  |    safely use a netmask of 255.255.255.0.                               |
  |                                                                         |
  |  * The IP address of one or more nameservers.  You MUST have this!      |
  |                                                                         |
  |  * If your ISP has given you a static IP address, you will need to      |
  |    have it handy.  If not, we can configure PPP to accept any IP        |
  |    number.                                                              |
  |                       [ Press Enter to continue ]                       |
  |_________________________________________________________________________|
EOS

read tmp

clear

echo "  |-----------------------------Value Required------------------------------|" 
echo "  |                                                                         |"
echo "  |                          Enter your ISP's name.                         |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "? $c"; read ISP_NAME

clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |                      Enter your ISP's Phone Number.                     |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "? $c"; read ISP_PHONE

clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |                         Enter your login name.                          |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "? $c"; read ISP_UNAME


clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |                          Enter your password.                           |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "? $c"; read ISP_PASSWD

clear

echo "  |-----------------------------PPP Configuration---------------------------|"
echo "  |                                                                         |"
echo "  |    Has your Internet Service Provider assigned you a gateway?  If       |"
echo "  |    you don't know your gateway, don't worry.  We can make one up        |"
echo "  |    and your ISP's server will tell us when we connect.                  |"
echo "  |                                                                         |"
echo "  |                           Do you have a gateway?                        |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "y/n? $c"; read YES_NO

clear

if [ $YES_NO = "y" ];
   then 
 	echo "  |-------------------------------Value Required----------------------------|"
	echo "  |                                                                         |"
	echo "  |                             Enter your gateway.                         |"
	echo "  |                                                                         |"
	echo "  |_________________________________________________________________________|"

	echo ""; echo $n "? $c"; read ISP_GATEWAY
    else
        ISP_GATEWAY='10.0.0.2/0'
fi

clear

echo "  |-----------------------------PPP Configuration---------------------------|"
echo "  |                                                                         |"
echo "  |    Has your Internet Service Provider assigned you a netmask setting?   |"
echo "  |    If not, don't worry.  We can safely use 255.255.255.0                |"
echo "  |                                                                         |"
echo "  |                       Do you have a netmask setting?                    |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "y/n? $c"; read YES_NO

clear

if [ $YES_NO = "y" ];
   then
	echo "  |-------------------------------Value Required----------------------------|"
	echo "  |                                                                         |"
	echo "  |                         Enter your netmask setting.                     |"
	echo "  |                                                                         |"
	echo "  |_________________________________________________________________________|"

	echo ""; echo $n "? $c"; read ISP_NETMASK
    else
        ISP_NETMASK='255.255.255.0'
fi

clear

echo "  |-----------------------------PPP Configuration---------------------------|"
echo "  |                                                                         |"
echo "  |    Does your ISP give you a static IP address?  If not, don't           |"
echo "  |    worry.  We'll configure PPP to accept any IP number.                 |"
echo "  |                                                                         |"
echo "  |                      Do you have a static IP address?                   |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "y/n? $c"; read STATIC_IP_YES_NO

clear

if [ $STATIC_IP_YES_NO = "y" ];
   then
   	echo "  |--------------------------------Value Required---------------------------|"
	echo "  |                                                                         |"
	echo "  |                     Please enter your static IP address.                |"
	echo "  |                                                                         |"
	echo "  |_________________________________________________________________________|"

	echo ""; echo $n "? $c"; read STATIC_IP
    else  
        STATIC_IP='10.0.0.1/0'
fi

clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |                   Please Enter your ISP's nameservers.                  |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "First Nameserver:  $c"; read ISP_DNS_ONE
echo ""; echo $n "Second Nameserver:  $c"; read ISP_DNS_TWO

clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |                       What port is your modem on?                       |"
echo "  |                                                                         |"
echo "  |    [1] cuaa0  (COM 1)                            [3] cuaa2  (COM 3)     |"
echo "  |    [2] cuaa1  (COM 2)                            [4] cuaa3  (COM 4)     |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "? $c"; read PORT_NUM

if [ $PORT_NUM = "1" ];
   then 
      PORT_NUM='cuaa0'
   elif [ $PORT_NUM = "2" ];
      then 
         PORT_NUM='cuaa1'
      elif [ $PORT_NUM = "3" ];
         then 
            PORT_NUM='cuaa2'
         else 
            PORT_NUM='cuaa3'
fi

clear

echo "  |-----------------------------Value Required------------------------------|"
echo "  |                                                                         |"
echo "  |    Some ISP's set their system up so that the authentication part       |"
echo "  |    of your connection is done using either PAP or CHAP.  If this is     |"
echo "  |    the case, your ISP will not give a login: prompt when you connect,   |"
echo "  |    but will start talking PPP immediately.                              |"
echo "  |                                                                         |"
echo "  |         If you're not sure if your ISP uses PAP/CHAP, select no         |"
echo "  |         here.  You can always go back and edit /etc/ppp/ppp.conf        |"
echo "  |         with the command, run as root, \"ee /etc/ppp/ppp.conf\".          |"
echo "  |                                                                         |"
echo "  |         Consult the FreeBSD Handbook (www.freebsd.org/handbook)         |"
echo "  |         for further details.                                            |"
echo "  |                                                                         |"
echo "  |                    Would you like to use PAP/CHAP?                      |"
echo "  |                                                                         |"
echo "  |_________________________________________________________________________|"

echo ""; echo $n "y/n? $c"; read PAP_CHAP_YES_NO

if [ $PAP_CHAP_YES_NO != "y" ];
   then
      clear 

      echo "  |-----------------------------Value Required------------------------------|"
      echo "  |                                                                         |"
      echo "  |    Some ISP's will prompt you for a protocol.  If this is the case,     |"
      echo "  |    then a \"col: ppp\" will be appended to your login string in           |"
      echo "  |    /etc/ppp/ppp.conf.                                                   |"
      echo "  |                                                                         |"
      echo "  |        If you're not sure if your ISP will prompt you for a ppp         |"
      echo "  |        protocol, please select no here.                                 |"
      echo "  |                                                                         |"
      echo "  |        Consult the FreeBSD Handbook (www.freebsd.org/handbook)          |"
      echo "  |        for further details.                                             |"
      echo "  |                                                                         |"
      echo "  |                 Does your ISP prompt you for a protocol?                |"
      echo "  |                                                                         |"
      echo "  |_________________________________________________________________________|"

      echo ""; echo $n "y/n? $c"; read PPP_PROMPT_YES_NO
fi
  
clear

cat << EOS
  |--------------------------The Daemon's Unleashed-------------------------|
  |                                                                         |
  |    Ok, now I'm going to write the following PPP related files:          |
  |                                                                         |
  |    /etc/ppp/ppp.conf      This will contain your modem's port number,   |
  |                           the speed at which we'll talk to your modem,  |
  |                           the dial string, the login string, your ISP's |
  |                           phone number, your username and password,     |
  |                           and your static IP address if you have one.   |
  |                                                                         |
  |    /etc/ppp/ppp.linkup    This will contain the lines delete ALL, and   |
  |                           add 0 0 HISADDR.  This will delete all of     |
  |                           the existing routing tables for the tun       |
  |                           device, and add a default route to your ISP's |
  |                           gateway.                                      |
  |                                                                         |
  |    /etc/ppp/ppp.secret*   This will not be written, but it allows you   |
  |                           to change PPP on the fly.                     |
  |                                                                         |
  |                [ Press ctrl-c to cancel writing of files ]              |
  |                                                                         |
  |                        [ Press Enter to continue ]                      |
  |_________________________________________________________________________|
EOS

read tmp

#  move the old files if they exist

if [ ! -f /etc/ppp/ppp.conf ]
   then 
        #doesn't exist, so do nothing
   else
        mv /etc/ppp/ppp.conf /etc/ppp/ppp.conf.old
fi


if [ ! -f /etc/ppp/ppp.linkup ]
   then 
        #doesn't exist, so do nothing
   else
        mv /etc/ppp/ppp.linkup /etc/ppp/ppp.linkup.old
fi


if [ ! -f /etc/ppp/ppp.secret ] 
   then 
        #doesn't exist, so do nothing
   else
        mv /etc/ppp/ppp.secret /etc/ppp/ppp.secret.old
fi


if [ ! -f /etc/hosts ]
   then
        #doesn't exist, so do nothing
   else
        mv /etc/hosts /etc/hosts.old
fi


if [ ! -f /etc/host.conf ]
   then
        #doesn't exist, so do nothing
   else
        mv /etc/host.conf /etc/host.conf.old
fi


if [ ! -f /etc/resolv.conf ] 
   then 
        #doesn't exist, so do nothing
   else
        mv /etc/resolv.conf /etc/resolv.conf.old
fi


#  ppp.conf will now be written 
echo "default:" >> /etc/ppp/ppp.conf
echo "  set log Phase Chat Connect Carrier lcp ipcp ccp command" >> /etc/ppp/ppp.conf
echo "  set device /dev/$PORT_NUM" >> /etc/ppp/ppp.conf
echo "  set speed 115200" >> /etc/ppp/ppp.conf
echo "  set dial \"ABORT BUSY ABORT NO\\\\sCARRIER TIMEOUT 5 \\\"\\\" ATE1Q0 OK-AT-OK \\\\dATDT\\\\T TIMEOUT 40 CONNECT\"" >> /etc/ppp/ppp.conf
echo "$ISP_NAME:" >> /etc/ppp/ppp.conf
echo "  set phone \"$ISP_PHONE\"        #Separate multiple phone numbers with a |" >> /etc/ppp/ppp.conf


#  does the user want to use PAP/CHAP?
if [ $PAP_CHAP_YES_NO = "y" ];
   then 
        echo "  set login" >> /etc/ppp/ppp.conf
   elif [ $PPP_PROMPT_YES_NO = "y" ];
      then
         echo "  set login \"TIMEOUT 10 gin:-BREAK-gin: $ISP_UNAME word: $ISP_PASSWD col: ppp\"" >> /etc/ppp/ppp.conf 
      else 
         echo "  set login \"TIMEOUT 10 gin:-BREAK-gin: $ISP_UNAME word: $ISP_PASSWD\"" >> /etc/ppp/ppp.conf
fi

echo "  set timeout 300            #Change to 0 if no timeout desired" >> /etc/ppp/ppp.conf
echo "  deny lqr" >> /etc/ppp/ppp.conf


#  does the user have a static IP address?
if [ $STATIC_IP_YES_NO = "y" ]; 
   then 
        echo "  set ifaddr $STATIC_IP $ISP_GATEWAY $ISP_NETMASK" >> /etc/ppp/ppp.conf
   else
        echo "  set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0" >> /etc/ppp/ppp.conf
fi

#  does the user want to use PAP/CHAP?
if [ $PAP_CHAP_YES_NO = "y" ];
   then 
        echo "  set authname $ISP_UNAME" >> /etc/ppp/ppp.conf
        echo "  set authname $ISP_PASSWD" >> /etc/ppp/ppp.conf
fi

#  ppp.linkup will now be written
echo "MYADDR:" >> /etc/ppp/ppp.linkup
echo "  delete ALL" >> /etc/ppp/ppp.linkup
echo "  add 0 0 HISADDR" >> /etc/ppp/ppp.linkup

clear 

cat << EOS
  |--------------------------The Daemon's Unleashed-------------------------|
  |                                                                         |
  |    I'll also write these files:                                         |
  |                                                                         |
  |    /etc/hosts              This will contain the IP addresses and       |
  |                            names of machines on your network.           |
  |                                                                         |
  |    /etc/host.conf          This will instruct the resolver to look      |
  |                            first in the hosts file, and then consult    |
  |                            the DNS if the name was not found.           |
  |                                                                         |
  |    /etc/resolv.conf        This tells the resolver how to behave.       |
  |                                                                         |
  |---------------[ Press ctrl-c to cancel writing of files ]---------------|
  |                                                                         |
  |    If you have any problems getting PPP set up, you may have to look    |
  |    at the FreeBSD Handbook at www.freebsd.org/handbook.  Or, you may    |
  |    want to see the FreeBSD FAQ at www.freebsd.org/FAQ.                  |
  |                                                                         |
  |                Please send any comments to:  muck@ida.net.              |
  |                                                                         |
  |                       [ Press Enter to continue ]                       |
  |_________________________________________________________________________|
EOS

read tmp

#  hosts will now be written
MYSYSTEM=`hostname -s`
MYDOMAIN_NAME=`hostname`
echo "127.0.0.1     localhost" >>/etc/hosts
echo "10.0.0.1      $MYDOMAIN_NAME		$MYSYSTEM"  >> /etc/hosts

#  host.conf will now be written
echo "hosts" >> /etc/host.conf
echo "bind" >> /etc/host.conf

#  resolv.conf will now be written
MYDOMAIN=`hostname`
echo "nameserver $ISP_DNS_ONE" >> /etc/resolv.conf
echo "nameserver $ISP_DNS_TWO" >> /etc/resolv.conf
echo "domain ${MYDOMAIN#*.}" >> /etc/resolv.conf

clear
 
cat << EOS 
                             The Daemon's Unleashed

                        FreeBSD System Manager's Manual

       NAME
            ppp - Point to Point Protocol
       SYNOPSIS
            ppp $ISP_NAME   - Will load the information for your ISP.

            ppp ON $MYSYSTEM> dial    - Will dial and login to your ISP.


            If for some reason dialing fails, you can do it manually:

            ppp ON $MYSYSTEM> term    - Gets you into terminal mode.
            Enter to terminal mode.
            Type '~?' for help.
            ATDT$ISP_PHONE            - Dials your ISP's number.
            Connect 38400          - Connection established.
            Login:
            Password:
            PPP ON $MYSYSTEM> Packet mode.

                            [ Press Enter to exit ]

EOS


read tmp

clear

exit 0


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00fd01c051a0$b5808590$837e03cb>