PPP with Callback under Linux

    Set up a PPP connection to your company, including CBCP callback negotiation.


    • What?

    • Why is it difficult?

    • How?

    • Back...


      What?

      Scenario: your company offers a dial-up service to let teleworkers, people on business trips, or the poor systems admin dial in to the premises. This is usually done via some special access router, like e.g. an Ascend Max, Ericsson Tigris, or comparable.

      These devices offer a service called Dialback which, after identifying yourself, hangs up on you, and calls you back a second later, usually either to a predefined number (not useful if you're in some motel room) or to a number your specify after logging in. This last part is usually handled by something called the CallBack Configuration Protocol, or CBCP for short.

      Why is it difficult?

      It isn't, really. Trouble is, CBCP was invented by a well-hated company from Redmond. After implementing it into their products, however, they actually prepared an RFC and presented it to the IETF, which means others get a chance to use it, too.

      Most Linux distributions ship with some form of a PPP daemon, pppd, for short. Most, however, do not have the pppd compiled for CBCP. You need to correct this, plus configure it.

      How?

      Easy. Two steps:

      • First - get the pppd source and compile it. Grab a file called pppd-2.x.x from a mirror near you, read the file named README.CBCP in the package, and compile it. An older binary version is available for your convenience here.

      • Second - configure it.

      Below are the configuration files I use. Starting from the top and drilling deeper, the first thing you need is a script to call pppd:

      /etc/ppp/dial-out:

      #!/bin/bash
      # set -x
      
      # variables
      DIALIN=<your company's phone number here>
      export DIALIN
      
      if [ $# -ne 2 ]
      then    echo -n "UserID: "
              read USER
              echo -n "SecurID: "
              read SECURID
              export USER SECURID
      else    export USER=$1
              export SECURID=$2
      fi
      
      /usr/sbin/pppd /dev/modem 115200 file "/etc/ppp/options.nt" 
      sleep 1
      /usr/sbin/pppd /dev/modem 115200 file "/etc/ppp/options-callback.nt"
      echo Finished, press CR...
      read bla
      
      You can provide the script with two parameters, the userID and the password, in this case the secret number from a SecurID card. If you call it without parameters, or a wrong number of parameters, it will interactively ask for the correct values.

      The variables $USER and $SECURID are evaluated in the chat scripts we'll come to in a second. Note that there are actually two invocations of pppd - one to dial out and log into the router, and the second to accept the router's dialback.

      Substitute the correct phone numbers for $DIALIN (your company's dial-in router) and $DIALBACK (your own phone number).


      /etc/ppp/options.nt:

      connect '/usr/sbin/chat -v TIMEOUT 120 \
      ABORT BUSY \
      ABORT "NO DIALTONE" \
      ABORT ERROR \
      ABORT "NO CARRIER" \
      "" +++ATZ \
      OK ATS0=1X0E1DT$DIALIN \
      CONNECT "" \
      ogin: "$USER" \
      assword: "$SECURID"'
      crtscts
      bsdcomp 15
      lock
      debug
      noipdefault
      ipcp-accept-local
      ipcp-accept-remote
      -d
      # Enter your phone number after the callback option
      callback 123-1234
      -detach
      receive-all
      
      This is the chat script that talks to the Ascend router and provides the userID, the SecurID (password), and starts ppp on the Ascend. Note that you must change 123-1234 to the number you dial.


      /etc/ppp/options-callback.nt:

      connect '/usr/sbin/chat -v -f /etc/ppp/nt-callback.chat'
      asyncmap 0
      crtscts
      bsdcomp 15
      lock
      debug
      noipdefault
      ipcp-accept-local
      ipcp-accept-remote
      -d
      lcp-echo-interval 20
      lcp-echo-failure 2
      -detach
      receive-all
      
      This is the second script, /etc/ppp/options-callback.nt, which is shorter than the first one simply because it uses an external chat script, /etc/ppp/nt-callback.chat, immediately below.


      /etc/ppp/nt-callback.chat:

      TIMEOUT 	120
      ABORT 		"BUSY"
      ABORT 		"NO ANSWER"
      "" 		ATZ
      OK		""
      RING 		ATA
      CONNECT 	""
      
      Very straight forward. Waits for "RING" from the modem, then goes off hook (ATA) and accepts the call.


      By now, you should have four files which is basically all you need. Leave the files ppp-on, ip-up, and ip-down in /etc/ppp as they are. Copy and paste the four files from above, change your phone numbers appropriately, make sure to do a chmod u+x /etc/ppp/dial-out, and start the connection by typing /etc/ppp/dial-out <UID> <PW>, replacing <UID> and <PW> with your user ID and password.

      Check your /var/log/messages files for output from pppd (there will be lots) and see how it talks to the router. This is the best way to debug what's going on.


    Comments, Flames, Correspondance: <wfb@mtnsub.org> - $Id: ppp-linux.html,v 1.2 2003/03/24 13:27:20 eedmgu Exp $