TCP/IP Protocol

Packet structure


  +------------------+----------------+------------------+---------------+
  | Data Link header | Network header | Transport header | Appl. Data... |
  +------------------+----------------+------------------+---------------+

Transport Layer

UDP

User Datagram Protocol

Provides an unreliable datagram service between applications given an unreliable datagram service between hosts

Header (8 bytes)

If the header checksum fails, the packet is discarded. The data is not error checked.

TCP

Transport Control Protocol.

Provides a reliable 2-way data stream between remote applications.

TCP header (20 bytes)

Underlying network layer provides an unreliable packet delivery service. Packets may be lost, duplicated, or delivered out of order.

Reliable stream

Protocol to ensure that all packets are received, and in the correct order.

Connection setup

Protocol to open and close connections.
  Action             Client state        Server state
  ------             ------------        ------------
                     CLOSED              LISTEN
  SYN --->           SYN_SENT            SYN_RCVD
  <--- SYN+ACK       ESTABLISHED         ESTABLISHED
                     ...                 ...
  FIN --->           FIN_WAIT_1          CLOSE_WAIT
  <--- ACK           FIN_WAIT_2
  <--- FIN           TIME_WAIT           LAST_ACK
  ACK --->                               CLOSED
  Wait 30 seconds    CLOSED

Flow control

Protocol to ensure that the sender does not send data faster than the receiver can receive it.

Congestion control

Protocol to ensure that the sender does not send data faster than the network can transmit it.

Network Layer

Routing algorithms

The Internet uses a hierarchical network.

IP

Internet Protocol

Provides an unreliable packet delivery service between hosts (routing).

Header (20 bytes)

Addresses

Packet fragmentation

Sender breaks up IP packet into MTU sized units. Receiver reassembles.

   +----------------+     +----------+  +-----------+  +------------+
   |  Len = 1500    |     | Len = 500|  | Len = 500 |  | Len = 500  |
   |  ID = 123      |  =  | ID = 123 |  | ID = 123  |  | ID = 123   |
   |  Flags = 0     |     | Flags = 1|  | Flags = 1 |  | Flags = 0  |
   |  Frag = 0      |     | Frag = 0 |  | Frag = 500|  | Frag = 1000|
   +----------------+     +----------+  +-----------+  +------------+

Routing protocols

RIP - Routing Internet Protocol OSPF - Open Shortest Path First IGRP - Internal Gateway Routing Protocol BGP - Border Gateway Protocol (or BGP4)

ICMP

Internet Control Message Protocol

Format

In data portion of IP packet.
  ICMP
  type   Code
  0      0      Echo reply to ping
  3      0      Destination network unreachable
  3      1      Destination host unreachable
  3      2      Destination protocol unreachable
  3      3      Destination port unreachable
  3      6      Destination network unknown
  3      7      Destination host unknown
  4      0      Source quench (unused, TCP provides congestion control)
  8      0      Echo request by ping
  9      0      Router advertisement (used by RIP)
  10     0      Router discovery
  11     0      TTL expired (router loop, also used by traceroute)
  12     0      IP header bad

IPv6

Internet Protocol version 6. Proposed replacement for IPv4. We will run out of IP addresses in 2005-2010.

Header format (40 bytes)

Back