Lecture 3. TCP / IP
This presentation is the property of its rightful owner.
Sponsored Links
1 / 14

Lecture 3. TCP / IP PowerPoint PPT Presentation


  • 88 Views
  • Uploaded on
  • Presentation posted in: General

Lecture 3. TCP / IP. Objective: A in-step look at TCP/IP Purposes and operations Header specifications Implementations Internet protocol (IP)

Download Presentation

Lecture 3. TCP / IP

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Lecture 3 tcp ip

Lecture 3. TCP / IP

Objective: A in-step look at TCP/IP

  • Purposes and operations

  • Header specifications

  • Implementations

    Internet protocol (IP)

  • IP is an unreliable connectionless protocol for host-to-host datagram transmission. It includes rules for fragmentation and assembly of long datagram. It was first defined in RFC:791 (IPv4)

  • Hosts are identified by fixed length IP addresses. 32 bits in IPv4.

  • IP is called by local host protocol, it calls the local network protocol to carry the datagram to the next gateway or destination host. Gateways implement IP to forward datagrams

  • Operations

    • Addressing: insert the destination address in header

    • Routing: select path for transmission

    • Fragmenting: divide a datagram into some smaller units to accommodate the MTU of a data link

    • Services: type of service, time to live, options, header checksum


  • Lecture 3 tcp ip

    Ver4 bits

    HLEN4 bits

    TS8 bits

    Total length 16 bits

    Flag 3bits

    Fragmentation 13 bits

    Identification 16 bits

    Protocol8 bits

    Header checksum16 bits

    Time to live 8 bits

    Source IP address

    Destination IP address

    Option

    IP header

    Data

    • An IP datagram consists of IP header and data. The maximum length of a datagram is 65,535 bytes. MTU is the maximum number of bytes that a data link protocol can encapsulate. MTU vary from data link to data link.

    • IP datagram

    • The header format of IP datagram


    Lecture 3 tcp ip

    • The definition of each field

      • Version number (VER)

      • Head length (HLEN): in 4 byte (word)

      • Types of Services (TS) 0-2: precedence; 3: delay; 4: throughout; 5: realiability, 6-7: future use

      • Identification: a datagram number assigned by TCP process

      • Flag: first bit is reserved, second bit = 1: can not be fragmented third bit = 1, not the last fragment

      • Fragmentation offset: the offset of original datagram in bytes (start from 0)|

      • Time to live: time left in transmission

      • Protocol: higher layer protocols 00000001 (ICMP), 00000010 (IGMP), 00000110 (TCP), 00001001 (UDP), …


    Lecture 3 tcp ip

    • Checksum (16 bits)Calculated by sender, inserted in the header. Recalculated by receiver. If not correct, discard

      • Sender: divide the datagram into k groups, each has 16 bits (take the checksum field as 0), then calculate the sum, the checksum is the one’s complements, the add th checksum to the checksum field

      • Receiver: calculate the checksum. If the result is 0, accept, otherwise discard

    • OptionsSecurity option provides a way for hosts to hand restrictions by IP software 00000000 00000000 - Unclassified 11110001 00110101 – Confidential 01011110 00100110 - PROG 10101111 00010011 - Restricted 11010111 10001000 - Secret 01101011 11000101 - Top Secret


    Lecture 3 tcp ip

    • IP implementation

      • Header-adding module Receives data from an upper-layer protocol, along with IP the destination IP address. It encapsulates the data in an IP datagram by adding the IP header.

      • Processing moduleReceives datagram from the header-adding module. Check if it is a loopback packet, or it arrives its destination, if yes, then sends it to assembly module. If the node is a router, it decrements the time TTL by one, if TTL is less than one, discard the packets, ICMP message. If the TTL is bigger than one, then passes it to the routing module.

      • Routing moduleReceives an IP packet from processing module, find the IP address of the next station from the routing table, and pass to fragmentation module.


    Example of ip header

    Example of IP header

    IP header in Hex:

    4500 0028

    08b9 4000

    ff06 999a

    c0db ee2d

    c036 f2104 : version 4, 5 : Header length = 5 words (20B)00: service type = normal0028: total length =

    08b9: identification = 2233

    010 : flag

    0 000 offset = 0

    ff : time to live = 255

    06: protocol = 6 = TCP999a : check sum

    c0db ee2d: source IP =192.___.___.___

    c036 f210: destination IP = 192.___.___.___


    Lecture 3 tcp ip

    • Fragmentation moduleReceives IP datagram from the routing module, consults the MTU table to find MTU for the specific interface. If the datagram is larger than the MTU, then fragments the datagram, adds a header to each fragment and sends them to ARP package for address resolution and delivery.

    • Reassembly moduleReceives datagram from processing module, that arrives in the final destination, reassemblies the fragments back to original datagram by reassembly table (a linked list) and finally pass the whole datagram to the upper level protocol.


    Lecture 3 tcp ip

    Transmission Control Protocol

    • TCP is a connection-oriented, reliable protocol, transport layer protocol. It responsible for process-to-process communication. It is between a user application protocol and IP. TCP was first defined in RFC:793

    • What it does? It transfers packets between two processes in the two hosts. A data unit transferred between two processes is called a segment. It has 20-60 bytes header, followed by a data segment from the application program.

    • How is a process identified?A process is identified by a port number, which is set up when the process starts, and the IP address of its host.

      • A client process port number could be any number from 0 to 65535.

      • A sever side process port number is usually well-known.

      • The pair of IP address and the port number in either client or server is called a socket address.


    Lecture 3 tcp ip

    Source port 16 bits

    Destination port 16 bits

    Sequence of number 32 bits

    Acknowledge number 32 bits

    u

    r

    g

    a

    c

    l

    p

    s

    h

    r

    s

    t

    S

    y

    n

    F

    i

    n

    Window size 16 bits

    Reserved 4bits

    HLEN 4 bits

    Checksum 16 bits

    Urgent pointer 16 bits

    Options and Padding

    Data

    • What operations it provides?

      • Connections

      • Reliability

      • Flow control: using slide window technique

      • Multiplexing

      • Precedence and security

    • Segment syntax: header + data


    Lecture 3 tcp ip

    • Semantics of the header

      • Source port: chosen by client TCP process Destination port: well-known or chosen by the server TCP process

      • Sequence number: a random number generated to as the initial sequence number for the first byte of the data. Segment

      • Acknowledge number: if the receiver of the segment has successfully received byte number x from the other party, it defines x+1 as the acknowledge number.

      • Header length (HELN): The number of 4-byte words in the TCP header, can be between 20-60

      • Control field URG (urgent pointer is valid), ACK (=1, acknowledgement is valid) PSH: request for push RET: reset the connection SYN: synchronize the sequence number FIN: terminate the connection

      • Window size: the size of window in byte

      • Checksum: the similar to IP checksum.

      • Urgent pointer: work with urgent flag in control field.

      • Options: many


    Lecture 3 tcp ip

    • The communication between two processes is realized by setting up a logical connection between them

    • Connection establishment: three-way-handshaking

      1. Host A (client) sends a (SYN) segment to announce its whish for connection and includes its initialization info. (source and destination port number, ISN, window size) about the traffic from A to B.

      2. Host B (server) sends a (SYN and ACK) segment to acknowledge the request of A. And Host B sends a segment that includes its initialization info. (port number, window size) about the traffic from B to A.

      3. Host A sends a segment to acknowledge the request of B ( initial sequence number, server window size).

    • Connection termination: Four-way-handshaking1. Host A (client) sends a FIN segment to B.2. Host B (server) sends an ACK segment to acknowledge the request of A3 Host B sends a FIN segment to A 4. Host A sends an ACK segment to confirm the receipt of the FIN.


    Lecture 3 tcp ip

    • Reliability is achieved by sequence numbers, acknowledgments, and timer.

      • Acknowledgments

      • TCP timer

        Retransmission timer: when TCP sends a segment, it creates a retransmission timer for that particular segment. Two situation may occur: If an acknowledgement is received for this particular segment before the time goes off, the timer is destroyed. If the timer goes off before the acknowledgement arrives, the segment is retransmitted, and the timer is reset.

        The calculate of retransmission time: RT = 2 * RTT (the round-trip time) . RT = alpha * previous RRT + (1-alpha)*current RRT

    • Flow control: using slide window techniquesend k (window size) continuous segments, wait for ACK


    Lecture 3 tcp ip

    Main module

    Timer

    output processingmodule

    Input processingmodule

    • TCP implementation

      • The TCP/user interface provides for calls made by the user on the TCP to OPEN or CLOSE a connection, to SEND or RECEIVE data, or to obtain STATUS about a connection. These calls are like other calls from user programs on the operating system, for example, the calls to open, read from, and close a file.

      • The TCP/internet interface provides calls to send and receive datagram addressed to TCP modules in hosts anywhere in the internet system. These calls have parameters for passing the address, type of service, precedence, security, and other control information.

    Application layer message to and from applications

    TCP software

    TCB

    IP layer


    Lecture 3 tcp ip

    • TCB (Transmission Control Blocks) is used for each connection. An array of TCBs is kept for a group of connections.

    • TCP Modules:

      • Input processing module receives segment from the processing module, pass it to the main module

      • Main module, invoked by an arriving TCP segment, it does different things according state of TCB and the information in the segment header. It can be modeled as an FSM, actions are taken by cases of states

      • Output processing module


  • Login