IT2050 Computer Networks Lecture 5 Internet Protocol PDF
Document Details
Uploaded by HumbleRhenium4438
SLIIT
Hansika Mahaadikara
Tags
Summary
These lecture notes cover Internet Protocol (IP) within the broader context of computer networks. The document explains various aspects of IP, including fragmentation, time to live, and header structure.
Full Transcript
IT2050 - Computer Networks Lecture 5 Internet Protocol Ms. Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansik...
IT2050 - Computer Networks Lecture 5 Internet Protocol Ms. Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Overview of IP IP is the network layer protocol of TCP/IP No Error control, flow control and congestion control Hence IP is an unreliable protocol Combination TCP/IP is reliable But UDP/IP is an unreliable combination IP packets operate as datagram IP packets originated from same source can travel through different routes and reach the destination at different times Therefore IP packets may reach the destination out of order IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Identification Each IP packet is identified by a serial number called “Identification” This sequence will be helpful to the receiver to reassemble the packets in the correct order, although they may receive in out of order IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Maximum Transmission Unit (MTU) Maximum amount of data that can be accommodated in a frame IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation If the IP packet size is bigger than MTU, it should be fragmented Ex : If the original packet has 6000 bytes of data 1. Separate data and Header of IP Packet 2. Break data part into MTUs (Fragments) 3. Add 20 byte header to each fragment IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset The identification of each fragmented IP packet is equal to identification of original IP packet Ex : If the identification of original IP packet is 2000, identification of all five fragments is 2000 “ Fragmentation offset ” is an another parameter used to identity the order of fragments IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset cont. If the original packet has 6000 bytes of data , the numbering of data bytes are as follows Fragment 1 0 1479 Fragment 2 1480 2959 Fragment 3 2960 4439 Fragment 4 4440 5919 Fragment 5 5920 5999 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset cont. Offset value of fragment 1 = 0 = 0 8 Offset value of fragment 2 = 1480 = 185 8 Offset value of fragments 3 = 2960 = 370 8 Offset value of fragment 4 = 4440 = 555 8 Offset value of fragment 5 = 5920 = 740 8 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset cont. Fragmented packets travel independently They may travel through different routes to the destination While it is traveling it can be further fragmented at another intermediate network Original Packet Fragmented packets Fragmented packets IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset cont. Fragmented packets reach to the destination out of order. The fragmented packets are combined (defragmented) at the final destination by using the OFFSET values. IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Time To Live (TTL) IP packets travel through many routers in the network Each router routes the packet according to information in the routing table If there is a problem in a routing table the packet may be sent in a wrong direction and it can be randomly flow in the network. This kind of IP packets can even overload the network and finally crash the network In order to avoid such a situation, a parameter called “Time To Live” (TTL) is defined for each IP packet IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Time To Live (TTL) cont. TTL value can be initialized to any value at the transmitting router (A) (maximum is 255) The TTL value is decremented at each router by 1 If the TTL value becomes zero at a router (B) , the packet will be discarded and an ICMP message is sent to the transmitted router(A) from the discarding router (B) IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Time To Live (TTL) cont. Suppose host A sends an IP packet to Host B The TTL value is set to 6 If the packet goes through Host A → R1 →R2 → R3 → Host B, Router TTL Value R1 = 5 R2 = 4 R3 = 3 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Time To Live (TTL) cont. Suppose there is a routing problem and the packet loops through the routes R1 → R4 → R2 → R1→ R4 → R2 → R1 → R4 → R2 R1 R2 Router TTL Value Action R1 6 -1 = 5 R4 5–1=4 R4 R2 4–1=3 R1 3–1=2 R4 2–1=1 R2 1–1=0 Discards the Packet Send ICMP message to Host A The TTL value becomes zero at router R2 Therefore IP packet is discarded IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IP header 32 bits 32 bits 32 bits IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Version (VER) A field of 4 bits Indicates the version of the using IP addresses in the IP packet IPv4 : 0100 IPv6 : 0110 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Header Length (HLEN) A 4 bit field indicates the number of 4 bytes in the header Header size in bytes = HLEN x 4 The standard header size = 20 bytes 20 = 5 x 4 HLEN = 5 ( 0101 )2 The standard header size = 60 bytes 60 = 15 x 4 HLEN = 15 ( 1111 )2 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Service Type A 8 bit field IETF has changed the name of this field as Differentiated Services 3 bits 4 bits Precedence TOS Not used Precedence defines the priority of the packet Precedence is not used in IPv4 IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Service Type cont. A 4-bit field Each bit has a special meaning There are five types of services IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Service Type cont. The application can select a specific type of service IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Total length A 16-bit field Gives the total length of the IP packet. Total length = data length + header length If total length value is 300 and if this is a normal IP packet Header length = 20 bytes Data length = 300 – 20 = 280 bytes IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Identification Each IP packet is identified by a serial number called “Identification” A 16 bit field The identification of each fragmented IP packet is equal to identification of original IP packet IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Flags D = 1, means is not allowed to be fragmented D = 0, means is allowed to be fragmented M = 0, means that there are no more fragments; The fragment is the last one. Non fragmented packet is considered the last fragment M = 1, The fragment is not the last one. IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Fragmentation offset A 13-bit field This gives the offset value of the fragment IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Time To Live (TTL) A 8 bit field Defines the maximum number of hops the packet can travel IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Protocol The IP packet data can be UDP, TCP, ICMP, IGMP, EGP Used to identify the type of data a special field called “protocol” 8-bit field which defines the protocol number IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Header Checksum A 16-bit field Checks the errors of the header only. If errors are found in the header, the whole IP packet is discarded. IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara Source IP Address A 32-bit field This gives the IP address of the source Destination IP Address A 32-bit field This gives the IP address of the destination IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara IP option IT2050| Computer Networks| Internet Protocol| Hansika Mahaadikara