Problem with setup script

When I was with my old ISP, I could access the Net in two ways: via Windows 95 and via my Linux system. Now that I have changed ISP, however, I can't connect using Linux. (I've also changed modems: formerly I had a 14.4; now I have a 56k one.) In my /usr/sbin directory there's a script called Ppp-on, which I've pasted below. What should I change in order to be able to connect to the Net with Linux? (I realise that at some stage I'll have to post one or two of the other scripts mentioned below, but I thought it best to keep things simple to start with.)

Thanks,

David
ventnor@town.nd.edu.au

NETMASK=255.255.255.0   # The proper netmask if needed
  #
  # Export them so that they will be available to 'ppp-on-dialer'
  export TELEPHONE ACCOUNT PASSWORD
  #
  # This is the location of the script which dials the phone and logs
  # in.  
  #
  DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
  #
  # Initiate the connection
  #
  #
  #/bin/setserial /dev/modem spd_vhi
exec /usr/sbin/pppd debug /dev/modem 38400 \
          connect $DIALER_SCRIPT
sevrinAsked:
Who is Participating?
 
bjacobsCommented:
Make sure you don't have a winmodem, it will not work with Linux.
Go to http://www.ibm.net/hlpctr/index.html, there are step by step instructions for connecting from Linux. Just substitute your ISP's info for the IBM info.
0
 
t2ppCommented:
sevrin, Check out the login script that you use with your new ISP under Windows 95 - *.scr will be its name. Then compare this with your login script that you are using with Linux. Unless you have already changed the Linux script, the old and new ISP logins are likely to be different. Make a new script for Linux based on the Windows 95 login script that you know works.
0
 
sevrinAuthor Commented:
Thanks for the suggestion, t2pp, but the *.scp script is obscure to me. (I've pasted it below.) And is it really possible to compare the two scripts? The first one is in a Bourne shell script, isn't it (?), whereas the second is in a language I'm completely unfamiliar with. But any suggestions you may care to make are welcome....

;
; This script is designed to connect to iiNet Technologies
; Perth rotaries. Modifications may be needed for local use.
;

;
; Main entry point to script
;
proc main

   ; Delay for 3 seconds first to allow host time
   ; to send initial characters.

   delay 3

   transmit "^M"

   ; Wait for the login prompt before entering
   ; the user ID

   delay 3

   waitfor "login:"
   transmit $USERID
   transmit "^M"

   ; Enter the password

   delay 3

   waitfor "word:"
   transmit $PASSWORD
   transmit "^M"

   ; iiNet puts up a "prompt~:>" so we wait for the >

   delay 3
   waitfor ">"
   transmit "ppp^M"       ; Choose PPP connection

   delay 3

   waitfor "ddr"

endproc




0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
t2ppCommented:
You will need to convert the Windows script to the Linux Chat script. The chat parms are in pairs - "if this" then "do this" arrangement. e.g. ABORT BUSY (abort on busy signal) and ername: $U (when ername: appears, reply with variable $U). Here's a sample...

/etc/ppp/ppp-connect follows...
N=12344321
O=p
U=userid
P=password
INIT=""            
#
/usr/sbin/chat -v ABORT BUSY ABORT 'NO CARRIER' TIMEOUT 40 "" AT$INIT OK ATDT$N CONNECT "" ername: $U word: \\q$P PPP 3
#
In you case, build the script in pairs. waitfor "login:"   transmit $USERID would look like
/usr/sbin/chat -v login: $USERID
Just ignore the delay commands. Good luck.



0
 
sevrinAuthor Commented:
Thanks again. I have just one question at this stage: I take it you're saying that I needn't worry about the /usr/sbin script I posted above (or the one that it exec's), but that I should go directly to the /etc/ppp one (which, presumably, is in turn executed by the sbin ones)? I do have such a script: /etc/ppp/ppp-on-d.

Thanks.
0
 
t2ppCommented:
PPP setup is marginally different depending on you Linux distribution. In essence, you need to modify/replace the script that is currently being invoked (and not working), with the modified script. If your current script that is being executed is in /etc/ppp/ppp-on-d, then make a backup and then modify.
0
 
sevrinAuthor Commented:
According to the /usr/sbin/Ppp-on script that I pasted above, the DIALER_SCRIPT /etc/ppp/ppp-on-dialer gets executed. I've pasted *this* script below. So the windows script has to be adapted to the format of this bourne shell program? (Incidentally, given the amount of input you're giving me, I'm upping the points to 150). If you notice anything I should be particularly careful about in the script below, I'd appreciate your telling me about it.

Thanks,

David

#!/bin/sh
###################################################################
#
# These parameters control the attack dialing sequence.
#
# Maximum number of attempts to reach the telephone number(s)
MAX_ATTEMPTS=100

# Delay between each of the attempts. This is a parameter to sleep
# so use "15s" for 15 seconds, "1m" for 1 minute, etc.
SLEEP_DELAY=1s

###################################################################
#
# This is a list of telephone numbers. Add new numbers if you wish
# and see the function 'callall' below for the dial process.
PHONE1=92780999
#PHONE2=411

###################################################################
#
# If you use the ppp-on script, then these are passed to this routine
# automatically. There is no need to define them here. If not, then
# you will need to set the values.
#
#ACCOUNT=my_account_name
#PASSWORD=my_password

###################################################################
#
# Function to initialize the modem and ensure that it is in command
# state. This may not be needed, but it doesn't hurt.
#
function initialize
{
    chat -v TIMEOUT 3 '' AT 'OK-+++\c-OK'
    return
}

###################################################################
#
# Script to dial a telephone
#
function callnumber
{
chat -v                                          \
        TIMEOUT         3                               \
          ABORT           '\nBUSY\r'                      \
          ABORT           '\nNO ANSWER\r'                 \
          ABORT           '\nRINGING\r\n\r\nRINGING\r'    \
          ''              \rAT                            \
          'OK-+++\c-OK'   ATH0                            \
          OK              ATM0                            \
          TIMEOUT         30                              \
          OK              ATDT$TELEPHONE                  \
          CONNECT         ''                              \
          ogin:--ogin:    $ACCOUNT                        \
          assword:--assword:  $PASSWORD                       \
          $           ppp

#
# If the connection was successful then end the whole script with a
# success.
#
    if [ "$?" = "0" ]; then
       exit 0
    fi

    return
}

###################################################################
#
# Script to dial any telephone number
#
function callall
{
#   echo "dialing attempt number: $1" >/dev/console
    callnumber $PHONE1
#    callnumber $PHONE2
}

###################################################################
#
# Initialize the modem to ensure that it is in the command state
#
initialize
if [ ! "$?" = "0" ]; then
   exit 1
fi

#
# Dial telephone numbers until one answers
#
attempt=0
while : ; do
    attempt=`expr $attempt + 1`
    callall $attempt
    if [ "$attempt" = "$MAX_ATTEMPTS" ]; then
      exit 1
    fi      
    sleep "$SLEEP_DELAY"
done


0
 
t2ppCommented:
You need to adapt the Windows script to the ppp-on-dialer script. You'll be making modifications to the chat script within ppp-on-dialer. Look for the comment "# Script to dial a telephone" and you will see the chat parameter pairs that I mentioned previously. Change these to suit the new ISP's script that you are currently using with Windows.
0
 
sevrinAuthor Commented:
Thanks again; your comments are really useful, and I think I'm getting a picture of what has to be done. Moving to specific questions, though:the first line of the Windows script says

delay 3

The chat script in ppp-on-dialer, however, says

TIMEOUT 3

I take it these amount to the same thing, and that no change is required? But the next line of the Windows script says

transmit "^M"

whereas the ppp-on-dialer script says

ABORT      '\nBUSY\r

I know ^M is the new line character, so do I just send that next? If so, what is the equivalent chat command? And there seems to be nothing in the Windows script corresponding to ABORT. So do I just get rid of the ABORT commands?

Thanks,

David
0
 
t2ppCommented:
Now, to specific questions... 1) Forget about the DELAY parameter in your Windows script. chat will wait in any case for the next parameter you specify. TIMEOUT specifies the amount of time chat waits for connection (carrier detect), so this should be say TIMEOUT 30 (30 seconds) to start with. 2) For newline (enter or ^M) just specify two double quotes like ==> "" <==.
You may also wish to man chat for the finer points :)
0
 
sevrinAuthor Commented:
For some reason my man pages do not include chat, even though I (obviously) have a chat binary. If you would be kind enough to mail me yours as an email attachment, I'll then put through your 150 points. My email address is ventnor@town.nd.edu.au

David
0
 
t2ppCommented:
You really ought to install the man page yourself. Check your install doco. If you can't do it, you can get man pages from www.linux.org.
0
 
sevrinAuthor Commented:
I now have the man pages for chat, and all the pieces are starting into fall into place. I do, however, have some further questions. 1) My old ppp-on-dialer script has an abort string of two RINGING's, rather than NO CARRIER. Which, in general, is preferable? 2) In the example you initially provided, you placed "" between TIMEOUT 40 and AT$INIT. What function does that provide? 3) In my original ppp-on-dialer script, between the abort strings and CONNECT there are a number of commands not covered by the man pages. (Eg, AT and ATH0) What do these mean, and why do they not have any (apparent) counterpart in the windows script? Can they just be ignored?

Thanks for your trouble.

David.
0
 
t2ppCommented:
Answers... 1) depends on the software used by your ISP as to how the replies are coded. In this case, 2 rings is considered excessive enough to abort the attempted connection. They are embedded with new-line "/n", and Carriage Returns "/r".  2)  The "" means press the ENTER key (carriage return).  3) The AT commands are modem commands. You'll find them in your modem's manual (what manual?). To begin with, use the default factory settings on your modem. The only AT command you need at the moment is ATDT immediately followed by your ISP's dialup phone number.
0
 
sevrinAuthor Commented:
With regard to 2), what I meant was: why is an ENTER required there, rather than somewhere else? Thanks for the info about the AT commands. Am I correct in concluding that the small script you posted a few days ago is virtually what I need? I'm referring to:

/usr/sbin/chat -v ABORT BUSY ABORT 'NO CARRIER' TIMEOUT 40 "" AT$INIT OK ATDT$N
      CONNECT "" ername: $U word: \\q$P PPP 3

From what you were saying, can I omit the AT$INIT? One final question: what does \\q$P PPP 3 mean? (I know $P stands for the password, but I don't understand the meaning of the other characters.)

Thanks, David
0
 
t2ppCommented:
ENTER is used here as the ISP's login procedure needs a carriage return. It all depends on the login procedure, and for this reason you cannot simply take my example and use it. That's why you need to translate the Windows logon script to a chat script; because we know the Window's one works :) The \\q tells chat not to display the password (q = quiet). The PPP 3 is simply a another set of chat "see this, do this" pair (as mentioned previously).

0
 
sevrinAuthor Commented:
OK, I've had a crack at writing the script. I can't see where the ABORT strings will fit in, as they don't seem to have a counterpart in the windows script, so perhaps you can advise me about that. Also, I'm not sure if I've expressed the > prompt required by my provider correctly.

chat -v \
TIMEOUT 3 \
""\
ogin:--ogin: $ACCOUNT \
""\
assword:--assword: $PASSWORD\
""
>\
ppp\
""
ddr\


0
 
t2ppCommented:
1) change the TIMEOUT value to 30.  2) change "ogin:--ogin: $ACCOUNT \" to "ogin: $ACCOUNT \"  3) change  "assword:--assword: $PASSWORD\" to "assword: $PASSWORD\"  4) probably want a "" after ddr\.  Also, don't forget to init your $ACCOUNT and $PASSWORD. Run it and see. The script will execute before your eyes, so you'll be able to see what it's doing.

0
 
sevrinAuthor Commented:
The script doesn't do much, so far: it simply hangs until I type something, and then exits. When I actually type the script's name
(/etc/ppp-on-dialer), however, I first see an AT and then +++. Then I get my shell prompt again (on the same line as +++). Any ideas what the problem may be? ($ACCOUNT and $PASSWORD are initialized and exported by the /usr/sbin script that calls /etc/ppp-on-dialer, incidentally.)

I've increased the points again, by the way.

Thanks,

David
0
 
t2ppCommented:
Just put ACCOUNT=userid and PASSWORD=password in frount of the chat program in the same file. Then it's al together. There's no need to export these variables. Check /etc/ppp/connect-errors for any clues. Is the modem dialing? Please paste a screen print of the running script when it first stops.
0
 
sevrinAuthor Commented:
I added the ACCOUNT and PASSWORD stuff to the script itself, but it made no difference. I don't have an /etc/ppp/connect-errors file (or anything equivalent). The modem isn't dialling. I can't paste the script, as I have only a basic slakware distribution (not X windows), but all that happens is that I first see AT then +++ then my shell prompt on the same line.
0
 
t2ppCommented:
After the TIMEOUT 30, you have not supplied the phone number to dial! So add "ATDT87654321 OK" and have another go.
0
 
sevrinAuthor Commented:
The phone number was exported at well, but for clarity's sake I've included it in the script. I found another error in the script, but now it does less than before: it just waits 30 seconds, and then I get the shell prompt! For the sake of reference, the script is now the following:

ACCOUNT=me@myaddress.au
PASSWORD=secret1
chat -v                                          \
      TIMEOUT         30                               \
      ATDT92780999\
      ""                                    \
          ogin:      $ACCOUNT                        \
      ""                                    \
          assword: $PASSWORD                       \
      ""                                    \
      >\
      ppp\
      ""\
      ddr\
      ""

0
 
t2ppCommented:
put the "" before ATDT92780999, not after.
0
 
sevrinAuthor Commented:
It made no difference. The modem still isn't even dialling.
0
 
t2ppCommented:
In opening this question, you mentioned that you used to be able to use Linux with your old ISP. Now if you cannot get your modem to dial, then this sounds like you have some hardware problem. Can you use the modem on Linux with another application, like minicom? If you use your old script that you used with your old ISP that we know works, the modem should still dial. Only the script will be different. Please try the old script. I don't see anything wrong with the new script.
0
 
sevrinAuthor Commented:
Unfortunately, the old script stopped working with my old ISP - for the simple reason that they adopted a crap digital server, which is causing them no end of trouble. That's one of the reasons I changed ISP. I just feel sceptical that there can be a one-to-one mapping between the Windows script and the Linux one you're proposing. Lin and Win are completely different operating systems, after all. Maybe Linux needs something to be made explicit that does not need to be explicit with Windows. I don't know.... (Wish I did.)
0
 
t2ppCommented:
Please answer this question "Can you use the modem on Linux with another application, like minicom?"
0
 
sevrinAuthor Commented:
Unfortunately, my Linux system is pretty basic, and I don't have minicom, or any other program that calls for a modem. It's a new 56k modem, though, and it works perfectly well with my Windows system. Sorry I can't be of more help....
0
 
t2ppCommented:
So, you're never had this modem working with Linux?
0
 
sevrinAuthor Commented:
bjacobs,

How do I know whether it's a "winmodem"?

t2pp,

No, I've never used the modem with Linux. But if my old tinny 14k modem worked with it (or at least it did until my ISP went overboard with their digital server), I don't see why a more modern one shouldn't.
0
 
bjacobsCommented:
Hi sevrin,
Look in windows control panel-system-device manager-modems and see what it says. What brand and model of modem do you have?
Bob
0
 
sevrinAuthor Commented:
Hi Bob,

It's a K56 Flex modem. Actually, I'm pretty sure it *is* Linux compatible, because the people I bought it from are Linux mad. Anyway, thanks for the URL you told me about. I've followed the instructions in the URL, and the modem is at least dialling now. However obviously there are going to be system-specific differences between my ISP and the one detailed on the page. For example, as you'll see above, my ISP puts out a > prompt. I suspect the only way I'm going to get everything running is actually paying my ISP to fine tune the script - but if you can suggest anything that I may still need to know or do I'd be grateful. A couple of things on the URL script I'm not too sure about: 1) the format that the IBM site requires for logging in is internet.youraccount.youruserid. Is this a fairly universal format? 2) I'm not sure what port speed to choose.

Thanks for your help,

David
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.