00:00

Understanding IP Datagram in Computer Networks

IP datagram is a fundamental unit in the IP layer of computer networks. It consists of a header and data, with key fields like version, header length, total length, time-to-live, and protocol. Learn about datagram structure, fields, packet errors, fragmentation, and more in this comprehensive overview.

olaran
Download Presentation

Understanding IP Datagram in Computer Networks

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Network IP Datagram

  2. Datagram A packet in the IP layer is called a datagram, a variable-length packet consisting of two parts: header and data. The header is 20 to 60 bytes in length and contains information essential to routing and delivery. • Some of the fields: • VER - version numbers, 4 and 6 • HLEN - header length in 4-byte words. Value of 5 means 20 byte header 2

  3. IP Datagram Fields Differentiated Services 3

  4. IP Datagram Fields Total Length The total length field defines the total length of the datagram including the header. Total length field is 16 bits, or 65,535 bytes of which 20 to 60 bytes are the header. Time to Live Time to Live - 8-bit field, so Time to Live can be set to 255.As it passes through a router, the router decrements the counter. When counter hits 0, the datagram is deleted and ICMP sends an error message back to the source. The Protocol field A 8 bit identifies the upper layer protocol that is using IP for transmission of its data. 4

  5. Exercise Problem An IP packet has arrived with the first 8 bits as shown 01000010 The receiver discards the packet. Why ? Sol There is an error in this packet. The 4 left-most bits (0100) show the version, which is correct. The next 4 bits (0010) show the header length; which means (2 × 4 = 8), which is wrong. The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission. 5

  6. Exercise Problem In an IP packet, the value of HLEN is 1000 in binary. How many bytes of options are being carried by this packet ? Sol: The HLEN value is 8, which means the total number of bytes in the header is 8 × 4 or 32 bytes. The first 20 bytes are the base header, the next 12 bytes are the options. 6

  7. Exercise Problem In an IP packet, the value of HLEN is 516 and the value of the total length field is 002816 . How many bytes of data are being carried by this packet? Solution 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). 7

  8. Drill Problem 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? Sol To find the time-to-live field, we 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 8

  9. Fragmentation The format and size of a frame depend on the protocol used by the physical network. A datagram may have to be fragmented to fit the protocol regulations. 9

  10. Flags • A datagram can be fragmented by the source host or any router in the path. Reassembly is done only by the destination host. • Most fields are copied from one fragment to the next. The 3 fields that are not copied are the flags, fragmentation offset, and the total length. The Identification field is copied from one fragment to the next. • The Do Not Fragment bit is set to 1 if the network is not supposed to fragment this datagram. (If it has to be fragmented, it is tossed.) • The More Fragments bit is set to 1 if there are more fragments 10

  11. Fragmentation Offset The Fragmentation Offset tells what position this fragment is in the whole stream. The offset counts by 8. So if a fragment is supposed to start at byte 400, the offset equals 50. 11

  12. Drills • 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? Solution If the M bit is 0, it means that there are no more fragments; the fragment is the last one. However, we cannot say if the original packet was fragmented or not. A non- fragmented packet is considered the last fragment. 12

  13. Drills • 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 Because the M bit is 1, it is either the first fragment or a middle one. Because the offset value is 0, it is the first fragment. 13

  14. Drills 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? To find the number of the first byte, we multiply the offset value by 8. This means that the first byte number is 800. We cannot determine the number of the last byte unless we know the length of the data. 14

  15. 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? Solution The first byte number is 100 × 8 = 800. The total length is 100 bytes and the header length is 20 bytes (5 × 4), which means that there are 80 bytes in this datagram. If the first byte number is 800, the last byte number must be 879. 15

  16. Practice Questions Q1. In IPv4, what is the length of the data field given an HLEN value of 12 and total length value of 40,000? Q2. An IP router with a Maximum Transmission Unit (MTU) of 1500 bytes has received an IP packet of size 4404 bytes with an IP header of length 20 bytes. Find out the values of the relevant fields in the header of the third IP fragment generated by the router for this packet? 16

  17. • Sol 1: MTU = 100 bytes Size of IP header = 20 bytes So, size of data that can be transmitted in one fragment = 100 – 20 = 80 bytes Size of data to be transmitted = Size of datagram – size of header = 1000 – 20 = 980 bytes Now, we have a datagram of size 1000 bytes. So, we need ceil(980/80) = 13 fragments. • Sol 2: 39,952 17

More Related