Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Kyung Hee University Chapter 8 Internet Protocol (IP)

Similar presentations


Presentation on theme: "1 Kyung Hee University Chapter 8 Internet Protocol (IP)"— Presentation transcript:

1 1 Kyung Hee University Chapter 8 Internet Protocol (IP)

2 2 Kyung Hee University Position of IP in TCP/IP protocol suite

3 3 Kyung Hee University Introduction  IP is the transmission mechanism used by the TCP/IP protocol It is unreliable and connectionless datagram protocol Providing Best-effort delivery service (best-effort : no error checking and tracking)

4 4 Kyung Hee University 8.1 Datagram  Packets in the IP layer : called datagrams  IP datagram format Variable-length packet consisting of header and data l Header – 20 ~ 60 bytes – Containing information that is essential for routing and delivery  IP header Version (VER) : Version 4 or 6 (IPng) Header length (HLEN) : represented by in 4 byte words l Ex) if HLEN = 5, the real header length is 20 bytes

5 5 Kyung Hee University Datagram (cont’d)

6 6 Kyung Hee University Datagram (cont’d) Service Type l Defining how the datagram should be handled by the routers l Precedence : 3 bits – Defining the priority of the datagram in issues such as congestion – Ex) a datagram for network management vs. optional information to a group of people – At present, not used in version 4 l service type : 4 bits (TOS bits) – With only one bit set at a time l Remaining bit : not used

7 7 Kyung Hee University Datagram (cont’d)  Service type or Differentiated Services

8 8 Kyung Hee University Datagram (cont’d) Types of service TOS bitsDescription 0000Normal 0001Minimize cost 0010Maximize reliability 0100Maximize throughput 1000Minimize delay

9 9 Kyung Hee University Datagram (cont’d) Default types for some applications in use of TOS ProtocolTOS bitsDescription ICMP0000Normal BOOTP0000Normal NNTP0001Minimize cost IGP0010Maximize reliability SNMP0010Maximize reliability TELNET1000Minimize delay FTP (data)0100Maximize throughput FTP (control)1000Minimize delay TFTP1000Minimize delay SMTP (command)1000Minimize delay SMTP (data)0100Maximize throughput DNS (UDP query)1000Minimize delay DNS (TCP query)0000Normal DNS (zone)0100Maximize throughput

10 10 Kyung Hee University Datagram (cont’d)  Differentiated Services The first 6 bits : codepoint subfield Values for codepoints CategoryCodepointAssigning Authority 1XXXXX0Internet 2XXXX11Local 3XXXX01Temporary or experiment

11 11 Kyung Hee University Datagram (cont’d) Total Length : head + data l Defining the total length of the datagram including the header l Length of data = total length – header length l Limited to 65,535 (2 16 – 1) bytes l Encapsulation of a small datagram in an Ethernet Frame Ethernet Frame size : 46 ~ 1500 bytes

12 12 Kyung Hee University Datagram (cont’d) Flags : used in fragmentation Fragmentation offset : used in fragmentation Time to live l Used to control the maximum number of hops (routers) visited by the datagram l If the value is Zero, the routers discarded l If the source wants to confine the packet to the local network, it can store 1 in this field

13 13 Kyung Hee University Datagram (cont’d) Protocol l Defining the higher level protocol that uses the services of the IP layer – TCP, UDP, ICMP, and IGMP – Multiplexing data from different higher level protocols ValueProtocol 1ICMP 2IGMP 6TCP 8EGP 17UDP 89 OSPF

14 14 Kyung Hee University Datagram (cont’d)  Example 1 -An arriving IP packet : 01000010  The receiver discards the packet, Why ? - 2 x 4 bytes = 8bytes : Minimum number of bytes in the header must be 20

15 15 Kyung Hee University Datagram (cont’d)  Example 2 The value of HLEN is 1000 in binary How many bytes of options are being carried by this packet ?  8 x 4 bytes = 32 bytes : 20 bytes + 12 bytes (option)

16 16 Kyung Hee University Datagram (cont’d)  Exampe 3 - In an IP packet, the value of HLEN is 5 16 and the value of the total length field is 0028 16. How many bytes of data are being carried by this packet? Answer The HLEN value is 5, which means the total number of bytes in the header is 5  4 or 20 bytes (no options). The total length is 40 bytes, which means the packet is carrying 20 bytes of data (40-20).

17 17 Kyung Hee University Datagram (cont’d)  Example 4 An IP packet has arrived with the first few hexadecimal digits as shown below:  45000028000100000102................... How many hops can this packet travel before being dropped? The data belong to what upper layer protocol?

18 18 Kyung Hee University Datagram (cont’d)  Answer To find the time-to-live field, we should skip 8 bytes (16 hexadecimal digits). The time-to-live field is the ninth byte, which is 01. This means the packet can travel only one hop. The protocol field is the next byte (02), which means that the upper layer protocol is IGMP.

19 19 Kyung Hee University Datagram (cont’d) Checksum : header checksum- 16 bits Source IP address : 32 bit-field Destination IP address : 32 bit-field

20 20 Kyung Hee University 8.2 Fragmentation  The format and size of the received frame depend on the protocol used by the physical network  Ex) A router connecting Ethernet to token ring

21 21 Kyung Hee University Fragmentation (cont’d)  MTU (Maximum Transfer Unit) When a datagram is encapsulated in a frame, the total size of the datagram must be less than this maximum size

22 22 Kyung Hee University Fragmentation (cont’d) MTUs for different networks ProtocolMTU Hyperchannel65,535 Token ring (16Mbps)17,914 Token ring (4Mbps)4,464 FDDI4,352 Ethernet1,500 X.25576 PPP296 Hyperchannel : Network Systems Corporation, 1988 (RFC 1044)

23 23 Kyung Hee University Fragmentation (cont’d) The maximum length of the IP datagram equals to the largest MTU defined so far (65,535 bytes) fragmentation Therefore, for the other physical networks we must divide the datagram : fragmentation datagram that can be fragmented by the source host or any router in the path, but the reassembly of datagram is done by the destination When a datagram is fragmented, required parts of the header must be copied by all fragments. l Changing the values of the three fields : flags, fragmentation offset, and total length l The rest of fields must be copied l Checksum must be recalculated

24 24 Kyung Hee University Fragmentation (cont’d)  Fields related to fragmentation Identification : 16 bit-field l Datagram id that is originated by the source host – Therefore, Source IP address + datagram id (identification) l All fragments having same identification number l Identification No. to be used for the destination in reassembling the datagram Flags : 3 bit-field l D : Do not fragment (1) – If it can not pass the datagram through any available physical network, it discards the datagram and send ICMP error message to the source host l M : More fragment (0) – 0 : last fragment or only fragment

25 25 Kyung Hee University Fragmentation (cont’d)  Fragmentation offset : 13-bit field Showing relative position of this fragment with respect to the whole datagram Measured in units of 8 bytes : forcing hosts or routers that fragment datagrams to choose the size of each fragment so that the first byte number is divisible by eight

26 26 Kyung Hee University Fragmentation (cont’d)

27 27 Kyung Hee University 8.3 Options  Variable part of the IP datagram : the maximum of 40 bytes  Format : Code, Length, and Data

28 28 Kyung Hee University Options (cont’d)  Code field 8 bits length and containing 3 subfields : copy, class, and number Copy l Controlling the presence of the option in fragmentation l 0 : meaning that option must be copied only to the first fragment l 1 : meaning the option must be copied to all fragments Class l Defining the general purpose of the option l 00 : datagram control, 01 : reserved, 10 : Debugging and management, 11: reserved

29 29 Kyung Hee University Options (cont’d) Number l Defining the type of the option : only 6 options that are currently being used  Length defining the total length of the option including the code field and length field itself  Data containing the data that specific options require

30 30 Kyung Hee University Options (cont’d)  Option Types

31 31 Kyung Hee University Options (cont’d) No Operation l one byte option used as a filler between options

32 32 Kyung Hee University Options (cont’d)  End of Option one-byte option used for padding at the end of the option field used as the last option

33 33 Kyung Hee University Options (cont’d)  Record Route used to record the internet routers that handle the datagram list up to 9 router IP addresses since the max. size of the header is 60 bytes (Base header : 20 bytes) pointer field l An offset integer field containing the byte number of the first empty entry (available entry) l When leaving the source, the pointer field has a value of four, pointing to the first empty field

34 34 Kyung Hee University Options (cont’d) Record route option

35 35 Kyung Hee University Options (cont’d)

36 36 Kyung Hee University Options (cont’d)  Strict Source Route used by the source to predetermine a route for the datagram as it travels through the Internet can choose a route with specific type of service : minimum delay or maximum throughput

37 37 Kyung Hee University Options (cont’d) Strict source route concept

38 38 Kyung Hee University Options (cont’d) Loose Source Route l similar to the strict source route, but it is more relaxed l each router in the list must be visited, but the datagram can visit other routers as well

39 39 Kyung Hee University Options (cont’d) Time Stamp l used to record the time of datagram processing by a router l expressed in millisecond from the midnight, Universal Time

40 40 Kyung Hee University Options (cont’d) overflow field : recording the number of routers that could not add their timestamp because no more fields were available Use of flag in timestamp

41 41 Kyung Hee University Options (cont’d) Timestamp concept (when flag =1)

42 42 Kyung Hee University 8.4 Checksum  Error detection method used by most TCP/IP protocols  Checksum calculation at the sender The packet is divided into k sections, each of n bits ( n is usually 16) All sections are added together using one’s complement arithmetic The final result is complemented to make the checksum

43 43 Kyung Hee University Checksum (cont’d)  Checksum calculation at the receiver The packet is divided into k sections, each of n bits. All sections are added together using one’s complement arithmetic The result is complemented If the final result is 0, the packet is accepted; otherwise it is rejected

44 44 Kyung Hee University Checksum (cont’d)  Checksum concept

45 45 Kyung Hee University Checksum (cont’d)  Checksum in one’s complement arithmetic

46 46 Kyung Hee University Checksum (cont’d)  Checksum in the IP Packet covering only the header, not the data l all higher level protocols that encapsulate data in the IP datagram have a checksum field that covers the whole packet l the header changes with each visited router, but data does not. So the checksum includes only the part which has changed l if each router must recalculates the checksum, it is needed to have the more processing time for each router

47 47 Kyung Hee University Checksum (cont’d)  Example

48 48 Kyung Hee University 8.5 IP Package  IP package : 8 components Header-adding module Processing module Routing module fragmentation module reassembly module routing table MTU table reassembly table

49 49 Kyung Hee University IP Package (cont’d)  IP components

50 50 Kyung Hee University IP Package(cont’d)  The operation of IP package receiving an IP packet, either from the data link layer or a higher level protocol if the packet comes from a upper layer protocol, it should be delivered to the data link layer if the packet comes from the data link layer, forwarding to data link or a upper layer ( the destination is same as the station address)

51 51 Kyung Hee University IP Package (cont’d)  Header-adding Module Receive : data, destination address 1.Encapsulate the data in an IP datagram 2.Calculate the checksum and insert it in the checksum field 3.Send the data to the corresponding input queue 4.Return

52 52 Kyung Hee University IP Package (cont’d)  Processing Module 1. Remove one datagram from one of the input queues 2. if (destination address is 127.X.Y.Z or matches one of the local addresses) 1. Send datagram to the reassembly module. 2. Return 3. if (machine is a router) 1. Decrement TTL 4. if (TTL less than or equal to zero) 1. Discard the datagram 2. Send an ICMP error message 3. Return 5. Send the datagram to the routing module 6. Return

53 53 Kyung Hee University IP Package (cont’d)  Queues Input queues and output queues  Routing table used by the routing module to determine the next- hop address of the packet  Routing module receiving an IP packet from the processing module sending the packet with the information to the fragmentation module

54 54 Kyung Hee University IP Package (cont’d)  MTU Table to find the maximum transfer unit of a particular interface.

55 55 Kyung Hee University IP Package (cont’d)  Fragmentation Module Receive : an IP packet from routing module 1.Extract the size of the datagram 2.if (size > MTU of the corresponding network) 1.If (D (do not fragment) bit is set 1. Discard the datagram 2. Send an ICMP error message 3. Return 2.Else 1. Calculate the maximum size 2. Divide the datagram into fragments 3. Add header to each fragment 4. Add required options to each fragment 5. Send the datagram 6. Return 3.Else 1. Send the datagram 4.Return

56 56 Kyung Hee University IP Package (cont’d)  Reassembly Table State field : FREE or IN-USE Source IP address of datagram Datagram ID Time-out : a predetermined amount of time in which all fragments must arrive Fragment field : a pointer to a linked list of fragments

57 57 Kyung Hee University IP Package (cont’d)

58 58 Kyung Hee University IP Package (cont’d)  Reassembly Module Receive : an IP packet from the processing module 1.If (offset value is zero and the M bit is 0) 1. Send the datagram to the appropriate queue 2. Return 2. Search the reassembly table for the corresponding entry 3. If (not found) 1. Create a new entry

59 59 Kyung Hee University IP Package (cont’d) 4. Insert the fragment at the appropriate place in the linked list 1. if (all fragments have arrived) 1. Reassemble the fragments 2. Deliver the datagram to the corresponding upper layer protocol 3. Return 2. Else 1. Check the time-out 2. if (time-out expired) 1. Discard all fragment 2. Send an ICMP error message 5. Return


Download ppt "1 Kyung Hee University Chapter 8 Internet Protocol (IP)"

Similar presentations


Ads by Google