520 likes | 725 Views
Chapter 7. Internet Protocol (IP). About IP(Internet Protocol): RFC 791 Unreliable/ Connectionless datagram protocol Best-effort delivery service : IP provides no error checking or tracking. If reliability is important, IP must be paired with a reliable protocol such as TCP.
E N D
Chapter 7 Internet Protocol(IP)
About IP(Internet Protocol): RFC 791 Unreliable/ Connectionless datagram protocol Best-effort delivery service: IP provides no error checking or tracking. If reliability is important, IP must be paired with a reliable protocol such as TCP. IP is designed for a packet switching network.: This means that each datagram is handled independently, and each datagram can follow a defferent route 7.1 DATAGRAM Packets in the IP layer are called datagrams A datagram is a consisting of two part: Header & Data 7.11 IP Header Size: 20~ 60 btyes It is customary in TCP/IP to show the header in four-byte(32bit) section IP(Internet Protocol)
Version (VER): Version of the IP protocol (4-bits), IPv4 Header length(HLEN): Total length of datagram header., 20 bytes(no option) Service type: 8 bit Precedence: 3 bit . Ranging from 9 (000 in binary) to 7 (111 in binary) . Defines the prioroty of the datagram in issues such as congestion. . At present, It is not used. TOS(Typr of Service): 4 bit Unused bit IP(Internet Protocol)
Type of Services IP(Internet Protocol)
Application programs can request a specific type of service Default Type of Services: IP(Internet Protocol)
Total length: Total length of IP datagram, Header plus Data(16-bit field) length of data = total length – header length IP datagram is limitedto 65535(216 –1)bytes => The Ethernet protocol has a minimum and maximum restriction on the size of data that can be encapsulated in frame (46 to 1500 bytes) If the size of an IP datagram is less than 46 bytes, some padding will be added to the meet this requirement. IP(Internet Protocol)
Figure 7-3 Encapsulation of a small datagram in an Ethernet frame
Identification: This field is used in fragmentation. Flags: This field is used in fragmentation. Fragmentation offset: This field is used in fragmentation Time to live : This field is used to control the maximum number of hops(routers) visited by the datagram. Protocol : (8 bit) This field specifies the final destination protocol to which the IP datagram should be delivered. protols IP(Internet Protocol)
Source address: This 32-bit field defines the IP address of the source. Destination address: This 32-bit field defines the IP address of the destination. 7.2 FRAGMENTATION Maximum Transfer Unit(MTU) Each data link layer protocol has its own frame format. When s datagram is encapsulated in a frame, the total size of the datagram must be less than this maximum size. The value of the MTU differs from one physical network protocol to another. We must devide the datagram to make it possible to pass through networks. This is called fragmentation. A datagram can be fragmented by the source host or any router in path. The reassembly of the datagram is done only by the destination host. IP(Internet Protocol)
IP(Internet Protocol) MTUs for defferent networks
Fields Related to Fragmentation Identification : This 16-bit field identifies a datagram originating from the source host. The identification number helps the destination in reassembling the datagram. Flags: (3-bit field), The first bit is reserved., The second bit is called the do not fragment bit. If its value is 1, the machine must not fragment the datagram. If its value is 0, the datagram can be fragmented if necessary. The third bit is called the more fragment bit. If its value is 1, it means the datagram is not the last fragment : there are more fragments after this one. If its value is 0, it means this is the last or only fragment. IP(Internet Protocol)
Fragmentation offset: (13-bit field), This field shows the relative position of this fragment with respect to the whole datagram. Figure 7.7 shows a datagram with a datagram are numbered 0 to 3,999. IP(Internet Protocol)
total length Figure 7-8 Detailed fragmentation example offset flag(more bit) Identification
7.3 OPTIONS The header of the IP datagram is made of two part: Fixed part: 20 bytes Variable part: Options, maximum 40 bytes. They areused for network testing and debugging. Option processing is a required part of the IP software Format:It is composed of a one-byte code field, a one-byte length field, a variable sized data field.. Code: 8bit, contains three subfields: copy, class, number Copy: 1-bit field Its value is 0: The option must be copied only to the first fragment. Its value is 1: The option must be copied to all fragments. Class: 2-bit field Its value is 00: The option is used for datagram control. Its value is 10: The option is used for debugging and management. Its value is 01, 11: not defined. Number: 5-bit field, defines the type of option IP(Internet Protocol)
7.3 OPTIONS…. Length: total length of option including the code field and the length field itself. Data: contains the data that specific options require. Option Types:6 options are currently being used. No Operation: 1-byte, used as a filler between options. End of Option: 1-byte, used for padding at the end of the option field. It can only be used as the last option. IP(Internet Protocol)
7.3 OPTIONS…. Option Types:6 options are currently being used. Rrecord Route: This is used to record the internet routers that handle the datagram. List up to nine router IP address. Maximum header size: 60 bytes. Basic header: 20 bytes. Option part: 40 bytes The source creates placeholder fields in the option to be field by the visited routers. In figure 7.13, The pointer field points to the first available entry. The source creates empty field for the IP address in the data field of the option. When the datagram leaves the source, all of the fields are empty. The pointer field has a value of four, pointing to the first empty field. Pointer > length Option is full, no changes Pointer < length The router inserts its outgoing IP address in the next empty field. then increments the value of the pointer by four. IP(Internet Protocol)
Figure 7-14 Record route concept Out going IP address
7.3 OPTIONS…. Option Types: Strict Source Route: This is used to by the source to predetermine a route for the datagram as it travels through the Internet. If a datagram specifies a strict source route, all of the routers defined in the option must be visited by the datagram. The format looks like the record route option with the exception that, in this case, all of the IP address are entered by the sender. Pointer > length The datagram has visited all of the predefined routers. Pointer < length Compares the IP address pointed by the pointer with its incoming IP address. Equal: It processes the datagram, overwrites the current IP address with its outgoing IP address, increments the pointer value by four, and forwards the datagram. Not equal: discards IP(Internet Protocol)
7.3 OPTIONS…. Option Types: Loose Source Route: Each router in the list must be visited, but the datagram can visit other routers as well. IP(Internet Protocol)
7.3 OPTIONS…. Option Types: Time stamp: This option is used to record the time of datagram processing by a router. The overflow field records the number of routers that could not add there timestamp because no more fields were available. The flags field specifies the visited router responsibilities. Flag value is 0 : each router adds only the timestamp in the provided field. Flag value is 1 : each router must add its outgoing IP address and the timestamp. Flag value is 3 : IP address are given, and each router must check the given IP address with its own incoming IP address. IP(Internet Protocol)
Figure 7-20 Timestamp concept Flag value 1
7.4 CHECKSUM Checksum: This is error detection method used by most TCP/IP protocols. It protects against the corruption that may occur during the transmission of a packet. It is calculated at the sender and the value obtained is sent with the packet. The receiver repeats the same calculation on the packet including the checksum. Checksum Calculation at the Sender The packet is divided into k section, each of n bits. All sections are added together using one’s complement arithmetic. The final result is complemented(changing all 0s to 1s and all 1s to 0s) to make the checksum. Checksum Calculation at the Receiver The packet is divided into k section, each of n bits. All sections are added together using one’s complement arithmetic. The result is complemented. If final result is 0, the packet is accepted; otherwise, it is rejected. IP(Internet Protocol)
7.4 CHECKSUM… Checksum in the IP Packet First, the value of the checksum field is set to 0. The entire header is divided into 16-bit sections and added together. The result(sum) is complemented and inserted into the checksum field. The checksum in the IP packet covers only the header. IP(Internet Protocol)
7.5 IP DESIGN IP package involves 8 components: A header-adding module, A processing module A routing module, a fragmentation module, a reassemble module A routing table, an MTU table, a reassembly table. Header-Adding Module Receive: data, destination address Encapsulate the data in an IP datagram Calculate the checksum and insert it in the checksum field. Send the data to the corresponding input queue. Return IP(Internet Protocol)
7.5 IP DESIGN.. Processing Module Remove one datagram from one of the input queues. If (destination address is 127.X.Y.Z or matches one of the local address) Send the datagram to the reassembly module. Return If (matches is a router) Decrement TTL. IF (TTL less than or equal to zero) Discard the datagram Send an ICMP error message. Return Send the datagram to the routing module. Return Queues Input queue: Store the datagrams coming from the data link layer or the upper-layer protocols.; The processing module dequeus(removes) the datagram. Output queue: Store the datagrams going to the data link layer or the upper-layer protocols.; The fragmentation and reassembly modules enqueues(add) the datagram IP(Internet Protocol)
7.5 IP DESIGN… Routing Module The routing module receives an IP packet from the processing module. If the packet is to be forward, It should be passed to this module. It finds the IP address oof the next station along with the interface number from which the packet should be sent. It then sends the packet with this information to the fragmentation module. MTU Table: The MTU table is used by the fragmentation module to find the maximum transfer unit of a particular interface. IP(Internet Protocol)
7.5 IP DESIGN… Fragmentation Module Receive: an IP packet from routing module Extract the size of the datagram. If (size > MTU of the corresponding network) If (D(do not fragment)bit is set) Discard the datagram Send an ICMP error message Return Else Calculate the maximum size. Divide the datagram into fragment. Add header to each fragment. Add required options to each fragment. Send the datagram. Return. Else Send the datagram. Return. IP(Internet Protocol)
7.5 IP DESIGN…. Reassembly Table Reassembly table is used to by the reassembly module Reassembly table has five fields: state, source IP address, datagram ID, time-out, and fragments. State field: FREE, or IN-USE IP address field: Source IP address of the datagram Time-out: predetermined amount of time in which all fragments must arrive. Fragments field: Pointer to a linked list of fragments. IP(Internet Protocol)