Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 4110 – Internetwork Programming IP Protocol. 2 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall Position of IP in TCP/IP Protocol Suite.

Similar presentations


Presentation on theme: "ECE 4110 – Internetwork Programming IP Protocol. 2 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall Position of IP in TCP/IP Protocol Suite."— Presentation transcript:

1 ECE 4110 – Internetwork Programming IP Protocol

2 2 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall Position of IP in TCP/IP Protocol Suite

3 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 3 Introduction Packets in IP are called datagrams. IP service is: Connectionless Unreliable Best-effort: No error checking or tracking. IP does its best to get the datagram to the destination with no guarantees.

4 4 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall IPv4 Datagram Format

5 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 5 IPv4 Header Network byte order (big endian) used. Fields: Version: 4 Header length: Number of 32-bit words in the header (5 without options) Service type: Discussed later. Total length: Total length of IP datagram in bytes (max 65535). Identification: Uniquely identifies each datagram sent by a host. Used for fragmentation and reassembly. Flags: Used for fragmentation. Fragmentation offset: Used for fragmentation. In 8-byte units. Time to live: Upper limit on number of hops. Often 32 or 64.

6 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 6 IPv4 Header (cont’d) Fields (cont’d): Protocol: Identifies which protocol gave data to IP. Checksum: Only for the header. Source address: 32-bit IP address. Destination address: 32-bit IP address. Options: Variable length list of options. Not all hosts/routers support all of them. Security and handling restrictions: For military applications. Record route: Have each router record its IP address Timestamp: Have each router record its IP address and time Loose source routing: List of IP addresses that must be traversed. Strict source routing: Similar to above, but only these addresses must be traversed.

7 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 7 Encapsulation of IP datagram in an Ethernet Frame

8 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 8 Multiplexing/Demultiplexing in Network Layer

9 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 9 Service Type

10 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 10 Service Type (cont’d) Also known as type of service. IETF recently changed the name (and the format) as differentiated services. Service Type: The precedence subfield is not used in IPv4. TOS bits: Minimize delay Maximize throughput Maximize reliability Minimize monetary cost Only one of TOS bits can be specified. Last bit is unused and must be zero.

11 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 11 Differentiated Services: Codepoint: When the 3 rightmost bits are all zero, the 3 leftmost bits show precedence. O/w, codepoint defines 64 services. Last 2 bits are unused. Service Type (cont’d) CategoryCodepointAssigning Authority 1XXXXX0Internet 2XXXX11Local 3XXXX01Temporary or experiemental

12 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 12 Fragmentation Each router decapsulates the IP datagram from the incoming frame and encapsulates into the outgoing frame. MTU: Maximum Transfer Unit

13 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 13 Fragmentation (cont’d) Though maximum IP datagram size is 65535, the data link layer imposes restrictions  fragmentation A fragmented datagram may be further fragmented if it crosses a network with smaller MTU. Reassembly is done only at the destination. Why?

14 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 14 Fragmentation (cont’d) IP fields related to fragmentation: Identification (16 bits): Provides uniqueness of each datagram. Copied into all fragments.

15 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 15 Fragmentation (cont’d) IP fields related to fragmentation: Flags (3 bits): First bit is reserved. If do not fragment bit is set, and datagram does not fit the frame, datagram is discarded and ICMP error message is sent. If more fragments bit is set, there are other fragments following.

16 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 16 Fragmentation (cont’d) IP fields related to fragmentation (cont’d): Fragmentation offset (13 bits): Offset of data in the original datagram. Specified in units of 8 bytes.

17 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 17 Fragmentation Example

18 18 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall Fragmentation Example (cont’d)

19 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 19 Fragmentation Example 1 A packet has arrived with an M bit value of 0. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?

20 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 20 Fragmentation Example 1 (sol’n) M bit is 0  No more fragments; This is the last fragment. However, we cannot say if the original packet was fragmented or not.

21 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 21 Fragmentation Example 2 A packet has arrived with an M bit value of 1. Is this the first fragment, the last fragment, or a middle fragment? Do we know if the packet was fragmented?

22 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 22 Fragmentation Example 2 (sol’n) M bit is 1  At least one more fragment. This fragment can be the first one or a middle one, but not the last one. We don’t know if it is the first one or a middle one; we need more information (the value of the fragmentation offset). However, we can definitely say the original packet has been fragmented because the M bit value is 1.

23 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 23 Fragmentation Example 3 A packet has arrived with an M bit value of 1 and a fragmentation offset value of zero. Is this the first fragment, the last fragment, or a middle fragment?

24 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 24 Fragmentation Example 3 (sol’n) M bit is 1  Either the first fragment or a middle one. Offset value is 0  it is the first fragment.

25 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 25 Fragmentation Example 4 A packet has arrived in which the offset value is 100. What is the number of the first byte? Do we know the number of the last byte?

26 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 26 Fragmentation Example 4 (sol’n) Multiply the offset value by 8  First byte number is 800. We cannot determine the number of the last byte unless we know the length of the data.

27 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 27 Fragmentation Example 5 A packet has arrived in which the offset value is 100, the value of HLEN is 5 and the value of the total length field is 100. What is the number of the first byte and the last byte?

28 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 28 Fragmentation Example 5 (sol’n) First byte number is 100  8 = 800. The total length is 100 bytes and the header length is 20 bytes (5  4)  80 bytes of data. If the first byte number is 800, the last byte number must 879.

29 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 29 IP Options

30 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 30 IP Options (cont’d)

31 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 31 IP Options (cont’d) No operation option:

32 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 32 IP Options (cont’d) End of option option:

33 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 33 IP Options (cont’d) Record route option:

34 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 34 Record Route Concept

35 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 35 IP Options (cont’d) Strict Source Route option:

36 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 36 Strict Source Route Concept

37 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 37 IP Options (cont’d) Loose Source Route option:

38 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 38 IP Options (cont’d) Timestamp option:

39 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 39 Use of Flag in Timestamp

40 Spring 2003 Tuna Tugcu ECE 4110 – Internetwork Programming 40 Timestamp Concept

41 41 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall IP Package


Download ppt "ECE 4110 – Internetwork Programming IP Protocol. 2 * From TCP/IP Protocol Suite, B. A. Forouzan, Prentice Hall Position of IP in TCP/IP Protocol Suite."

Similar presentations


Ads by Google