13 tcpip and osi

Upload: muhammadrustam

Post on 05-Apr-2018

227 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 13 Tcpip and Osi

    1/72

    TCP/IP & OSI

    In OSI reference model terminology -theTCP/IP protocol suite covers the networkand transport layers.

    TCP/IP can be used on many data-linklayers (can support many networkhardware implementations).

  • 8/2/2019 13 Tcpip and Osi

    2/72

    Early protocol suite

    Universal

    Introduction to TCP/IPHost

    Internet

    TCP/IP

    Host

    Router Router

  • 8/2/2019 13 Tcpip and Osi

    3/72

    TCP/IP Protocol Stack

    7

    6

    5

    4

    3

    2

    5

    4

    3

    2

    Application

    Presentation

    Session

    Transport

    Network

    Data Link

    Physical1

    Application

    Transport

    Internet

    Data Link

    Physical

    1

    OSI DOD

  • 8/2/2019 13 Tcpip and Osi

    4/72

    Application Layer Overview

    Application

    Transport

    Internet

    Data Link

    Physical

    File Transfer- TFTP- FTP- NFS

    E-Mail- SMTP

    Remote Login- Telnet- rlogin

    Network Management- SNMP

    Name Management- DNS

  • 8/2/2019 13 Tcpip and Osi

    5/72

    Transport Layer Overview

    Transmission ControlProtocol (TCP)

    User DatagramProtocol (UDP)

    Application

    Transport

    Internet

    Data Link

    Physical

    Connection-Oriented

    Connectionless

  • 8/2/2019 13 Tcpip and Osi

    6/72

    TCP Segment Format

    Source port (16) Destination port (16)

    Sequence number (32)

    Headerlength (4)

    Acknowledgement number (32)

    Reserved (6) Code bits (6) Window (16)

    Checksum (16) Urgent (16)

    Options (0 or 32 if any)

    Data (varies)

    20Bytes

    Bit 0 Bit 15 Bit 16 Bit 31

  • 8/2/2019 13 Tcpip and Osi

    7/72

    Port Numbers

    TCP

    Port

    Numbers

    FTP

    TransportLayer

    TELNET

    DNS

    SNMP

    TFTP

    SMTP

    UDP

    ApplicationLayer

    21 23 25 53 69 161

    RIP

    520

  • 8/2/2019 13 Tcpip and Osi

    8/72

    TCP Port Numbers

    SourcePort

    Dest.Port

    Host A

    1028 23

    SP DP

    Host ZTelnet Z

    Dest. port = 23.

    Send packet to my

    Telnet

    application.

  • 8/2/2019 13 Tcpip and Osi

    9/72

    Send SYN(seq=100 ctl=SYN)

    SYN received

    Host A Host B

    TCP Three Way

    Handshake/Open Connection

    1

  • 8/2/2019 13 Tcpip and Osi

    10/72

    Send SYN(seq=100 ctl=SYN)

    SYN received

    Send SYN, ACK(seq=300 ack=101 ctl=syn,ack)

    Host A Host B

    SYN received

    1

    2

    TCP Three Way Handshake/Open

    Connection

  • 8/2/2019 13 Tcpip and Osi

    11/72

    Send SYN(seq=100 ctl=SYN)

    SYN received

    Send SYN, ACK(seq=300 ack=101 ctl=syn,ack)

    Established

    (seq=101 ack=301 ctl=ack)

    Host A Host B

    1

    2

    3

    SYN received

    TCP Three Way Handshake/OpenConnection

  • 8/2/2019 13 Tcpip and Osi

    12/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

  • 8/2/2019 13 Tcpip and Osi

    13/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

    Send 1Receive 1

  • 8/2/2019 13 Tcpip and Osi

    14/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

    Send 1Receive 1

    Receive ACK 2Send ACK 2

  • 8/2/2019 13 Tcpip and Osi

    15/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

    Send 1Receive 1

    Receive ACK 2Send ACK 2

    Send 2Receive 2

  • 8/2/2019 13 Tcpip and Osi

    16/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

    Send 1Receive 1

    Receive ACK 2Send ACK 2

    Send 2Receive 2

    Receive ACK 3Send ACK 3

  • 8/2/2019 13 Tcpip and Osi

    17/72

    TCP Simple Acknowledgment

    Window size = 1

    Sender Receiver

    Send 1Receive 1

    Receive ACK 2Send ACK 2

    Send 2Receive 2

    Receive ACK 3Send ACK 3

    Send 3 Receive 3

  • 8/2/2019 13 Tcpip and Osi

    18/72

    Window size = 1

    Sender Receiver

    Send 1Receive 1

    Receive ACK 2Send ACK 2

    Send 2Receive 2

    Receive ACK 3Send ACK 3

    Send 3 Receive 3

    Receive ACK 4 Send ACK 4

    TCP Simple Acknowledgment

  • 8/2/2019 13 Tcpip and Osi

    19/72

    TCP Sequence and

    Acknowledgment Numbers

    SourcePort

    Dest.Port

    Sequence#

    Acknowledgement#

    Source Dest. Seq. Ack.

    1028 23 10 1

    I just

    sent #10.

  • 8/2/2019 13 Tcpip and Osi

    20/72

    TCP Sequence and

    Acknowledgment Numbers

    I just got #10,now I need #11.

    SourcePort

    Dest.Port

    Sequence

    #Acknowledgement

    #

    1028 23

    Source Dest.

    10

    Seq.

    1

    Ack.

    102823Source Dest.

    11Seq.

    1Ack.

    I just

    sent #10.

  • 8/2/2019 13 Tcpip and Osi

    21/72

    TCP Sequence and

    Acknowledgment NumbersSource

    PortDest.Port

    Sequence

    #Acknowledgement

    #

    1028 23

    Source Dest.

    11

    Seq.

    2

    Ack.

    1028 23

    Source Dest.

    10

    Seq.

    1

    Ack.

    102823Source Dest.

    11Seq.

    1Ack.

    I just got #10,now I need #11.

    I just

    sent #11.

  • 8/2/2019 13 Tcpip and Osi

    22/72

    TCP Sequence and

    Acknowledgment NumbersSource

    PortDest.Port

    Sequence

    #Acknowledgement

    #

    1028 23

    Source Dest.

    11

    Seq.

    101

    Ack.

    1028 23

    Source Dest.

    10

    Seq.

    100

    Ack.

    102823Source Dest.

    11Seq.100

    Ack.

    102823

    Source Dest.

    12

    Seq.

    101

    Ack.

    I just got #11,now I need #12.

    I just

    sent #11.

  • 8/2/2019 13 Tcpip and Osi

    23/72

    TCP Windowing

    Sender Receiver

  • 8/2/2019 13 Tcpip and Osi

    24/72

    TCP Windowing

    Window size = 3

    Send 2

    Sender ReceiverWindow size = 3Send 1

    Window size = 3Send 3

  • 8/2/2019 13 Tcpip and Osi

    25/72

    Window size = 3

    Send 2

    TCP Windowing

    Sender Window size = 3Send 1

    Window size = 3Send 3

    ACK 3Window size = 2

    Packet 3 isDropped

    Receiver

  • 8/2/2019 13 Tcpip and Osi

    26/72

    Window size = 3

    Send 2

    TCP Windowing

    Sender Window size = 3Send 1

    Window size = 3Send 3

    ACK 3Window size = 2

    Packet 3 isDropped

    Window size = 3Send 4

    Window size = 3Send 3

    Receiver

  • 8/2/2019 13 Tcpip and Osi

    27/72

    Window size = 3

    Send 2

    TCP Windowing

    Sender Window size = 3Send 1

    Window size = 3Send 3

    ACK 3Window size = 2

    Packet 3 isDropped

    Window size = 3Send 4

    Window size = 3Send 3

    ACK 5Window size = 2

    ReceiverWindow size = 3

  • 8/2/2019 13 Tcpip and Osi

    28/72

    UDP

    DatagramDelivery

    Connectionless Unreliable

    Minimal

  • 8/2/2019 13 Tcpip and Osi

    29/72

    No sequence or acknowledgment fields

    UDP Segment Format

    Source port (16) Destination port (16)

    Length (16)

    Data (if any)

    1Bit 0 Bit 15 Bit 16 Bit 31

    Checksum (16)

    8Bytes

  • 8/2/2019 13 Tcpip and Osi

    30/72

    Internet Layer Overview

    OSI network layer corresponds to theTCP/IP internet layer

    Internet Protocol (IP)

    Internet Control MessageProtocol (ICMP)

    Address ResolutionProtocol (ARP)

    Reverse AddressResolution Protocol (RARP)

    Application

    Transport

    Internet

    Data Link

    Physical

  • 8/2/2019 13 Tcpip and Osi

    31/72

    IP Datagram

    Version(4)

    Destination IP Address (32)

    Options (0 or 32 if any)

    Data (varies if any)

    1Bit 0 Bit 15 Bit 16 Bit 31

    HeaderLength (4)

    Priority & Typeof Service (8)

    Total Length (16)

    Identification (16)Flags

    (3) Fragment offset (13)

    Time to live (8) Protocol (8) Header checksum (16)

    Source IP Address (32)

    20Bytes

  • 8/2/2019 13 Tcpip and Osi

    32/72

    Determines destination upper-layer protocol

    Protocol Field

    TransportLayer

    InternetLayer

    TCP UDP

    ProtocolNumbers

    IP

    176

  • 8/2/2019 13 Tcpip and Osi

    33/72

    Internet Control Message

    Protocol

    Application

    Transport

    Internet

    Data Link

    Physical

    Destination

    Unreachable

    Echo (Ping)

    Other

    ICMP

    1

  • 8/2/2019 13 Tcpip and Osi

    34/72

    Address Resolution Protocol

    172.16.3.1 172.16.3.2

    IP: 172.16.3.2 = ???

    I need the

    Ethernet

    address of

    176.16.3.2.

  • 8/2/2019 13 Tcpip and Osi

    35/72

    Address Resolution Protocol

    172.16.3.1 172.16.3.2

    IP: 172.16.3.2 = ???

    I heard that broadcast.

    The message is for me.

    Here is my Ethernet

    address.

    I need the

    Ethernet

    address of

    176.16.3.2.

  • 8/2/2019 13 Tcpip and Osi

    36/72

    Address Resolution Protocol

    172.16.3.1

    IP: 172.16.3.2Ethernet: 0800.0020.1111

    172.16.3.2

    IP: 172.16.3.2 = ???

    I heard that broadcast.

    The message is for me.

    Here is my Ethernet

    address.

    I need the

    Ethernet

    address of

    176.16.3.2.

  • 8/2/2019 13 Tcpip and Osi

    37/72

    Address Resolution Protocol

    Map IP MAC

    Local ARP

    172.16.3.1

    IP: 172.16.3.2Ethernet: 0800.0020.1111

    172.16.3.2

    IP: 172.16.3.2 = ???

    I heard that broadcast.

    The message is for me.

    Here is my Ethernet

    address.

    I need the

    Ethernet

    address of

    176.16.3.2.

  • 8/2/2019 13 Tcpip and Osi

    38/72

    Reverse ARP

    Ethernet: 0800.0020.1111 IP = ???

    What is

    my IP

    address?

  • 8/2/2019 13 Tcpip and Osi

    39/72

    Reverse ARP

    Ethernet: 0800.0020.1111 IP = ???

    What is

    my IP

    address?

    I heard that

    broadcast.

    Your IP

    address is

    172.16.3.25.

  • 8/2/2019 13 Tcpip and Osi

    40/72

    Reverse ARP

    Ethernet: 0800.0020.1111IP: 172.16.3.25

    Ethernet: 0800.0020.1111 IP = ???

    What is

    my IP

    address?

    I heard that

    broadcast.

    Your IP

    address is

    172.16.3.25.

  • 8/2/2019 13 Tcpip and Osi

    41/72

    Reverse ARP

    Map MAC IP

    Ethernet: 0800.0020.1111IP: 172.16.3.25

    Ethernet: 0800.0020.1111 IP = ???

    What is

    my IP

    address?

    I heard that

    broadcast.

    Your IP

    address is

    172.16.3.25.

  • 8/2/2019 13 Tcpip and Osi

    42/72

    Unique addressing allows communicationbetween end stations

    Path choice is based on destination address

    Location is represented by an address

    Introduction to TCP/IP Addresses

    172.18.0.2

    172.18.0.1

    172.17.0.2172.17.0.1

    172.16.0.2

    172.16.0.1

    SA DAHDR DATA10.13.0.0 192.168.1.0

    10.13.0.1 192.168.1.1

  • 8/2/2019 13 Tcpip and Osi

    43/72

    Internet Protocol

    The IP in TCP/IP IP is the network layer

    packet delivery service (host-to-host).

    translation between different data-linkprotocols.

  • 8/2/2019 13 Tcpip and Osi

    44/72

    IP Datagrams

    IP provides connectionless, unreliabledelivery of IP datagram.

    Connectionless: each datagram isindependent of all others.

    Unreliable:there is no guarantee thatdatagrams are delivered correctly or at all.

  • 8/2/2019 13 Tcpip and Osi

    45/72

    IP Addresses

    IP addresses are not thesame as the underlyingdata-link (MAC) addresses.

  • 8/2/2019 13 Tcpip and Osi

    46/72

    IP Addresses

    IP is a network layer - it must be capableof providing communication between hostson different kinds of networks (different

    data-link implementations).

    The address must include informationabout what networkthe receiving host is

    on. This makes routing feasible.

  • 8/2/2019 13 Tcpip and Osi

    47/72

    IP Addresses

    IP addresses are logicaladdresses (notphysical)

    32 bits. Includes a network ID and a host ID.

    Every host must have a unique IP address.

    IP addresses are assigned by a centralauthority (the NIC/IANA).

  • 8/2/2019 13 Tcpip and Osi

    48/72

    Format of IP address

    bbbbbbbb bbbbbbbb bbbbbbbb bbbbbbbb

  • 8/2/2019 13 Tcpip and Osi

    49/72

    The fourformats of IP Addresses

    0NetID

    10

    110 NetID

    1110 Multicast Address

    HostID

    NetID HostID

    HostID

    ClassA

    B

    C

    D

    8 bits 8 bits 8 bits8 bits

  • 8/2/2019 13 Tcpip and Osi

    50/72

    Class A

    128 possible network IDs over 4 million host IDs per networkID

    Class B

    16K possible network IDs

    64K host IDs per network ID

    Class C over 2 million possible network IDs

    about 256 host IDs per network ID

  • 8/2/2019 13 Tcpip and Osi

    51/72

    Network and Host IDs

    A Network ID is assigned to anorganization by a global authority.

    Host IDs are assigned locally by a systemadministrator.

    Both the Network ID and the Host ID areused for routing.

  • 8/2/2019 13 Tcpip and Osi

    52/72

    IP Addresses

    IP Addresses are usually shown in dotteddecimalnotation:

    1.2.3.4 00000001 00000010 00000011 00000100

    128.213.1.110000000 11010101 00000001 00000001

    This has a class B network

  • 8/2/2019 13 Tcpip and Osi

    53/72

    Host and Network Addresses

    A single network interface is assigned asingle IP address called the hostaddress.

    A host may have multiple interfaces, andtherefore multiple hostaddresses.

    Hosts that share a network all have thesame IP networkaddress (the network ID).

  • 8/2/2019 13 Tcpip and Osi

    54/72

    IP Broadcast and Network

    Addresses

    An IP broadcast addresses has a host ID ofall 1s.

    IP broadcasting is not necessarily a truebroadcast, it relies on the underlyinghardware technology.

    An IP address that has a host ID of all 0s iscalled a network addressand refers to anentire network.

  • 8/2/2019 13 Tcpip and Osi

    55/72

    Subnet Addresses

    An organization can subdivide its host

    address space into groups called subnets.

    The subnet ID is generally used to grouphosts based on the physical networktopology.

    10 NetID SubnetID HostID

  • 8/2/2019 13 Tcpip and Osi

    56/72

    Subnetting

    router

    Subnet 1128.213.1.x

    Subnet 2128.213.2.x

    Subnet 3128.213.3.x

  • 8/2/2019 13 Tcpip and Osi

    57/72

    Subnetting

    Subnets can simplify routing.

    IP subnet broadcasts have a hostID of all1s.

    It is possible to have a single wire networkwith multiple subnets.

  • 8/2/2019 13 Tcpip and Osi

    58/72

    Mapping IP Addresses to Hardware

    Addresses IP Addresses are not recognized by

    hardware.

    If we know the IP address of a host, howdo we find out the hardware address ?

    The process of finding the hardwareaddress of a host given the IP address iscalled

    Address Resolution

  • 8/2/2019 13 Tcpip and Osi

    59/72

    Reverse Address Resolution

    The process of finding out the IP addressof a host given a hardware address iscalled

    Reverse Address Resolution

    Reverse address resolution is needed bydiskless workstations when booting.

  • 8/2/2019 13 Tcpip and Osi

    60/72

    ARP

    The Address Resolution Protocolis usedby a sending host when it knows the IPaddress of the destination but needs the

    Ethernet address.

    ARP is a broadcast protocol - every hoston the network receives the request.

    Each host checks the request against its

    IP address - the right one responds.

  • 8/2/2019 13 Tcpip and Osi

    61/72

    ARP

    ARP does not need to be done every timean IP datagram is sent - hosts rememberthe hardware addresses of each other.

    Part of the ARP protocol specifies that thereceiving host should also remember theIP and hardware addresses of the sending

    host.

  • 8/2/2019 13 Tcpip and Osi

    62/72

    ARP

    HEY - Everyone please listen! Will 128.213.1.5please send me his/her Ethernet address

    not me

    Hi Red! Im 128.213.1.5, and my Ethernet

    address is 87:A2:15:35:02:C3

  • 8/2/2019 13 Tcpip and Osi

    63/72

    RARP

    HEY - Everyone please listen!My Ethernet address is22:BC:66:17:01:75.

    Does anyone know my IP address ?

    not me

    Hi Red ! Your IP address is 128.213.1.17.

  • 8/2/2019 13 Tcpip and Osi

    64/72

    Services provided by IP

    Connectionless Delivery (each datagramis treated individually).

    Unreliable (delivery is not guaranteed).

    Fragmentation / Reassembly (based onhardware MTU).

    Routing.

    Error detection.

  • 8/2/2019 13 Tcpip and Osi

    65/72

    IP Datagram

    VERS HL

    Fragment Offset

    Fragment LengthService

    Datagram ID FLAG

    TTL Protocol Header Checksum

    Source Address

    Destination Address

    Options (if any)

    Data

    1 byte1 byte 1 byte 1 byte

  • 8/2/2019 13 Tcpip and Osi

    66/72

    IP Datagram Fragmentation

    Each fragment (packet) has the samestructure as the IP datagram.

    IP specifies that datagram reassembly isdone only at the destination (not on a hop-by-hop basis).

    If any of the fragments are lost - the entire

    datagram is discarded (and an ICMPmessage is sent to the sender).

  • 8/2/2019 13 Tcpip and Osi

    67/72

    IP Datagram Fragmentation

    If packets arrive too fast - the receiverdiscards excessive packets and sends anICMP message to the sender (SOURCE

    QUENCH).

    If an error is found (header checksumproblem) the packet is discarded and an

    ICMP message is sent to the sender.

    ICMP

  • 8/2/2019 13 Tcpip and Osi

    68/72

    ICMPInternet Control Message Protocol

    ICMP is a protocol used for exchangingcontrol messages.

    ICMP uses IP to deliver messages.

    ICMP messages are usually generatedand processed by the IP software, not theuser process.

  • 8/2/2019 13 Tcpip and Osi

    69/72

    ICMP Message Types

    Echo Request

    Echo Response

    Destination Unreachable Redirect

    Time Exceeded

    Redirect (route change) there are more ...

  • 8/2/2019 13 Tcpip and Osi

    70/72

    TCP UDP

    IP

    Hardware

    Process Layer

    Transport Layer

    Network Layer

    Data-Link Layer

    Process Process

    ICMP, ARP

    &

    RARP

  • 8/2/2019 13 Tcpip and Osi

    71/72

    Network Services

    Support Any LAN & WAN architecture

    Ethernet, Token Ring, ATM, Frame-Relay,X.25 etc

  • 8/2/2019 13 Tcpip and Osi

    72/72

    TCP/IP Summary

    IP: network layer protocol

    unreliable datagram delivery between hosts.

    UDP: transport layer protocol unreliable datagram delivery between

    processes.

    TCP: transport layer protocol

    reliable, byte-stream delivery betweenprocesses.