Presentation is loading. Please wait.

Presentation is loading. Please wait.

NET 323D: Networks Protocols

Similar presentations


Presentation on theme: "NET 323D: Networks Protocols"— Presentation transcript:

1 NET 323D: Networks Protocols
Networks and Communication Department Lecture 3: IPv4

2 Topics discussed in this section:
IPv4 The Internet Protocol version 4 (IPv4) is the current and common delivery mechanism used by the TCP/IP protocols. Topics discussed in this section: Datagram Fragmentation Checksum Options

3 The Internet Protocol version 4 (IPv4)
The Internet Protocol version 4 (IPv4) is the current and common delivery mechanism used by the TCP/IP protocols. IPv4 is an unreliable connectionless protocol responsible for source-to-destination delivery. Packets in IPv4 layer are known as Datagram which consists of two parts: a header and data (payload). The length of the header is 20 – 60 bytes and it contains essential information for routing and packet delivery. The position of IPv4 in TCP/IP protocol suit and its datagram format are shown in Figure 20.4 and respectively

4 Internet Protocol (IPv4)
It is a layer 3 protocol Host-to-host network layer delivery protocol for the internet. It is unreliable and connectionless protocol. No error control. No flow control. It has error detection (discard) If reliability is of concern, the IP has to be tied to a connection-oriented protocol (i.e. TCP) In reality, each packet (datagram) is handled independently: Each packet can follow different rout to destination. Thus, Packets may arrive out of order, dropped and/or lost.  IP relies on higher level protocols to take care of all these problems.

5 Figure 20.5 IPv4 datagram format
Packets in the IPv4 layer are called datagrams. Figure 20.5 shows the IPv4 datagram format. A datagram is a variable-length packet consisting of two parts: header and data. Figure IPv4 datagram format

6 Internet Protocol (IPv4): Header Format
Field Length Description Version 4 bit Identifies the version of IP used to generate the datagram HLEN Specifies the length of the IP header, including the length of any options and padding. The normal value of this field when no options are used is (20 bytes) value must be multiplied by 4 to give the length in bytes Service (TOS) 8 bit Type of Service (TOS): A field designed to carry information to provide quality of service features, such as prioritized delivery, for IP datagram. Total Length (TL) 16 bit Specifies the total length of the IP datagram, in bytes. Since this field is 16 bits, the maximum length of an IP datagram is 65,535 bytes (2^16 – 1) of which byte is the header. Identification This field is used by the receiver to reassemble messages without mixing fragments from different messages. Flags 3 bit Control flags to manage fragmentation Fragmentation offset 13 bit This field specifies the offset, or position, in the overall message where the data in this fragment goes. Time to live (TTL) 8 bits Specifies how long the datagram is allowed to “live” on the network, in terms of router hops. Each router decrements the value of the TTL by one prior to transmitting it. If the TTL =0, the datagram is discarded.

7 Internet Protocol (IPv4): Header Format
Field Length Description Protocol 8 bit Identifies the higher layers protocols (transport or encapsulated network layer protocols) carried in the datagram Header checksum 16 A checksum computed over the header to provide basic protection against corruption in transmission Source address 32 bit The 32-bit IP address of the originator of the datagram (intermediate device will not change it) Destination address The 32-bit IP address of the intended recipient of the datagram. (intermediate device will not change it) options var One or more of several types of options may be included after the standard headers in certain IP datagram

8 length of data = total length - header
Note The total length field defines the total length of the datagram including the header. Since the field length is 16 bits, the total length (header + data) is bytes. 20 to 60 bytes are used as header. Thus, length of data = total length - header

9 Example 20.1 An IPv4 packet has arrived with the first 8 bits as shown: The receiver discards the packet. Why? Solution There is an error in this packet. The 4 leftmost bits (0100) show the version, which is correct. The next 4 bits (0010) show an invalid header length (2 × 4 = 8). The minimum number of bytes in the header must be 20. The packet has been corrupted in transmission.

10 Figure 20.9 Maximum transfer unit (MTU)
Table MTUs for some networks

11 Advantages of a large MTU:
■ Good for transferring large amounts of data over long distances ■ No fragmentation necessary; faster delivery and no reassembly ■ Fewer lost datagrams ■ More efficient (less overhead) Advantages of a small MTU: ■ Good for transferring time-sensitive data such as audio or video ■ Better suited for multiplexing 18-Jul-19 Networks and Communication Department

12 Figure 20.10 Flags used in fragmentation
Figure Fragmentation example Fragmentation is the division of a datagram into smaller units to accommodate the MTU of a data link protocol.

13 Figure 20.12 Detailed fragmentation example

14 Example 20.5 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.

15 Example 20.6 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? Solution If the M bit is 1, it means that there is 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).

16 Example 20.7 A packet has arrived with an M bit value of 1 and a fragmentation offset value of 0. Is this the first fragment, the last fragment, or a middle fragment? Solution 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.

17 Example 20.8 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? Solution 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.

18 Example 20.9 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 are the numbers 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.


Download ppt "NET 323D: Networks Protocols"

Similar presentations


Ads by Google