CIS307: Layers

[Chapters 14, 15, 16, 17, 19, 20 - Comer (1996)]

 

Latest CS307 Page

Physical Layer

At the physical layer we are concerned at the electrical and mechanical level with the transmission of individual bits/characters. We have talked of two encodings of binary data into binary signals, Non-Return-To-Zero-Level and Differential Manchester, that are relevant to this topic. We have talked briefly also of RS-232C and Ethernet.

A significant physical layer protocol is SONET (Synchronous Optical NETwork), with a variation called SDH (Synchronous Digital Hierarchy). It uses a binary signal (baseband) multiplexed using Time-Division Multiplexing. It was originally designed for the transfer of voice data. SONET multiplexes a number of voice channels, in fact it sends a 810 byte frame each 125 microseconds. Of these 810 bytes only 783 bytes carry data, the rest is control information. Thus the total data rate is 810 * 8 * 8000 bits/s, or 52Mb/s. SONET also comes with data rates that are multiples of this value.
T1 is a carrier related to SONET. It again uses multiples of the voice channel. Now every 125 microseconds we send a frame of 24 voice channels plus one framing bit. Thus the data rate is 24*8 + 1 bits each 125 microseconds (remember from note on Nyquist Sampling Theorem), for a total of 1.544 Mb/s. Other carriers use multiples of T1: T2 is 4 times T1 plus control bits, for a total data rate of 6.312Mb/s; T3 is 6 times T2 plus extra control bits, for a total data rate of 44.736Mb/s; T4 is a combination of 7 T3s for a total with control bits of 274.176Mb/s. T1 can be multiplexed on T2, or T3, or T4. T1, T2, T3 can be multiplexed on SONET. You may have heard of people/companies leasing T1 lines, or T3 lines, or .. (rental is thousands of dollars per month).

Data Link Layer

The data link layer transfers information reliably over the physical layer between neighboring nodes. The connection between neighbors can be point-to-point, i.e. a direct link, or shared, i.e. a link that is shared between a number of nodes, as we saw with Ethernet. In the case of shared medium we need a MAC (Medium Access Control) protocol to regulate access to the shared medium, like CSMA/CD we saw with Ethernet. Once access is resolved (or it is unnecessary as in point-to-point), one has DLC (Data Link Control) which carries out the main functionality of the Data Link Layer.

A basic problem at the data link layer is what to do when errors are detected at the receiver end (we have already seen how detection is done). The transmitter has to retransmit the frame, and the question is how does the transmitter find out that it has to do so. There is need of an ARQ (Automatic Repeat Request) method. Three such methods are in common use:

Notice than in the case of both Go-Back-N and of Selective-Repeat we need a way to identify frames. To this end one uses identifiers, say n bits, that identify a frame among the outstanding frames. So if if use 3 bits, we have as identifiers 0,1,2,3,4,5,6,7 and when an id has been acknowledged it can be reused.

Performance of ARQ Techniques

We can express the time required to transmit a frame using Stop-and-Wait ARQ in terms of two basic times: the Transmission Time Tt and the Propagation Time Tp. The former is easily computed by dividing the size of the frame by the data rate of the channel. So a 1500 Bytes frame in Ethernet will take 1.2 ms (1,500B = 12,000b, data rate = 10Mbps). The latter is easily computed by dividing the distance between sender and receiver by the propagation speed of the signal (usually 200,000Km/s). So the propagation time in Ethernet at the distance of 200 meters will be 1 microsecond.
In Stop-and-Wait the delivery time of a frame, Td, is thus Td = Tt + 2*Tp. This says that the utilization of the communication channel is
       Tt          1                 Tp   Propagation Time
    --------- = --------  where a = --- = -----------------
    Tt + 2*Tp    1 + 2*a             Tt   Transmission Time
So the utilization in our example in Ethernet is almost 100%. But suppose we use a T1 line (1.5Mbps) to transmit a 100 Byte frame to Los Angeles from Philadelphia (5000 kilometers), we get Tp = 25ms, Tt = 0.5ms for a utilization of about 1%.
Things become even worse if we take into consideration the probability of errors. Say that the probability of loss of the frame is P (we assume the ACK/NACK never fails), then the utilization becomes
      (1 - P)
     ---------
      1 + 2*a
[this result is obtained reasoning as when we computed the round robin time in the notes on performance evaluation.]

If we consider instead the Go-Back-N ARQ or the Selective-Reject ARQ the transmission of ACKs is overlapped with the transmission of the frames. Thus the utilization, without worrying about errors, becomes

 
                            N
                      /  -------  if  N < 1 + 2*a
                      |  1 + 2*a
      utilization =   |
                      |
                      \  1        otherwise
This can be understood with the following observations: The relationship between Tp, Tt, and N is captured by the following diagram:

Sliding Window Protocol

The performance of the various ARQ techniques shows that allowing the transmission of more than one frame before requiring acknowledgement improves performance. In fact utilisation increases with N. On the other hand the larger is N the larger are the memory requirements on the sender (Go-back-N) or on both the sender and the receiver (Selective-Reject). Thus N must be limited (this is a form of Flow Control). The Sliding Window Protocol embodies these ideas. It operates as follows:

  1. One selects the number of bits m to be used for the frame identifier. Say m, for example 3.
  2. Set N to 2**m - 1. So if m is 3 N is 7 and the frames will have ids 0,1,2,3,4,5,6,7, but only 7 of them may be outstanding (i.e. without acknowledgement) at a time.
  3. The receiver will send ACK_i when it has received all the frames up to frame i-1 included. In addition if the receiver were to send a message to the sender (because they have a two way conversation) it will insert in the message the same ACK_i as a further confirmation (or as the only confirmation as suggested by some). [This second acknowledgement is said to be piggybacked on the message from receiver to sender and it is the reason why we cannot have 2**m outstanding frames: suppose sender sends 0 and gets ACK_1; then it sends 1,2,3,4,5,6,7,0, then it received ACK_1 again. Does it mean that 1,2,3,4,5,6,7,0 were all received correctly, or does it mean that they were all lost and receiver is repeating the previous ACK_1?]
This sliding window protocol can be generalized to the case where the frames are of variable size and we have a bound on the cumulative size of the frames that are outstanding.

We can determine the "ideal" size in bits W of the window used in the Sliding Window Protocol on the basis of the fact that we want to keep on transmitting until acknowledgement has been received for the initial packet. The round trip for the acknowledgement is Tt+2Tp. If r is the data rate at which the transmitter is transmitting, then the number of bits to be transmitted during the round trip is

    W = r(Tt+2Tp)

HDLC

HDLC (High-Level Data Link Control) is one of a family of similar data link protocols that use the sliding window technique. It is bit oriented with a flag sequence (it uses bit stuffing) to indicate the start and termination of a frame. A Frame has the form:
        8 bits    8 bits    8 bits    >=0    16 bits     8 bits
    +----------+---------+---------+------+----------+----------+
    | 01111110 | address | control | data | checksum | 01111110 |
    +----------+---------+---------+------+----------+----------+
where the address field is likely not to be used in most cases you will encounter and the control field comes in three formats:
bits  1      3         1     3
    +---+----------+-----+-------+
    | 0 | sequence | P/F |  next |     Format for Information Frames
    +---+----------+-----+-------+

bits  1   1    2      1      3
    +---+---+------+-----+-------+
    | 1 | 0 | type | P/F |  next |    Format for Supervisory Frames
    +---+---+------+-----+-------+

bits  1   1   1     1     1       3
    +---+---+---+------+-----+----------+
    | 1 | 1 | 0 | type | P/F | modifier |  Format for unnumbered frames
    +---+---+---+------+-----+----------+

sequence specifies the sequential id of this frame in accordance to the sliding window protocol.
next is the piggibacked acknowledgement for a received frame.
type is the code for a command such as RECEIVE READY, REJECT, RECEIVE NOT READY, SELECTIVE REJECT, DISCONNECT, FRAMEREJECT.
P/F means Poll/Final and it is normally used in communication with terminals in a multidrop line.
Information frames are used to transport data. Supervisory frames are used to transport acknowledgements and commands. Unnumbered frames are used both for command purposes and for data transport.

PPP

PPP (Point-to-Point Protocol) is a point-to-point data link protocol related to HTLC. It is used for example by people at home to connect through modem to their ISP (Information Service Provider) and interact as a regular workstation directly connected to the internet.

Network Layer

Chapters 14, 15, 16, 17, 19 in Comer. We skip IPv6 (chapter 18).

IP Addresses

IP addresses are 32 bit integers. They are normally written as 4 small integers representing the bytes of the number separated by periods. For example 155.247.182.1 is an IP address. Each IP address consists of two portions, a network identifier and a host identifier. There are 5 classes of IP addresses: A number of IP addresses have a standard meaning:
+------------+------------+----------+-------------------------------+
| Network    | Host       | Type of  | Purpose                       |
| Identifier | Identifier | Address  |                               |
+------------+------------+----------+-------------------------------+
| all 0s     |  all 0s    | this     | Using during bootstrap to     |
|            |            | computer | ask for own's IP address      |
+------------+------------+----------+-------------------------------+
| Network    |  all 0s    | specified| The specified network,        |
| Identifier |            | network  | independent of its hosts      |
+------------+------------+----------+-------------------------------+
| Network    |  all 1s    | specified| Broadcast address for the     |
| Identifier |            | network  | specified network.            |
+------------+------------+----------+-------------------------------+
| all 1s     |  all 1s    | local    | Broadcast on local network    |
|            |            | network  |                               |
+------------+------------+----------+-------------------------------+
| 127        | anything   | loopback | Testing of TCP/IP while not   |
|            |            |          | using the network             |
+------------+------------+----------+-------------------------------+

Subnetting

The granularity of IP address classes leads often to poor utilization of the address space and to limited ability to address subgroups within a network. The solution is to use Subnetting. Assume that we have a class B network like 155.247. We can partition the host space into 10 bits for subnet id and 6 bits for host id. Thus we have 1024 subnets each with up to 62 hosts. Subnetting is based on the use of masks. In our example, the subnet mask is 255.255.255.192. The bitwise AND of an IP address with the submask will result in the subnet identity. In our example, if we have the IP address 155.247.182.98, then the subnetwork id is 155.247.182.34.

To account for subnetting a routing tables T takes the form:

[subnet-id, subnet-mask, next-hop] Then when an IP address A has to be routed the algorithms used is:
   For each row i of routing table T
       Let D = T[i].subnet-mask BitwiseAnd IP;
       If (D == T[i].subnet-id) then
       {
          Forward packet to T[i].next-hop;
          break;
       }
The ideas of masks and subnetting have been generalized to allow more complex partitions of networks than the one we have just discussed.

IP Role

IP provides an unreliable, best-effort, connectionless packet delivery service. It supports: IP does not do directly:

IP Header

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |Version|  IHL  |Type of Service|          Total Length         |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |         Identification        |Flags|      Fragment Offset    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |  Time to Live |    Protocol   |         Header Checksum       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                       Source Address                          |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Destination Address                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options                    |    Padding    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Version: Current IP  4 
         Next Generation:  6 ==> IPv6 or IPng
IHL: Header Length in words:  without options it is 5, with
         options it can be as high as 15.
Type of Service: the sender specifies the type of service desired,
         if one that maximizes reliability or one that minimizes delivery
         time or one that maximizes throughput.
Total Length: 16 bits ==> maximum packet size 65,535 Bytes (64 KB)
         including header length  
Identification: unique for each IP datagram
       (1) source increments a counter
       (2) gateway copies
       All the fragments of the same packet have the same identification.
Flag: three bits, two lower bits used for fragmentation
       (1) first bit if 1, means do not fragment (this is the DF flag)
       (2) second bit if 1, means more fragment are coming (not end of packet)
          (This is the MF flag.)
Fragment Offset: offset in the original datagram in units of 8 octets. All
       fragments, except the last, must me multiples of 8 bits.
TTL:   each gateway decrements TTL by some number and discard the packet if it
       reaches 0. If discarded, the sender is informed using the ICMP (Internet 
       Control Message Protocol) protocol.  
       In theory, it counts in second units and discards a packet that takes
       255 seconds to propagate.
Protocol: number of higher level protocol that is using the current packet
       ICMP: 1, TCP: 6, UDP: 17
Some observations on IP protocol:

ICMP: Internet Control Message Protocol

It is encapsulated within an IP packet. It supports the following message types: ICMP is used to implement ping (using the EchoRequest/Reply messages), traceroute (IP using the TimeToLive, and ICMP using the TimeExceeded message), and to determine a path's MTU (IP using the DF flag and ICMP using the FragmentationRequired message).

Transport Layer

Chapter 20 in Comer.

TCP Header

The Transmission Control Protocol (TCP) is a connection oriented [thus sender and receiver are as connected in a virtual circuit], bidirectional, stream oriented [as opposite to message oriented, i.e. users think in terms of sending and receiving a stream of octets; the implementation will actually use messages, called segments.] reliable transmission protocol at the transport layer. The same format for the header is used in both directions in a connection. Here is a picture of the header of a segment and a description of some of its fields.
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |          source port          |        destination port       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                        sequence number                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                 acknowledgement number                        |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | TCP |             |U|A|P|R|S|F|                               |
   |Headr|             |R|C|S|S|Y|I|       window size             |
   |lengt|             |G|K|H|T|N|N|                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |       checksum                |   urgent pointer              |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                    Options (0 or more words)                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Source and Destination Ports:
They are 16 bit numbers. A port number is local to a specific host, i.e. different hosts have 65,535 different ports. In unix /etc/services keeps a list of specific uses for some of these ports. For example, HTTP uses 80, Telnet uses 23, FTP uses 21. The first 1024 ports are said to be "well known" and are reserved. Notice that ports allow us to communicate with specific programs on a computer, not just with a computer as in IP.
Sequence and Acknowledgement Numbers:
These numbers are local to a connection between two nodes, they are unique during the life of message. The initial sequence number is agreed between the sender and the receiver when the connection is set up with a Three-Way-Handshake [SYN->, SYN+ACK<-, ACK->]. For example, if two nodes A, B are communicating, then A as sender may choose initially the number 200 and B as sender may choose initially the number 500. Then B will acknowledge messages relative to 200 and A will acknowledge messages relative to 500.
Length of the TCP header:
It is counted in 32-bit words.
Flags:
There are a variety. Among them:
Window Size:
It specifies the size of the receiver's available buffer (called window).
Urgent pointer:
Byte offset from the current sequence number at which urgent data will be found.
Some of the issues dealt with at the transport level, in particular by TCP, are:

ingargio@joda.cis.temple.edu