Newsgroup: it.comp.os.linux.iniziare
Titolo: script ppp

cia
mi sono scaricato uno script che configura la mia connessione a internet
tramite ppp ed ho un problema nell'inserire il secondary dns..mi richiede solo
il primo.
Modificando lo script sono riuscito ad inserire il secondo dns ma alla
connessione in /etc/resolv.conf mi mette soltanto il primo!
Con kppp li ho entrambi
Come posso risolvere il problema?
Vi allego il file così potete darci un'occhiata e magari può anche essere utile
a qualcuno!
Grazie#!/bin/sh
# PPP Configurator
# by tsk
# $Id: ppp-conf, v 1.0 1999/10/18 22:28:14 tsk Exp $
# Credits
BINSH="#!/bin/sh"
INTESTAZIONE="# This file was generated by PPP Configurator by tsk"
WEBSITE="# Get it at 
http://tsk.tsx.org
"
EMAIL="# Comments or other at 
t...@libero.it
"
# This for writing files..
PPPD="/usr/sbin/pppd connect 'chat -v \"\" ATZ OK"
LINE2="/dev/modem -detach defaultroute modem noipdefault name"
CHAPPATH="/etc/ppp/chap-secrets"
PAPPATH="/etc/ppp/pap-secrets"
RESOLVPATH="/etc/resolv.conf"
SECRETSPAP="# Secrets for authentication using PAP"
SECRETSCHAP="# Secrets for authentication using CHAP"
SLINE2="# client       server   secret        IP addresses"
KLINES="killall pppd"
# Colour codes for Linux Console
RED="\033[31m"          # red
GREEN="\033[32m"        # green
YELLOW="\033[33m"       # green
BLUE="\033[34m"         # blue
MAGENTA="\033[35m"      # magenta
CYAN="\033[36m"         # cyan
WHITE="\033[37m"        #  white
BRIGHT="\033[01m"       # bright
NORMAL="\033[0m"        # normal
BLINK="\033[05m"        # blink
REVERSE="\033[07m"      # reverse
U="/usr/bin"
NONAME="conf"
MYNAME="ppp-conf"
EGNAME="ispname"
EGNUMERO="0123456789"
EGMODEM="/dev/ttyS1"
EGDNS="127.0.0.1"
EGDOMINIO="localhost.localdomain"
EGUSER="myusername"
EGPASSWD="mypasswd"
WHOAMI=`id -un`
clear
echo -e "$BRIGHT"; echo
echo -e "\t\t\tWelcome to tsk's PPP Configurator 1.0"
echo -e "\t\t\t****** 
http://tsk.mainpage.net
 ******"
echo -e "\t\t\t*********** 
t...@libero.it
 ***********"
echo -e "\n"
echo -e "\t\t\$Id: ppp-conf, v 1.0 1999/10/18 22:28:14 tsk Exp \$"
echo -e "$BRIGHT$YELLOW"; echo
RISPOSTA="Y"
echo -e "Checking for /usr/bin/ppp-conf..."
if [ -L /usr/bin/ppp-conf ]
  then
       echo -e "${GREEN}OK"
  else
       echo -e "${RED}Failed"
echo -e "${NORMAL}${BRIGHT}Making symbolic link $U/$MYNAME -> $PWD/$MYNAME"
  ln -sf ${PWD}/ppp-conf /usr/bin/
fi
while [ "$RISPOSTA" = Y -o "$RISPOSTA" = y ]
do
echo -e "${BRIGHT}${YELLOW}Checking for /usr/sbin/pppd..."
if [ -e /usr/sbin/pppd ]
   then
      echo -e "${GREEN}OK"
   else
      echo -e "${RED}Failed."
      echo -e "${NORMAL}${BRIGHT}/usr/sbin/pppd: no such file or directory."
      echo -e "pppd is required for connect to the Internet."
      echo -e "exit now."
      echo -e "$NORMAL"; echo
      exit
fi
echo -e "${BRIGHT}${YELLOW}Checking for /usr/sbin/chat..."
if [ -e /usr/sbin/chat ]
   then
      echo -e "${GREEN}OK"
   else
      echo -e "${RED}Failed."
      echo -e "${NORMAL}${BRIGHT}/usr/sbin/chat: no such file or directory."
      echo -e "chat is required for connect to the Internet."
      echo -e "exit now."
      echo -e "$NORMAL"; echo
      exit
fi
echo -e "${BRIGHT}${YELLOW}Checking for /etc/ppp/options..."
if [ -e /etc/ppp/options ]
   then
        echo -e "${GREEN}OK"
 else
        echo -e "${RED}Failed"
        echo -e "${NORMAL}${BRIGHT}Writing /etc/ppp/options..."
        echo -e "${GREEN}Done"
        echo "lock" > /etc/ppp/options
fi
echo -e "${BRIGHT}${YELLOW}Checking for /usr/bin/ppp-stop..."
if [ -e /usr/bin/ppp-stop ]
   then
        echo -e "${GREEN}OK"
   else
        echo -e "${RED}Failed"
        echo -e "${NORMAL}${BRIGHT}Writing /usr/bin/ppp-stop..."
        echo -e "${GREEN}Done"
        echo "$BINSH" > /usr/bin/ppp-stop
        echo "$KLINES" >> /usr/bin/ppp-stop
        chmod 700 /usr/bin/ppp-stop
fi
echo -e "${BRIGHT}${YELLOW}Checking for user...[$BLUE$WHOAMI$BRIGHT$YELLOW]"
if [ "$WHOAMI" = "root" ]
  then
      echo -e "${GREEN}That's OK"
  else
      echo -e "${RED}Failed"
      echo -e "$NORMAL${BRIGHT}Error. You must run this as root."
      echo -e "$NORMAL${BRIGHT}Exit now."
      echo -e "$NORMAL"; echo
      exit
fi    
echo -e "$NORMAL$CYAN"; echo
echo -e "Insert Connection Name:[${NOME:-$EGNAME}]"
read NOME
if [ "$NOME" = "$NONAME" ]
  then
      echo -e "$NORMAL"; echo
      echo -e "${BRIGHT}Invalid name. Please don't use conf as connection name"
      echo -e "$NORMAL"; echo      
 
      exit
fi
if [ "$NOME" = "stop" ]
  then 
 
      echo -e "$NORMAL"; echo
      echo -e "${BRIGHT}Invalid name. Please don't use stop as connection name"
      echo -e "$NORMAL"; echo
      exit
fi
if [ "$NOME" = "" ]
  then
      NOME="$EGNAME"
fi
PPPPATH="/etc/ppp/ppp-$NOME"
CHAPPATHN="/etc/ppp/chap-secrets.$NOME"
PAPPATHN="/etc/ppp/pap-secrets.$NOME"
RESOLVPATHN="/etc/ppp/resolv.conf.$NOME"
echo -e "\nInsert Phone Number:[${NUMERO:-$EGNUMERO}]"
read NUMERO
if [ "$NUMERO" = "" ]
  then
      NUMERO="$EGNUMERO"
fi
echo -e "\nInsert Modem Device:[${MODEMDEV:-$EGMODEM}]"
read MODEMDEV
if [ "$MODEMDEV" = "" ]
  then
      MODEMDEV="$EGMODEM"
fi
echo -e "\nInsert Primary DNS:[${DNSPRIMO:-$EGDNS}]"
read DNSPRIMO
if [ "$DNSPRIMO" = "" ]
  then
      DNSPRIMO="$EGDNS"
fi
echo -e "\nInsert Secondary DNS:[${DNSSECONDO:-$EGDNS}]"
read DNSSECONDO
if [ "$DNSSECONDO" = "" ]
  then
      DNSSECONDO="$EGDNS"
fi
echo -e "\nInsert Domain:[${DOMINIO:-$EGDOMINIO}]"
read DOMINIO
if [ "$DOMINIO" = "" ]
  then
      DOMINIO="$EGDOMINIO"
fi
echo -e "\nInsert Username:[${USERN:-$EGUSER}]"
read USERN
if [ "$USERN" = "" ]
  then
      USERN="$EGUSER"
fi
echo -e "\nInsert Password:[${PASSWD:-$EGPASSWD}]"
read PASSWD
if [ "$PASSWD" = "" ]
  then
      PASSWD="$EGPASSWD"
fi
P="${NORMAL}${BLUE}"
T="${NORMAL}${BRIGHT}${CYAN}"
NT="${NORMAL}${CYAN}"
I="${P}[${T}"
F="${P}] ${NT}"
R="${P}-- ${NT}"
Y="${NORMAL}${BRIGHT}${YELLOW}"
echo -e ""
echo -e "${P}--${T}==${Y}${NOME}${T}==${P}--"
echo -e "${R}Modem device ${I}${MODEMDEV} $F  Phone number ${I}${NUMERO} $F"
echo -e "${R}Primary DNS  ${I}${DNSPRIMO} $F  Domain  ${I}${DOMINIO} $F"
echo -e "${R}Username  ${I}${USERN} $F  Password  ${I}${PASSWD} $F"
echo -e "${P}---------------------------------------------------------"
EGNAME="$NOME"
EGNUMERO="$NUMERO"
EGMODEM="$MODEMDEV"
EGDNS="$DNSPRIMO"
EGDOMINIO="$DOMINIO"
EGUSER="$USERN"
EGPASSWD="$PASSWD"
echo -e "$BRIGHT$CYAN"; echo
echo -e "Do you want to modify any? [Y/n]"
read RISPOSTA
if [ "$RISPOSTA" = "" ]
  then
      RISPOSTA="Y"
fi
done
echo -e "\nMaking symbolic link /dev/modem -> $MODEMDEV"
ln -sf $MODEMDEV /dev/modem
echo -e "\nNow writing $PPPPATH"
echo "$BINSH" > $PPPPATH
echo "$INTESTAZIONE" >> $PPPPATH
echo "$WEBSITE" >> $PPPPATH
echo "$EMAIL" >> $PPPPATH
echo "cp $CHAPPATHN $CHAPPATH" >> $PPPPATH
echo "cp $PAPPATHN $PAPPATH" >> $PPPPATH
echo "cp $RESOLVPATHN $RESOLVPATH" >> $PPPPATH
echo "echo -e \"$BRIGHT\"; echo" >> $PPPPATH
echo "echo \"This file was generated with tsk's PPP Configurator\"" >> $PPPPATH
echo "echo \"Get it at 
http://tsk.mainpage.net
\"" >> $PPPPATH
echo "echo \"Please stand by while connecting...\"" >> $PPPPATH
echo "echo -e \"\\n${R}Connecting at $I$Y$NOME ${F}...\"" >> $PPPPATH
echo "echo -e \"${R}Dialing $I$NUMERO $F Using device: $I$MODEMDEV $F\"" >> $PPPPATH
echo "echo -e \"${R}Username: $I$USERN $F \t Password: $I* $F\"" >> $PPPPATH
echo "echo -e \"${R}Domain Name Server: $I$DNSPRIMO $F\"" >> $PPPPATH
echo "echo -e \"$NORMAL\"; echo" >> $PPPPATH
echo "$PPPD ATDT$NUMERO CONNECT\"\"' \\" >> $PPPPATH
echo "$LINE2 $USERN &" >> $PPPPATH
echo "echo -e \"$BRIGHT\"; echo" >> $PPPPATH
echo "echo \"For close this connection type ppp-stop\"" >> $PPPPATH
echo "echo -e \"$NORMAL\"; echo" >> $PPPPATH
echo -e "\aDone."
echo -e "\nNow writing ${RESOLVPATHN}..."
echo "domain $DOMINIO" > $RESOLVPATHN
echo "nameserver $DNSPRIMO" >> $RESOLVPATHN
echo -e "\aDone."
echo -e "\nNow writing password files..."
echo "$SECRETSCHAP" > $CHAPPATHN
echo "$SLINE2" >> $CHAPPATHN
echo "  $USERN       *       $PASSWD" >> $CHAPPATHN
echo "$SECRETSPAP" > $PAPPATHN
echo "$SLINE2" >> $PAPPATHN
echo "  $USERN       *       $PASSWD" >> $PAPPATHN
chmod 600 $CHAPPATHN
chmod 600 $PAPPATHN
chmod 700 $PPPPATH
ln -sf /etc/ppp/ppp-$NOME /usr/bin/
echo -e "\n\nWe have finished."
echo -e "\nFor run this script type ppp-$NOME"
echo -e "$BLINK"; echo
echo -e "Bye!"
echo -e "$NORMAL"; echo

mi sono scaricato uno script che configura la mia connessione a internet
tramite ppp ed ho un problema nell'inserire il secondary dns..mi richiede
solo
il primo.
Modificando lo script sono riuscito ad inserire il secondo dns ma alla
connessione in /etc/resolv.conf mi mette soltanto il primo!
Con kppp li ho entrambi
Come posso risolvere il problema?
Io avevo editato i dns in etc/resolv.conf (nel ppp di gnome della redhat non
ne metteva neanche uno)
ciao
Marina (sě, sono proprio io, pc...)

 
