 Hello everyone, welcome to this session. In this session we will learn IP datagram. Learning outcomes at the end of this session student will be able to describe the position of IP protocol in TCP IP protocol suit and they will discuss the general format of an IP before datagram and the fields in the header. So let's start with the introduction to IP. The internet protocol is transmission mechanism used by TCP IP protocols. The position of IP in TCP IP protocol suit is explained by this architecture. This is TCP IP protocol suit which contains file layers. Start with the bottom, physical layer, data link layer, network layer, transport layer and the topmost layer is application layer. Here in this protocol suit physical layer and data link layer deals with the LAN or VAN technology. Network layer contains IGMP, ICMP, IP protocol and ARP protocol. Here IGMP stands for internet getaway message protocol. Then ICMP stands for internet control message protocol. IP is internet protocol and ARP is address resolution protocol. There is one more protocol that is RARP that is reverse address resolution protocol. On the top of the network layer there is transport layer which contains three important protocols SCTP, TCP and UDP. SCTP stands for stream control transmission protocol. TCP is transmission control protocol and UDP is a user datagram protocol. The topmost layer of TCP IP protocol suit is application layer which contains so many application layer protocols like SMTP, FTP, TFTP, DNS, SNMP, DSTP and so on. So let us start with the introduction to IP. IP is an unreliable and connectionless protocol. They are unreliable that means when the IP packets send then in the transmission that packet delivery is not guaranteed or there is no quality of a service. So if the reliability is concerned or if the reliability is important IP must be paired with a reliable protocol such as TCP. IP is also known as the best effort delivery service. So let me explain what is best effort delivery service. In transmission IP packets can be corrupted, lost, arrived out of order or delayed and may create the conjection for the network. But still IP provide up to some extent the best effort delivery service. The example of best effort delivery service is post office. Now what happen in post office? The post office does its best to deliver the mail but does not always succeed. If an unregistered later is lost or it is up to the sender or would be recipient to discover the loss and rectify the problem. The post office itself does not keep the track of every later and cannot notify a sender of loss or damage. So that's why though the post office provide the best effort service but it does not succeed up to some extent. Now let's see the another point of IP. IP is connectionless protocol for packet switching network. So connectionless means what? In connectionless delivery each datagram is handled independently and follow the different route to the destination. Datagram send by the same source to the same destination could arrive out of order. Also some could be lost or corrupted during the transmission. So IP rely on a higher level protocol to take care of all these problems. Let's see the datagram in IP. So packets in the IPv4 are called as datagrams. A datagram is a variable length packet consisting of two parts header and data. The length of the IP datagram is 65,535 bytes long. The header is 20 to 60 bytes in length and contain the information essential to routing. This diagram shows the total length of IP datagram that is 65,535 bytes and out of these bytes 20 to 60 bytes are reserved for header. Now let's see in the next section the header fields in detail. So this is the header of IP datagram which contains various fields like VER which stands for version which reserved the 4 bit. Next field is header length that is represented by H length. The next third field is service type then the next field is total length. Another field is identification then the flag field which reserved 3 bits then the fragmentation offset reserved 13 bits. Another field is time to leave protocol header checksum then the next fields are source IP address and destination IP address. Here there is one more field that is option plus padding but this field is optional field. Now let me explain the each and every field in detail. So let's start with the version field. This 4 bit field define the version of the IPv4 protocol currently the version is 4 that's why we called it as a IPv4 protocol. However, the version 6 or the IPv6 may totally replace the version 4 in the future. The next field is header length. This 4 bit field define the total length of the datagram header in 4 byte word. This field is needed because the length of the header is variable and it is in between 20 to 60 bytes. Now when the no option field is there or there is no option in the IP datagram the header length is only 20 bytes and the value of this field is 5 that is 5 multiplied by 4 equal to 20 bytes. When the option field is present or when the option field is at its maximum size the value of this field is 15 that is 15 into 4 equal to 60 bytes. The another most important field provided by the IP datagram header is service type. This field was referred to as a type of service previously. It defines how the data should be handled. This field now define a set of differential service. So here service type reserve total 8 bits out of this 8 bit 6 bits are reserved for code byte code point and the remaining 2 bits are reserved or these are unused. So let's see this service type in detail. So previously this service type is known as precedence independence and now it is known as differential service interpretation. So let's see first precedence service interpretation. So service type here the first 3 bits are called precedence bit. The next 4 bits are called type of service bits and the last bit is not used. Precedence is 3 bits of field ranging from 0 to 7. If we convert this into binary that means 0 0 0 to 1 1 1. The precedence defines the priority of the datagram in issues such as conjection. That means if the router is conjected and needs to discard some datagram the datagram with the lowest precedence are discarded first. Now in the precedence service the TOS is a 4 bits of field and each bit having the special meaning. So with this diagram the 4 bits are D, T, R and C. So each having a special meaning D means low delay, T is the high throughput, R is the high reliability and C is the low cost. So here this table defines how these bits are sets. When all these 4 bits are set to 0s then it is the normal type of service and by default it is normal. When it is set to 0 0 0 1 that means it shows the low cost. When it is set to 0 0 1 0 that means high reliability of a service. When it is 0 1 0 0 it is a high throughput and when it is 1 0 0 0 then it provides the low delay service. So this is about the precedence service. Now let us see the differential service in detail. First 6 bits make up the subfield code point and the last 2 bits are not used here. So differential service is used in 2 different ways. The first is when the 3 rightmost bits are 0s the 3 leftmost bits are interpreted as the same as the precedence bit in the service type interpretation. Just now I have explained it. Now when the 3 rightmost bits are not all 0s then the 6 bit define total 56 service based on the priority assignment by the internet or local authorities. So let us see the first category contain total 24 service types, the second and the third each contain total 16-16 services type. So the first category is assigned by the internet authorities, the second category can be used by the local authorities or we can say that the local organizations. Then the third category is temporary and can be used for exponential purposes. So this is all about the service type of IP datagram. Now pause the video and write down the answer of the above question. So the question is an IP packet has arrived with the first 8 bits as 0010, 0010 whether the received packet is discarded or accepted by receiver. Justify your answer. There is an error in this packet. The 4 leftmost bit that is 0010 shows the version which is incorrect. It should be 0100 that is 4 for IPv4 or 0110 for IPv6. The next 4 bit that is 0010 shows the wrong header length that is 2 x 4 equal to 8. The minimum number of bytes in the header must be 20. So the packet has been corrupted in transmission. Now the another important field is total length, 16-bit field that define the total length that is header and data of the IP datagram in bytes. So to find the length of the data coming from the upper layer, subtract the header length from the total length. So therefore the length of the data equal to total length minus header length. The header length can be found by multiplying the value in the header length field by 4. So let the first length or the field length is 16-bit, the total length of the IPv4 datagram is limited to 65,535 bytes of which the 20 to 60 bytes are the header and the rest is the data from the upper layer. The another fields are identification, flags, fragmentation, offset. So these fields are used in fragmentation. I will explain these 3 fields in detail in my next video. Another field is time to leave. This 8-bit field was designed to hold a timestamp. It is decremented by each visited router and the datagram was discarded when the value of this field become 0. The next field is protocol field. This 8-bit field define the higher level protocol that uses the services of IP layer. IP datagram contain the data from various protocols like TCP, UDP, ICMP and IGMP. Header checksum field is a 16-bit field used to check if the packet is received error free or not. Then the another fields are source IP address, destination IP address. Source IP address, this is a 32-bit field define the IPv4 address of a sender or a source. Another field is a 32-bit field of the IPv4 address of the receiver or the destination. Then the last field is option plus padding field. This optional field which is used if the value of the header length is greater than 5. This option may obtain the value for options such as security, record route, timestamp etc. So in this video we have seen about the various fields of IP datagram. These are the references. Thank you.