2. OSI and TCP IP

download 2. OSI and TCP IP

of 54

Transcript of 2. OSI and TCP IP

  • 8/6/2019 2. OSI and TCP IP

    1/54

    ALTTC/ BB Faculty 1

    TCP/IP Protocol Suite

  • 8/6/2019 2. OSI and TCP IP

    2/54

    ALTTC/ BB Faculty 2

    Objectives

    What is Internet?

    Comparison of TCP/IP & OSI

    Data Encapsulation

    TCP-IP Protocol Suite

    TCP/IP Protocol Documents

    TCP-IP Protocol Suite (IPv4 vs IPv6)

  • 8/6/2019 2. OSI and TCP IP

    3/54

    ALTTC/ BB Faculty 3

    What is Internet?

    Internet is network of networks, withdifferent hardware/software technologies

    Also known by the name TCP/IP Internet

    Name TCP/IP is taken from the names ofthe one of the transport layer protocols(Transport Control Protocol) and thenetwork layer protocol (Internet Protocol)

    TCP/IP is backbone of the Internet

  • 8/6/2019 2. OSI and TCP IP

    4/54

    ALTTC/ BB Faculty 4

    TCP/IP and OSI

    OSI is made of seven layers.

    TCP/IP protocol is made of five layers.

    PHYSICAL

    DATA LINK

    NETWORK

    TRANSPORT

    APPLICATION

    PHYSICAL

    DATA LINK

    NETWORK

    TRANSPORT

    SESSION

    PRESENTATION

    APPLICATION

    OSI Model TCP/IP Model

  • 8/6/2019 2. OSI and TCP IP

    5/54

    ALTTC/ BB Faculty 5

    Frame Head Trailer

    Frame

    Data Encapsulation

    Data

    Data

    Data

    TCP Header

    TCP SegmentUDP Header

    UDP Message

    TCP-UDP DataIP Header

    IP Datagram

    IP Header TCP-UDP Data

    Application

    TPT Layer

    NW Layer

    Data Link

  • 8/6/2019 2. OSI and TCP IP

    6/54

    ALTTC/ BB Faculty 6

    D

    P

    N

    T

    A

    TCP/IP Protocol Suite..

    ICMP IGMPRARPARP

    FTPSMTP

    TELNETHTTP

    TFTPNFS

    SNMPDNS

    TCP UDP

    IP

    Protocols defined bythe underlying networks

  • 8/6/2019 2. OSI and TCP IP

    7/54

    ALTTC/ BB Faculty 7

    Applications using TCP

    File Transfer Protocol (FTP) Provides the ability to upload and download files

    between hosts on the network.

    Simple Mail Transport Protocol (SMTP)

    Provides the ability to send mail between userson the network.

    TELNET Provides the ability to login into a remote host

    and administer the machine. Hyper Text Transfer Protocol (HTTP)

    Provides the ability to supply web pages betweena browser and the server.

  • 8/6/2019 2. OSI and TCP IP

    8/54

    ALTTC/ BB Faculty 8

    Applications using UDP

    Trivial File Transfer Protocol (TFTP) Provides simplex file transfer for network booting

    of devices.

    Network File System (NFS)

    Provides the ability for sharing directoriesbetween hosts on the network.

    Simple N/w Management Protocol (SNMP) Provides the ability to supply network

    management services on the network. Domain Name Service (DNS)

    Provides mapping between domain name and IPaddress and vice versa.

  • 8/6/2019 2. OSI and TCP IP

    9/54

    ALTTC/ BB Faculty 9

    TCP Details

    Provides application programs access to thenetwork using a reliable connection-orientedtransport layer service

    TCP sends and receives data reliably using

    sequence numbers and acknowledgments TCP is a byte oriented protocol i.e. every

    byte in each packet is assigned a sequencenumber

    Data stream handed over to TCP is called anunstructured stream

    TCP divides this data stream into segmentsfor transmission to remote network

  • 8/6/2019 2. OSI and TCP IP

    10/54

    ALTTC/ BB Faculty 10

    TCP Header..

    76543210765432107654321076543210

    ACKNOWLEDGEMENT NUMBER

    DESTINATIONPORTSOURCEPORT

    OPTIONS AND PADDING

    URGENT POINTERCHECKSUM

    WINDOW SIZEFIN

    SYN

    RST

    PSH

    ACK

    URG

    HELEN

    Octet +3Octet +2

    SEQUENCENUMBER

    Octet +1Octet +0

  • 8/6/2019 2. OSI and TCP IP

    11/54

    ALTTC/ BB Faculty 11

    TCP Header

    Source & Destination Port (16 Bits) Can run number of applications using same transport by

    multiplexing through port numbers

    Port numbers are used to identify a unique application in amachine

    65536 (0-65535) port numbers can be defined

    Theoretically it is possible to run 65535 simultaneousapplications in a host

    The first 1024 ports, port numbers 0-1023 known as wellknown port numbers, are assigned and are reserved for

    standard applications and are controlled by IANA

    The remaining ports, 1024-65535, are dynamic and canbe used freely by applications

    Source port is randomly generated by the source machine

  • 8/6/2019 2. OSI and TCP IP

    12/54

    ALTTC/ BB Faculty 12

    Well known port numbers

    Network Time Protocol123

    File Transfer-Data20

    File Transfer-Control21

    Telnet23

    SMTP25

    Domain Name Server53

    Trivial File Transfer69

    WWW80

    DESCRIPTIONPORT

    Border Gateway Protocol179

  • 8/6/2019 2. OSI and TCP IP

    13/54

    ALTTC/ BB Faculty 13

    TCP Header

    Sequence Number (32 Bits) Helps in establishing TCP connections, along with SYN bit,

    called as Three Way Handshake

    Helps in maintaining account of amount of data beingtransferred

    Identifies where the encapsulated data fits within a datastream from the sender

    Sequence number is incremented, in the system, every 4microsecond

    Acknowledgement Number (32 Bits)

    Helps in maintaining account of amount of data beingtransferred

    Identifies the sequence number expected from the otherend of data transmission unit

  • 8/6/2019 2. OSI and TCP IP

    14/54

    ALTTC/ BB Faculty 14

    Seq/Ack numbers relation

    During TCP Connection Establishment/Three way handshake

    Acknowledgement Number Sent = SequenceNumber Received+1

    During Data Transfer Acknowledgement Number Sent = Sequence

    Number Received + Data Received in Bytes

  • 8/6/2019 2. OSI and TCP IP

    15/54

    ALTTC/ BB Faculty 15

    Three-Way-Handshake

    ReceiverSender 0 1

    0-Closed; 1-Listen; 2-SYN-Sent; 3-SYN-Received; 4-Established

    AN-00000

    000B01

    SN-95426

    2

    AN- 95427000B11

    SN-16780 3

    AN-16781

    000B10

    SN-95427

    4

  • 8/6/2019 2. OSI and TCP IP

    16/54

    ALTTC/ BB Faculty 16

    Data Transfer

    AN- 95428

    100B10

    SN-16781

    5

    AN- 95427

    000B11

    SN-16780AN-00000

    000B01

    SN-95426

    AN-16781

    000B10

    SN-95427

    ReceiverSender

    0 1

    0-Closed; 1-Listen; 2-SYN-Sent; 3-SYN-Received; 4-Established; 5-Data Transfer

    23

    4

    AN-16881

    200B10

    SN-95428

    5

    AN- 95628

    150B10

    SN-16881

    5

    AN-17031

    250B10

    SN-95628

    5

    AN- 95878

    300B10

    SN-17031

    5

  • 8/6/2019 2. OSI and TCP IP

    17/54

    ALTTC/ BB Faculty 17

    Closing a TCP Connection

    ReceiverSender

    6-Finish; 0- Closed

    0 0

    6

    SN - 95880

    AN -17334

    0B110SN - 17334

    AN - 95881

    0B010

    WAITSN - 17334

    AN - 95881

    0 B110

    6

    SN - 95881AN -17334

    0B010

  • 8/6/2019 2. OSI and TCP IP

    18/54

    ALTTC/ BB Faculty 18

    TCP Header.

    Header Length (4 Bits) Sometimes called Data Offset

    Indicates the length of header in 32-bit words

    Identifies the beginning of data

    Typical value is 5 unless there are options Flags (6 Bits)

    Urgent (URG)

    Acknowledgement (ACK)

    Push (PSH) Reset (RST)

    Synchronisation (SYN)

    Finish (FIN)

  • 8/6/2019 2. OSI and TCP IP

    19/54

    ALTTC/ BB Faculty 19

    TCP Header..

    Window Size (16 Bits) Indicates the size of the sliding window

    Specifies the number of octets, starting with theoctet indicated by the acknowledgement

    number, that the sender of the segment willaccept from its peer at the other end of theconnection before the peer must stoptransmitting and wait for an acknowledgement

    A default window size is 4096 bytes Used for flow control by using Sliding window

    mechanism

  • 8/6/2019 2. OSI and TCP IP

    20/54

    ALTTC/ BB Faculty 20

    Flow Control

    Sender retains a copy of transmitted data until itreceives an acknowledgment from the remotenetwork.

    If no acknowledgment is received, within aspecified time, the data is retransmitted by using

    adaptive retransmission algorithm. TCP records the time of the transmission and sequence

    number of the segment.

    TCP again records the time of the acknowledgementreceived.

    Using this delta, TCP builds a sample round-trip delay timeand uses this to build an average time for a packet to besent and to receive an acknowledgement

    TCP will time out after a number of unsuccessfulretransmissions

  • 8/6/2019 2. OSI and TCP IP

    21/54

    ALTTC/ BB Faculty 21

    Sliding Window-Flow Control

    Moves to rightwhenack is received.

    Moves to rightwhen

    datais sent.

    Moves to right or leftto fix

    the size ofthe window.

    Window Size

    Sentand ack

    Sent but notack

    Can be sent

    Cant be sent

  • 8/6/2019 2. OSI and TCP IP

    22/54

    ALTTC/ BB Faculty 22

    TCP Header..

    Checksum(16 Bits) Used for error detection

    Covers both header and the encapsulated data

    Urgent Pointer(16 Bits) Used only when urgent flag is set Points to the last octet of urgent data

    Options One of the important options is MSS (Maximum

    Segment Size) Informs the receiver of the largest segment

    the sender is willing to accept, withoutcausing fragmentation

  • 8/6/2019 2. OSI and TCP IP

    23/54

    ALTTC/ BB Faculty 23

    TCP Header

    Padding Consists of 1-3 octets, each equal to zero, to

    force the length of TCP header to be in multiplesof four octets.

  • 8/6/2019 2. OSI and TCP IP

    24/54

    ALTTC/ BB Faculty 24

    UserDatagram Protocol

    Provides unreliable connectionless service Transfers data without establishing a

    session

    Used for services that have an inbuiltreliability

    Does not use end to end error checking andcorrection

    Does not order the packets; may loose orduplicate a packet

    Runs faster than TCP due to less overheads

  • 8/6/2019 2. OSI and TCP IP

    25/54

    ALTTC/ BB Faculty 25

    UDP Header..

    DESTINATIONPORTSOURCEPORT

    CHECKSUMMESSAGE LENGTH

    76543210765432107654321076543210

    Octet +3Octet +2Octet +1Octet +0

  • 8/6/2019 2. OSI and TCP IP

    26/54

    ALTTC/ BB Faculty 26

    UDP Header...

    Source Port (16 Bits) Identifies the sending process.

    Destination Port (16 Bits)

    Identifies the receiving process.

    Some fixed, pre-assigned port numbers used for serviceson the Internet.

    7 for UDP; 69 for TFTP

    Message length (16 Bits)

    Indicates the size of the UDP header and its data in bytes.

    Minimum size is 8, if carries no data.

    Checksum (16 Bits)

    Covers the UDP header and UDP data.

    Optional; If not used, set to all zeros.

  • 8/6/2019 2. OSI and TCP IP

    27/54

    ALTTC/ BB Faculty 27

    Internet Protocol.

    Provides best-effort or connectionlessdelivery service.

    No error checking or tracking

    If reliability is important, IP must be paired

    with a reliable protocol like TCP Transmits blocks of data called datagrams

    each of which is transported separately

    Responsible for IP addressing

    Datagrams may travel along different routesand may arrive out of sequence orduplicated.

  • 8/6/2019 2. OSI and TCP IP

    28/54

    ALTTC/ BB Faculty 28

    IP Header..

    HEADER CHECKSUMPROTOCOLTIME TO LIVE

    DESTINATION ADDRESS OF HOST

    SOURCE ADDRESS OF HOST

    PADDINGOPTIONS

    76543210765432107654321076543210

    FRAGMENT OFFSETMFDFIDENTIFICATION

    TOTAL LENGTHTOSHLENVER

    Octet +3Octet +2Octet +1Octet +0

  • 8/6/2019 2. OSI and TCP IP

    29/54

    ALTTC/ BB Faculty 29

    IP Header

    Version (4 Bits) Identifies the IP version to which the packet belongs

    Header Length (4 Bits)

    Indicates the length of IP header in 32 bit words.

    Minimum length is 20 octets. Options may increase the size up to a maximum of 24

    octets.

    Type of Service (8 Bits)

    Used for specifying special handling of packet.

    Has two sub-fields:

    Precedence

    TOS

  • 8/6/2019 2. OSI and TCP IP

    30/54

    ALTTC/ BB Faculty 30

    IP Header.

    0CRTDPPP

    Reliability

    0-Normal1-Maximise

    Precedence

    000-Routine001-Priority010-Immediate011-Flash100-Flash Override101-CRITIC/ECP110-Internetwork Control

    111-Network Control

    Delay

    0-Normal1-Minimise

    Throughput0-Normal

    1-Maximise

    Cost0-Normal

    1-Minimise

    Reserved:Always set to 0

    0 = No TOS0000000

  • 8/6/2019 2. OSI and TCP IP

    31/54

    ALTTC/ BB Faculty 31

    IP Header..

    Total Length (16 Bits) Specifies total length of the packet, including

    header, in octets

    Largest decimal number =216= 65535, themaximum possible size of an IP packet is 65535octets

    Total length - header length = Packets datapayload

    Identification (16 Bits) Each datagram is identified by a identification

    number set by the source.

    Normally incremented by 1 for each datagramsent.

  • 8/6/2019 2. OSI and TCP IP

    32/54

    ALTTC/ BB Faculty 32

    IP Header

    Flags (3 Bits) First bit is not used.

    Second bit is Dont Fragment (DF) bit

    Third bit if More Fragment (MF) bit

    Maximum Transmit Unit (MTU) is the size ofthe largest packet, including IP Header, thatcan be transmitted or received through adata link

    Default MTU is 576 bytes, which can behandled by any network withoutfragmentation

  • 8/6/2019 2. OSI and TCP IP

    33/54

    ALTTC/ BB Faculty 33

    IP Header

    Fragment Offset (13 Bits) The fragmentation occurs at the routers, if the

    original packet length exceeds the MTU of a datalink

    Used only in the cases when a datagram isfragmented on its way

    Specifies the offset, in units of eight octets, fromthe beginning of header to the beginning of the

    fragment Each fragment is marked, by router, with the

    same identifier number

  • 8/6/2019 2. OSI and TCP IP

    34/54

    ALTTC/ BB Faculty 34

    Fragmentation..

    172.16.2.0 172.16.3.0

    MTU-1500 MTU-1500MTU-576

    DataTCPIP

    1500 B

    DataTCPIP

    512 B

    Data

    512 B

    Data

    476 B

    DataTCPIP Data Data

    DataTCPIP

    IP IP IP

    DF=0; MF=1; Offset=0 DF=0; MF=1; Offset=64 DF=0; MF=0; Offset=128

  • 8/6/2019 2. OSI and TCP IP

    35/54

    ALTTC/ BB Faculty 35

    Fragmentation

    Only the receiver host reassembles thedatagram

    The destination machine starts areassembly timer for about 60-120 seconds.

    If not all fragments were received, thenhosts discard the packets and sends a timeexceeded ICMP message to the source

    machine If a single fragment is lost during a

    transmission, the entire packet must beresent

  • 8/6/2019 2. OSI and TCP IP

    36/54

    ALTTC/ BB Faculty 36

    IP Header

    Time to live-TTL (8 Bits) Assigns a life to an IP datagram

    Protocol (8 Bits)

    Specifies the protocol that runs on the top of IP.

    TCP-6; EGP-8; UDP-17; OSPF-89

    Header Checksum (16 Bits)

    Error detection field for IP header

    As each router decrements the TTL, thechecksum is calculated by each router

  • 8/6/2019 2. OSI and TCP IP

    37/54

    ALTTC/ BB Faculty 37

    IP Header.

    Source Address of Host (32 Bits) IP Address of the Originating Machine

    Destination Address of Host (32 Bits)

    IP Address of the Destination Machine

    Options Security:

    Specifies how secret the datagram is Strict Source Routing(SSR):

    Gives the complete path to be followed Loose Source Routing(LSR):

    Gives the list of routers not to be missed

  • 8/6/2019 2. OSI and TCP IP

    38/54

    ALTTC/ BB Faculty 38

    IP Header..

    Record Route: Makes each router to append its IP address.

    Time Stamp: Makes each router to append its IP address

    and time stamp.

    Padding

    Ensures that the header ends on a 32 bitboundary by adding zeros after the option field.

  • 8/6/2019 2. OSI and TCP IP

    39/54

    ALTTC/ BB Faculty 39

    Underlying Networks Protocols

    Ethernet Token Ring

    FDDI Fiber Distributed Data Interface

    HDLC High-level Data Link Control

    Frame Relay

    PPP Point-to-Point Protocol

    ATM Asynchronous Transfer Mode

  • 8/6/2019 2. OSI and TCP IP

    40/54

    ALTTC/ BB Faculty 40

    Socket Connection..

    Ports along with an IP address, known assocket connection, allow any application inany machine on an internet to be uniquelydefined.

    Multiple applications can run simultaneouslyon a host by making use of separate socketconnection for each application.

  • 8/6/2019 2. OSI and TCP IP

    41/54

    ALTTC/ BB Faculty 41

    Socket Connection-Multiplexing

    DATA

    DATA

    3753-53

    2764-21

    DATA

    DATA

    DATA 3753-53

    2764-21DATA

    A.B.C.D-E.F.G.H

    A.B.C.D-E.F.G.H

    A.B.C.D-E.F.G.HDATA 3753-53

    2764-21DATA A.B.C.D-E.F.G.H

    TRAILER

    TRAILER HEADER

    HEADER

    D

    P

    N

    T

    DNSFTP

    2764 3753

    TCP UDP

    IP

    A.B.C.D

    DNSFTP

    21 53

    TCP UDP

    E.F.G.H

    1. A.B.C.D(2764) E.F.G.H(21) 2. A.B.C.D(3753) E.F.G.H(53)

  • 8/6/2019 2. OSI and TCP IP

    42/54

    ALTTC/ BB Faculty 42

    Socket Connection-Demultiplexing

    DP

    N

    T

    DNSFTP

    2764 3753

    TCP UDP

    IP

    A.B.C.D

    DNSFTP

    21 53

    TCP UDP

    E.F.G.H

    53- 3753

    21- 2764

    DATA

    DATA

    DATA 53- 3753

    21- 2764DATA

    E.F.G.H-A.B.C.D

    E.F.G.H-A.B.C.D

    DATA

    DATA

    E.F.G.H-A.B.C.DDATA 53- 3753

    21- 2764DATA E.F.G.H-A.B.C.D

    TRAILER

    TRAILER HEADER

    HEADER

    1. A.B.C.D(2764) E.F.G.H(21) 2. A.B.C.D(3753) E.F.G.H(53)

  • 8/6/2019 2. OSI and TCP IP

    43/54

    ALTTC/ BB Faculty 43

    Internet Control Message Protocol

    Internet Control Message Protocol is amechanism used by hosts and routers tosend notification of datagram problems backto the sender.

    Sends error messages only to the sourceand not to intermediate routers.

    Sole function is to report problems, not tocorrect them.

    An important use of ICMP is echo/reply totest whether a destination is reachable andresponding.

  • 8/6/2019 2. OSI and TCP IP

    44/54

    ALTTC/ BB Faculty 44

    Internet Control Message Protocol

    Echo request/reply (PING; Packet INternetGropher)

    Destination unreachable

    0-Network unreachable

    1-Host unreachable

    2-Protocol unreachable

    3-Port unreachable

    4-Fragment needed but DF bit is set

    5-Source route failed

    6-Destination network unknown

  • 8/6/2019 2. OSI and TCP IP

    45/54

    ALTTC/ BB Faculty 45

    Internet Control Message Protocol

    7-Destination host unknown 8-Source host isolated

    9-Communication with destination networkadministratively prohibited

    10-Communication with destination hostadministratively prohibited

    11-Network unreachable for type of service

    12-Host unreachable for type of service

    Time exceeded message format 0-TTL exceeded

    1-Fragment reassembly time exceeded

  • 8/6/2019 2. OSI and TCP IP

    46/54

    ALTTC/ BB Faculty 46

    Internet Group Message Protocol

    Internet Group Message Protocol providesallows for multicast to operate on aninternetwork.

    Multicast is one-to-many communication.

    A message sent can be simultaneously receivedby a group of hosts.

    Special type of Class-D IP addresses,starting with 1110, are reserved as

    multicast addresses.

  • 8/6/2019 2. OSI and TCP IP

    47/54

    ALTTC/ BB Faculty 47

    Address Resolution Protocol

    Address Resolution Protocol is used totranslate 32 bits IP addresses to 48 bitsEthernet addresses.

    A hosts physical address is determined by

    broadcasting its IP address to all machines.

    The machine with matching IP address, inbroadcast message, sends its hardwareaddress to the machine originatingbroadcast.

  • 8/6/2019 2. OSI and TCP IP

    48/54

    ALTTC/ BB Faculty 48

    ARP Operation

    Request

    Ignored

    Request

    IgnoredARP

    Response

    Accepted

    Give me MAC address of129.1.1.4

    Thats

    Me

    Here is my MAC address

    129.1.1.1 129.1.1.4

    129.1.1.2 129.1.1.3

    08-00-39-00-2F-C3

    08-00-10-99-AC-54

    08-00-5A-21-A7-2208-00-39-00-2F-AB

  • 8/6/2019 2. OSI and TCP IP

    49/54

    ALTTC/ BB Faculty 49

    Reverse Address Resolution Protocol

    Reverse Address Resolution Protocol isused to get the 32 bits Source IPaddress, knowing the 48 bits Hardwareaddress.

    It is reverse of ARP, hence namedReverse Address Resolution Protocol.

    A diskless workstation broadcasts RARP-

    Request to find its IP Address at the timeof boot up.

  • 8/6/2019 2. OSI and TCP IP

    50/54

    ALTTC/ BB Faculty 50

    RARP Operation

    Give me my IP address RARP Response

    Diskless

    work

    station RARP

    Server

    08-00-39-00-2F-C3 08-00-10-99-AC-54

    08-00-5A-21-A7-22

    223.1.2.1

    223.1.2.2

    223.1.2.3

    08-00-39-00-2F-AB

  • 8/6/2019 2. OSI and TCP IP

    51/54

    ALTTC/ BB Faculty 51

    IPv4 vs IPv6

    Some independent protocols of version 4are part of ICMPv6.

    RARP protocol is dropped from the suite.

    ARP and IGMP are combined with ICMPv6.

    ICMP IGMP

    RARPARPIPv4

    ICMPIPv6

  • 8/6/2019 2. OSI and TCP IP

    52/54

    ALTTC/ BB Faculty 52

    IPv6 Base Header

    DESTINATION ADDRESS

    (128 Bits)

    SOURCE ADDRESS(128 Bits)

    PAYLOAD (0-65535 Bytes)

    (EXTENSIONHEADERS + DATA PACKETS FROMUPPERLAYERS)

    HOP LIMITNEXT HEADERPAYLOAD LENGTH

    FLOW LABELPRIVER

    76543210765432107654321076543210

    Octet +3Octet +2Octet +1Octet +0

  • 8/6/2019 2. OSI and TCP IP

    53/54

    ALTTC/ BB Faculty 53

    TCP/IP Protocol Documents

    TCP/IP technical documents are known asRequest For Comments (RFCs).

    Once issued, RFC do not change.

    Updated by new RFCs.

    RFCs can be obsoleted but their numbers arenever used again.

    A major source for RFCs is the InternetEngineering Task Force and are accessibleon site www.ietf.org

  • 8/6/2019 2. OSI and TCP IP

    54/54