home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / N / TCPIP / NETKIT-A.06 / NETKIT-A / NetKit-A-0.06 / etc / sample.dip < prev    next >
Encoding:
Text File  |  1994-06-27  |  2.2 KB  |  93 lines

  1. # This is a sample file for the program 'dip'.
  2. # 'dip' can be used to dial to a Internet provider and establish a SLIP
  3. # or CSLIP connection.
  4. #
  5. # sample.dip    Dialup IP connection support program.
  6. #        This file (should show) shows how to use the DIP
  7. #        scripting commands to establish a link to a host.
  8. #        This host runs the 386bsd operating system, and
  9. #        thus can only be used for the "static" addresses.
  10. #
  11. # NOTE:        We also need an examnple of a script used to connect
  12. #        to a "dynamic" SLIP server, like an Annex terminal
  13. #        server...
  14. #
  15. # Version:    @(#)sample.dip    1.40    07/20/93
  16. #
  17. # Author:    Fred N. van Kempen, <waltje@uWalt.NL.Mugnet.ORG>
  18. #
  19.  
  20. main:
  21.   # First of all, set up our name for this connection.
  22.   # I am called "uwalt.hacktic.nl"  (== 193.78.33.238)
  23.   get $local uwalt.hacktic.nl
  24.  
  25.   # Next, set up the other side's name and address.
  26.   # My dialin machine is called 'xs4all.hacktic.nl' (== 193.78.33.42)
  27.   get $remote xs4all.hacktic.nl
  28.   # Set netmask on sl0 to 255.255.255.0
  29.   netmask 255.255.255.0
  30.   # Set the desired serial port and speed.
  31.   port cua02
  32.   speed 38400
  33.  
  34.   # Reset the modem and terminal line.
  35.   # This seems to cause trouble for some people!
  36.   reset
  37.  
  38.   # Prepare for dialing.
  39.   send ATQ0V1E1X4\r
  40.   wait OK 2
  41.   if $errlvl != 0 goto modem_trouble
  42.   dial 555-1234567
  43.   if $errlvl != 0 goto modem_trouble
  44.   wait CONNECT 60
  45.   if $errlvl != 0 goto modem_trouble
  46.  
  47.   # We are connected.  Login to the system.
  48. login:
  49.   sleep 2
  50.   wait ogin: 20
  51.   if $errlvl != 0 goto login_error
  52.   send MYLOGIN\n
  53.   wait ord: 20
  54.   if $errlvl != 0 goto password_error
  55.   send MYPASSWD\n
  56. loggedin:
  57.  
  58.   # We are now logged in.
  59.   wait SOMETEXT 15
  60.   if $errlvl != 0 goto prompt_error
  61.  
  62.   # Set up the SLIP operating parameters.
  63.   get $mtu 296
  64.   # Ensure "route add -net default xs4all.hacktic.nl" will be done
  65.   default
  66.  
  67.   # Say hello and fire up!
  68. done:
  69.   print CONNECTED $locip ---> $rmtip
  70.   mode CSLIP
  71.   goto exit
  72.  
  73. prompt_error:
  74.   print TIME-OUT waiting for SLIPlogin to fire up...
  75.   goto error
  76.  
  77. login_trouble:
  78.   print Trouble waiting for the Login: prompt...
  79.   goto error
  80.  
  81. password:error:
  82.   print Trouble waiting for the Password: prompt...
  83.   goto error
  84.  
  85. modem_trouble:
  86.   print Trouble ocurred with the modem...
  87. error:
  88.   print CONNECT FAILED to $remote
  89.   quit
  90.  
  91. exit:
  92.   exit
  93.