COMPUTER AND NETWORK
                         SYSTEM  ADMINISTRATION
                         Summer 1996 - Lesson 16

A.  Introduction - SLIP and PPP

    - SLIP (Serial Line Internet Protocol) and PPP 
      (Point-to-Point Protocol) are encapsulation protocols.

    - they specify how to encode packets for transmission on a slow and 
      often error prone serial line.

    - they provide full network connectivity, like ethernet, so you can
      use rlogin, rsh, ftp, telnet, xterm, etc.

    - recall that IP packets are encapsulated by an ethernet
      header and trailer when using ethernet protocol.

    - in places where an ethernet connection isn't readily
      available, a serial port, a telephone and a modem probably
      are. 

    - SLIP and PPP provide all the functionality of ethernet, just
      much slower (10 Mb/S vs. 28.8 Kb/s). 

B.  Differences between serial lines and ethernet
   
    - serial medium is point-to-point, ethernet is broadcast.

    - since it is point-to-point, no address header is needed.

    - if you are only using IP, you don't need a type field (SLIP only
      does IP).

    - at the bare minimum, you only need a marker at the beginning and 
      end of the IP packet, for transmission.

C.  Comparison of SLIP and PPP

    - SLIP is the hot-rod, "bare bones encapsulation protocol.

    - as originally defined in RFC 1055, no effort was made to minimize
      traffic on the serial line. 

    - RFC 1144 is the CSLIP (Compressed SLIP) standard that uses several 
      methods to reduce the number of bytes transmitted.

    - TCP header compression, Type of service queueing (whether it's interactive),
      ICMP filtering (avoids transfer of ICMP packets).

    - PPP is the "everything and the kitchen sink encapsulation protocol."
 
    - allows the transmission of multi-protocol packets, where SLIP only
      allows for the transmission of IP packets.

    - SLIP is simpler than PPP, easier to debug, and a pure CSLIP will 
      usually out perform an equivalent PPP connection.

D.  SLIP (Serial Line Internet Protocol)

    - defines two special characters: END and ESC.

    - END = octal 300 (decimal 192)

    - ESC = octal 333 (decimal 219)

    - the simplest implementation of SLIP is this:

     1. to start the transmission of a data packet simply
        begin transmitting the packet  

     2. signify the end of a packet with the END character

     3. if an END appears in the data then send ESC-334
        instead

     4. if an ESC appears in the data then send ESC-335
        instead

 - Deficiencies 
  
   1. Addressing

      - need a method of communicating each other's IP 
        addresses between server and host

      - for example, in dynamic IP allocation the terminal
        server needs to inform the host of its IP address

      - can only be used when both hosts know each other's IP address

   2. Type identification 

      - might like to be able to send DecNet or other traffic
        through the SLIP connection

      - of course, the name is Serial-Line 'IP'

   3. error correction/ detection

      - must be handled at lower layer (by modem)

      - or could be handled by IP checksum

      - or at higher layer (TCP or UDP checksum)
        (though some applications using UDP have the UDP checksum
         turned off - NFS is a notable example)

      - the cost of retransmitting a packet is high at
        14K

      - best to handle error correction as low as possible

   4. compression

      - data can be compressed by modem

      - also, there is much redundant data in the headers
        of a stream of TCP/IP packets

      - one method of compression is to look for redundancies
        between packets (rather than within packets)

      - TCP header compression

        1. a typical TCP/IP header length is 40 bytes (20 IP, 20 TCP)

        2. a TCP connection may result in the exchange of 10's or
           100's of packets

        3. about half of the fields in the TCP/IP headers remain constant
           throughout the session

        4. method is to have the hosts (which are faster than the serial
           connection) remember the redundant header information and 
           transmit only the changes 

   5. evaluation

      - SLIP is fine for linking isolated hosts via modem

      - in a dynamic environment such as a large WAN, SLIP is
        inadequate

      - for example, the connection of  2 routers

E. PPP - Point-to-point protocol

  - built by committee to address SLIP's weaknesses

  - PPP is an Internet standard RFC 1331

  It is composed of 3 parts

  1. Data Link Layer Protocol

     - a method for encapsulating datagrams over serial links

     - uses the HDLC (high-level data link control) protocol
       to encapsulate datagrams for synchronous serial lines

     - adds one field for protocol type (solving SLIP's weakness)

     - also proposes a standard for asynchronous transmission

     - what is synchronous vs. asynchronous serial transmission?

       + asynchronous

         > byte-oriented
         > each byte is preceded by a start bit and followed by
           a stop bit
         > the sender does not wait (block) after sending the data
         > used for 'slow' devices
         > overhead is high (25% for the 2 extra bits)

       + synchronous

              ------------------------------------------------->
              END | error | ....data.... | control | SYN | SYN

         > much larger bit groups are sent
         > bytes are grouped together into a frame
         > the frames are preceded by 2 SYN characters
         > then comes a set of control characters
           - address info, # of data bytes, sequence #, frame type
         > then comes data
         > error checking bits
         > end-of-frame marker

         > synchronous transmission is much faster since the 
           receiver does not start and stop for each byte

         > there is less overhead
           - a typical frame is 500 bytes with about 100 bits
             of overhead (2.5%)

  2. Link Control Protocol (LCP)

     - provides control information for the serial link

     - used to establish connection, set serial config parameters,
       test link

     - designed specifically for PPP

  3. Network Control Protocols

     - a group of individual protocols

     - they provide configuration and control information
       for different network layer protocols

     - there is one for DECNET, IP, OSI, etc.

  4. evaluation

     - PPP is the serial protocol of the future

     - use it if your system supports it, although with linux
       the performance is not as good as CSLIP.

     - note that Solaris 2.4 has PPP integrated into the kernel

F. Basic Connection Model

   - host's kernel must be able to send IP packets across a 
     serial line using SLIP or PPP protocol.

   - must have a user-level program that establishes and maintains
     the SLIP and PPP connection.

   - must be a server on the other end of the serial line that understands
     the protocol that you are using. 

   - there are 3 common ways to manage a serial IP link:
     1. Static - configure a serial port as a network interface.

     2. Dial-up - for use with a modem.

     3. Dynamic - a daemon watches for network traffic and dials the modem
        connects, and disconnects on demand.

G. Network Concerns

   - a IP address needs to be assigned to each SLIP and PPP address.

   - the SLIP or PPP server needs to be configured to route packets to 
     each of its clients.
   
   - the server becomes the gateway for the SLIP and PPP clients.

   - Security:

     - the SLIP and PPP clients when connected are real members of the
       network and need to be treated as such.
    
     - when you assign an IP address-name be aware of what privileges 
       are associated with the address.   

   - NFS:
     
     - Standard NFS uses UDP, which doesn't guarantee reliable delivery,
       and doesn't use congestion control algorithms.

     - standard NFS is not a good idea, but TCP-based NFS is the answer to
       the problems.

     - TCP-based NFS is currently under development for linux.

H. Configuring SLIP and PPP under linux:

1. Configuring SLIP under linux:

   - Make sure that slip support is compiled into the kernel.
      (cd /usr/src/linux, type make config and answer yes to SLIP and CSLIP)

   - Use dip with a dip script to dial your modem.
      (Type man dip for more detailed information). 

   - Configure the dip script to use an MTU of 576 (RFC 879).   

   -also see the Net howto for more info.

Sample skeleton.dip script for linux:


#
# sample.dip	Dialup IP connection support program.
#		This file (should show) shows how to use the DIP
#		scripting commands to establish a link to a host.
#		This host runs the 386bsd operating system, and
#		thus can only be used for the "static" addresses.
#
# NOTE:		We also need an example of a script used to connect
#		to a "dynamic" SLIP server, like an Annex terminal
#		server...
#
# Version:	@(#)sample.dip	1.40	07/20/93
#
# Author:	Fred N. van Kempen, 
# Modified:     Uri Blumenthal 
# Modified:     Jim Van Zandt 
#

main:
  # First of all, set up our name for this connection.
  # set by IP unless you've got name service... 
  get $local XXX.XXX.XXX.XXX

  # Next, set up the other side's name and address.
  get $remote XXX.XXX.XXX.XXX
  # Set netmask on sl0 to 255.255.255.0
  netmask 255.255.240.0
  # Set the desired serial port and speed.
  # cua0=com1, cua1=com2, etc.
  port cua1
  speed 38400

  # Reset the modem and terminal line.
  # This seems to cause trouble for some people!
  reset

# Note! "Standard" pre-defined "errlvl" values:
#	0 - OK
#	1 - CONNECT
#	2 - ERROR
#	3 - BUSY
#	4 - NO CARRIER
#	5 - NO DIALTONE
#
# You can find those grep'ping for "addchat()" in *.c...
# You can change thise with the "chatkey" command.

  # Prepare for dialing.
  send ATZ\r
  wait OK 2
  if $errlvl != 0 goto modem_trouble
  dial PHONE# 
  if $errlvl != 1 goto modem_trouble

  # We are connected.  Login to the system.
login:
  sleep 2
  wait login: 20
  if $errlvl != 0 goto login_error
  send USERNAME\n
  wait ssword: 20
  if $errlvl != 0 goto password_error
  send PASSWORD\n
loggedin:

  # We are now logged in.
  wait enabled 15
  if $errlvl != 0 goto prompt_error

  #exit

  # Set up the SLIP operating parameters.
  get $mtu 576 
  # Ensure "route add -net default blah" will be done
  default

  # Say hello and fire up!
done:
  print CONNECTED $locip ---> $rmtip
  mode CSLIP
  goto exit

prompt_error:
  print TIME-OUT waiting for SLIPlogin to fire up...
  goto error

login_trouble:
  print Trouble waiting for the Login: prompt...
  goto error

password_error:
  print Trouble waiting for the Password: prompt...
  goto error

modem_trouble:
  print Trouble occurred with the modem...
error:
  print CONNECT FAILED to $remote
  quit

exit:
  exit
----------------------------------------------------------

If this file is /etc/sample.dip then you dial by your modem
bye typing /sbin/dip /etc/scri.dip.


2. Configuring PPP under Linux

   Check out the PPP HOWTO.