Lecture 18: Networks

(Tanenbaum sec. 8.3. For more detail, I recommend Internetworking with TCP/IP: Principles, Protocols, and Architectures Douglas Cromer, Prentice Hall.)

Layered network design

Note: This layering structure should not be taken too seriously. Many actual system omit some of these layers, or organize things differently.

Physical layer


Classic Ethernet: A coaxial cable to which all the computers are attached. To send packet P (0-1500 bytes)
   Prepend a header to P, indicating computer and process to receive P.
   Wait until network is free;
   %ransmit P on the network;
   If (there is a collision) {
      T := 27 micro seconds;
      repeat {
         T1 := random value between 0 and T;
         wait until network is free;
         transmit P on the network;
         if (no collision) then exitloop
           else T := 2*T;


Hosts and routers. Packet has destination IP address. Router receives packet from source host or from another router, looks up the IP address in a table, chooses appropriate outgoing line, and sends it to destination host or to another router.

IP (Internet Protocol)

IP address

32 bit addresses, conventionally written in 4 fields of decimal numbers between 0 and 255. E.g. Routers know how to send message to specified IP address.

Domain name. E.g. "cs.nyu.edu". Hierarchical structure of names from specific to general.

Name server translate domain name to IP address. 2 or more level hierarchy of name servers: Root server and local name server. Local server holds names within a given domain; e.g. name server for nyu.edu or for nsf.gov. Root server knows which domains are handled by which local name server. When a user needs to translate a domain name, they send a query to the root server (whose IP address is known). IP address to the local server.

Cache name translations locally for efficiency. Each name/IP-address pair cached is labelled with "Time to Live" value, supplied by name server when queried. If cache copy is passed its Time to Live, it is flushed from the cache.

IP -- Internet Protocol

IP process deals with a packet of data. Sent as datagrams ; i.e. at IP level, just sent out on the Internet with no guarantees. (The guarantees are implemented at the TCP level.) Router may split packet into fragments , because each connection in network may have its own maximum on size of frame that it can handle.

Header followed by data. Form of header (Do NOT memorize this:)

The IP level is responsible for routing packet to destination, splitting datagram into fragments, reassembling fragments to datagram.

Note: IP is used by the routers, and so, necessarily, is the standard protocol at this level throughout the Internet. If you want to use the internet, you have to use IP.

TCP -- Transmission Control Protocol

Layered over IP. Complicated. Provides for Thus, it creates a reliable virtual connection for messages of arbitrary length.

The progress of an TCP/IP message through the Internet

Sending out a message M over TCP/IP from host H therefore involves the following steps:
TCP-processor at source (message M) {
   Break M into packets P1 ... Pk.
   Concurrently do for all the packets Pi {
       prepend TCP header to Pi;
       repeat {call IP processor for Pi;
               wait for one of the following:
                  (1) acknowledgement of Pi is received;
                  (2) a message is received that Pi was garbled in transmission
                  (3) time TWAIT has passed.
          until acknowledgement for Pi is received;

IP processor at source (packet P) {
     Prepend IP header to P;
     Send P to the router that serves H;

Note that the packet placed on the network has, first the IP header, then the TCP header, then the actual data.
A router R on the network receiving fragment F:  {
   Uses IP checksum to check that header is still OK;
   Uses IP "Time to live" to check that fragment is still current.
   Decrements "Time to live";
   Finds the outlink (either the destination or another router) to
      send F;
   May have to split F into fragments, each of which has its own
         IP header
     Or may have to combine F with other incoming fragments into 
         a larger chunk;
   Transmits the fragment(s) along the outlink;

IP processor at destination: {
   Uses IP checksum to check that header is still OK;
   Strips off IP header.
   Passes on packet to TCP processor. 

TCP processor at destination {
   Uses data checksum to check that data is OK;
   If OK, then sends acknowledgement of packet to source;
      else repeat { send request for retransmittal of Pi;
                    wait for time TWAIT
             until Pi is correctly received;
  Reassemble packets into message.  
  Transmit to process waiting for specified host;

Note: TCP is used only by the source and destination hosts. As far as the routers are concerned, the TCP header is just part of the IP data. Therefore, if you and your friends in Urumchi want to make up, implement, and communicate with a new protocol at the same level of functionality as TCP, you're welcome to do so.

Web Browser

When you click on a link in Netscape or Internet Explorer, what happens?

HTTP (HyperText Transfer Protocol)

Tricky issue with document length. Therefore: If length is known, send length followed by data. Otherwise send data and close the connection.