Professor Department of Computer Science & Applications CONTENTS Transport layer : Addressing Services and Protocols TCP and UDP services & header formats Network layer in TCP/IP: Basiccharacteristics of IP protocol addressing and header format of IPv4 IPv6: Major goals& features
By Dr. Shuchita Upadhyaya Bhasin
TCP The Transmission Control Protocol: • Transmission Control Protocol (TCP) Guarantees delivery of IP datagrams; is a TCP/IP standard that is based Performs segmentation and reassembly of large on point-to-point communication blocks of data sent by programs; between two network hosts. Ensures proper sequencing and ordered delivery • TCP receives data from programs of segmented data; and processes this data as a stream Performs checks on the integrity of transmitted of bytes. data by using checksum calculations; • TCP provides a reliable, connection- Sends positive messages depending on whether data was received successfully by using selective oriented packet delivery service. acknowledgments, negative acknowledgments for data not received are also sent; • Additional functions specified by TCP are the same order delivery, Offers reliable session-based data transmission, such as client/server database and e-mail reliable delivery, and flow control. programs. • It allows a byte stream originating TCP also handles flow control to make sure a fast on one machine to be delivered sender cannot swamp a slow receiver with more without error on any other machine messages than it can handle. on the Internet. By Dr. Shuchita Upadhyaya Bhasin • Before two TCP hosts can exchange data, they When services send data using TCP, segments may arrive must first establish a session with each other. at their destination out of order. • A TCP session is initialized through a process For the original message to be understood by the known as a three-way handshake. recipient, the data in these segments is reassembled into • This process synchronizes sequence numbers the original order. and provides control information that is needed Sequence numbers are assigned in the header of each to establish a virtual connection between both packet to achieve this goal. hosts. During session setup, an initial sequence number (ISN) is • Once the initial three-way handshake completes, set. segments are sent and acknowledged in a sequential manner between both the sending This initial sequence number represents the starting and receiving hosts. value for the bytes for this session that will be transmitted to the receiving application. • A similar handshake process is used by TCP As data is transmitted during the session, the sequence before closing a connection to verify that both hosts are finished sending and receiving all data. number is incremented by the number of bytes that have been transmitted. • TCP segments are encapsulated and sent within The receiving TCP process places the data from a IP datagrams, as shown in the illustration. segment into a receiving buffer. Segments are placed in the proper sequence number order and passed to the Application layer when reassembled. Any segments that arrive with non-contiguous sequence numbers are held for later processing. Then, when the segments with the missing bytes arrive, these segments are processed By Dr. Shuchita Upadhyaya Bhasin • Confirming Receipt of Segments: One of TCP's functions is making sure that each segment reaches its destination. The TCP services on the destination host acknowledge the data that it has received to the source application. The segment header sequence number and acknowledgement number are used together to confirm receipt of the bytes of data contained in the segments. • Applications that use TCP are: Web Browsers, E-mail, File Transfers etc.
By Dr. Shuchita Upadhyaya Bhasin
By Dr. Shuchita Upadhyaya Bhasin Source port : 16 Bit number which identifies the Control Bit Flags : Control Bits govern the entire process of Source Port number (Sending Computer's TCP connection establishment, data transmissions and connection Port). termination. They are: Destination port : 16 Bit number which identifies URG : Urgent Pointer. the Destination Port number (Receiving Port). ACK : Acknowledgement. Sequence number : 32 Bit number used for byte PSH : When an application requests the TCP to push data, level numbering of TCP segments. If you are the TCP should send the data that has accumulated without using TCP, each byte of data is assigned a waiting to fill the segment. sequence number. If SYN flag is set ,then this is RST : Reset the connection.. A RESET causes both sides the initial sequence number. For example, let the immediately to release the connection and all its resources. first byte of data by a device in a particular TCP SYN : This flag means synchronize sequence numbers. Source header will have its sequence number in this field is beginning a new counting sequence. In other words, the TCP 50000. If this packet has 500 bytes of data in it, segment contains the sequence number of the first sent byte then the next packet sent by this device will have (ISN). the sequence number of 50000 + 500 + 1 = 50501. FIN : No more data from the sender. Acknowledgment Number : 32 Bit number field Window :Indicates the size of the receive window, which specifies which indicates the next sequence number that the number of bytes the receiver is currently willing to receive. the sending device is expecting from the other Checksum : The 16-bit checksum field is used for error-checking of device. the header and data. Header Length : 4 Bit field which shows the Urgent Pointer : Shows the end of the urgent data so that number of 32 Bit words in the header. Also known interrupted data streams can continue. When the URG bit is set, as the Data Offset field. Reserved : Always set to 0 the data is given priority over other data streams (Size 16 bits). (Size 6 bits). By Dr. Shuchita Upadhyaya Bhasin UDP • User Datagram Protocol (UDP) is used by some programs instead of TCP for fast, lightweight, unreliable transportation of data between TCP/IP hosts. • User Datagram Protocol (UDP) is a simple, unreliable, connectionless protocol for applications that do not want TCP’s sequencing or flow control and wish to provide their own. • UDP provides a connectionless datagram service that offers best-effort delivery, which means that UDP does not guarantee delivery Key application layer protocols that use UDP include: or verify sequencing for any datagrams. Domain Name System (DNS) • UDP has the advantage of providing for low overhead data delivery because it has a small Simple Network Management Protocol datagram header and no network (SNMP) management traffic. Dynamic Host Configuration Protocol • The pieces of communication in UDP are called (DHCP) datagrams. Routing Information Protocol (RIP) • Applications that use UDP include: Domain Trivial File Transfer Protocol (TFTP) Name System (DNS), Video Streaming, Voice Online games over IP (VoIP) etc. By Dr. Shuchita Upadhyaya Bhasin • Source Port : Source Port is 2 Byte long field used to identify port number of source. • Destination Port : It is 2 Byte long field, used to identify the port of destined packet. • Length : Length is the length of UDP including header and the data. Unlike TCP, Checksum calculation is not mandatory in It is 16-bits field. UDP. No Error control or flow control is provided by UDP. • Checksum : Checksum is 2 Bytes Hence UDP depends on IP and ICMP for error reporting. long field. It is the 16-bit one’s complement of the one’s complement sum of the UDP header
By Dr. Shuchita Upadhyaya Bhasin
Basic characteristics: IP • Connectionless - No connection is established before sending data packets. • Best Effort (unreliable) - No overhead is used to guarantee packet delivery. • Media Independent - Operates independently of the medium carrying the data.
IPv4 Packet Header
Packets in the IP layer are called datagrams. A datagram is a variable-length packet (up to 65,536 bytes) consisting of two parts: header and data. Best Effort Service of IP The header can be from 20 to 60 bytes and contains information essential to routing and delivery. An IPv4 protocol defines many different fields in the packet header. These fields contain binary values that the IPv4 services reference as they forward packets across the network.
Media independence: IP packets can travel over different media
By Dr. Shuchita Upadhyaya Bhasin IPv4 • Version (VER)-4bits: defines the version number of the IP packet so that revisions can be distinguished from each other. • Header length (HLEN)-4bits: The HLEN field defines the length of the header in multiples of four bytes. The four bits can represent a number between 0 and 15, which, when multiplied by 4, gives a maximum of 60 bytes. • Service or Type-of-Service (ToS)-8bits: The Type-of-Service field contains an 8-bit binary value that is used to determine the priority of each packet. This value enables a Quality-of-Service (QoS) mechanism to be applied to high priority packets, such as Flags-(3bits): The bits in the flags field deal with fragmentation those carrying telephony voice data. The router processing the (the datagram can or cannot be fragmented; can be the first, middle, packets can be configured to decide which packet it is to forward or last fragment; etc.). There is one unused bit and then two 1-bit first, based on the Type-of-Service value. fields: DF and MF. DF stands for Don’t fragment. It is an order to the routers not to fragment the datagram because the destination is • Total length-16bits: This field gives the entire packet size, incapable of putting the pieces back together again. MF stands for including header and data, in bytes. It is a two-byte field (16 bits) more fragments. All fragments except the last one have this bit set. It is needed to know when all fragments of a datagram have arrived. and can define up to 65,536 bytes. Fragmentation Offset-13bits: . The fragmentation offset is a pointer • Identification-16 bits: This field is used for uniquely identifying that shows the offset of the data in the original datagram (if it is fragments of an original IP packet. A datagram, when passing fragmented) i.e. where in the current datagram this fragment belongs. through different networks, may be divided into fragments to The fragment offset field identifies the order in which to place the match the network frame size. When this happens, each fragment packet fragment in the reconstruction. is identified with a sequence number in this field. All the fragments of a datagram contain the same Identification value. By Dr. Shuchita Upadhyaya Bhasin • Time-to-Live (TTL)-8bits: The time to live field Header checksum -16 bits: The checksum field is used for error checking of defines the number of hops a datagram can travel the packet header. The header checksum field verifies the integrity of the before it is discarded. The source host, when it header of the IP packet. The data part is not verified and is left to upper- creates the datagram, sets this field to an initial layer protocols. If the verification process fails, the packet is simply value. Then, as the datagram travels through the discarded. Internet, router by router, each router decrements Source IP Address – 32 bits: The source address field is a four-byte (32-bit) this value by 1. If this value becomes 0 before the Internet address. datagram reaches its final destination, the Destination IP Address – 32 bits: The destination address field is a four- datagram is discarded. byte (32-bit) Internet address. Options: The options field gives more functionality to the IP datagram. It • Protocol – 8 bits: This 8-bit binary value indicates can carry fields that control routing, timing, management, and alignment. the data payload type that the packet is carrying. The options field is rarely used. Currently five options are defined, but not The Protocol field enables the Network layer to all routers support all of them. pass the data to the appropriate upper-layer Option Description protocol. The protocol field defines which upper- Security Specifies how secret the datagram is layer protocol data are encapsulated in the Strict source Gives the complete path to be followed datagram (TCP, UDP, ICMP, etc.). The value of this routing field for each protocol is as shown: Loose source Gives a list of routers not to be missed Value Protocol routing 1 ICMP Record Makes each router append its IP address 2 IGMP Timestamp Makes each router append its address and timestamp 6 TCP No-Operation Used as filler between options (one byte). 17 UDP 89 OSPF End of Option One byte option used for padding at the end of option field. By Dr. Shuchita Upadhyaya Bhasin IPv4 Addressing
By Dr. Shuchita Upadhyaya Bhasin
IPv4 Addressing IP addresses in decimal notation Range of IP addresses classes
Ipv4 Address Classes
Class Theoretical Address Range Binary Start Used for
A 0.0.0.0 to 127.255.255.255 0 Very large networks
B 128.0.0.0 to 191.255.255.255 10 Medium networks
C 192.0.0.0 to 223.255.255.255 110 Small networks
D 224.0.0.0 to 239.255.255.255 1110 Multicast
E 240.0.0.0 to 247.255.255.255 1111 Experimental
By Dr. Shuchita Upadhyaya Bhasin IPv6 • The main driving force for the redesign of Major goals for a new version of IP were: Internet Protocol is the foreseeable IPv4 • Support of billions of hosts. address exhaustion. • IPv6 has a vastly larger address space than • Reduce size of routing tables. IPv4. • Simplify the protocol, to allow routers to • This results from the use of a 128-bit process packets faster. address, whereas IPv4 uses only 32 bits. • Provide better security than current IP. • The new address space thus supports 2128 • Pay more attention to type of service, (about 3.4×1038) addresses. This expansion particularly for real-time data. provides flexibility in allocating addresses • Aid multicasting by allowing scopes to be and routing traffic. specified. • Network security is integrated into the • Make it possible for a host to roam without design of the IPv6 architecture. changing its address. • Internet Protocol Security (IPsec) was • Allow the protocol to evolve in the future. originally developed for IPv6, but found widespread optional deployment first in • Permit the old and new protocols to coexist IPv4. The IPv6 specifications mandate IPsec for years. implementation as a fundamental interoperability requirement. By Dr. Shuchita Upadhyaya Bhasin IPv6 Simplified processing by routers Larger address space • The packet header in IPv6 is simpler than • The most important feature of that used in IPv4, with many rarely used IPv6 is a much larger address fields moved to separate options; space than that of IPv4: • IPv6 routers do not perform addresses in IPv6 are 128 bits fragmentation. IPv6 hosts are required to long, compared to 32-bit either perform end-to-end fragmentation, addresses in IPv4. or to send packets no larger than the IPv6 default minimum MTU(message transfer unit) size of 1280 octets. • The IPv6 header is not protected by a checksum;
By Dr. Shuchita Upadhyaya Bhasin
IPv6 Options extensibility • IPv4 has a fixed size (40 octets) of option parameters. • In IPv6, options are implemented as additional extension headers after the IPv6 header, which limits their size only by the size of an entire packet. • The extension header mechanism allows IPv6 to be easily 'extended' to support future services for QoS, security, mobility, etc. without a redesign of the basic protocol. • The extension headers are: Hop-by-Hop Option, Routing (Type 0), Fragment, Destination Option, Authentication, Encapsulation Payload.
By Dr. Shuchita Upadhyaya Bhasin
IPv6 Header format • Version (4 bit): Indicates the protocol version, and will thus contain the number 6. • Traffic Class (8 bit): This field is used by the source and routers to identify the packets belonging to the same traffic class and thus distinguish between packets with different priorities. • Flow label (20 bit): Label for a data flow. Used by a source to label those products for which it requests special handling by the IPv6 router. • Payload length (16 bit): Indicates the length of the packet data field. • Next header (8 bit): Identifies the type of header immediately following the IPv6 header. • Hop limit (8 bit): Decremented by one by each node that forwards the packet. When the hop limit field reaches zero, the packet is discarded. • Source address (128 bit): The address of the originator of the packet. • Destination address ( 128 bit) : The address of the intended recipient of the packet.
By Dr. Shuchita Upadhyaya Bhasin
• The IPv6 packet is composed of three main parts: the fixed header, optional extension headers and the payload. • The fixed header makes up the first 40 octets (320 bits) of an IPv6 data packet. The header contains the source and destination address, traffic classification options, a hop counter, and an indication of the next header. The Next Header field points to a chain of zero or more extension headers (chained by Next Header fields); the last Next Header field points to the upper-layer protocol that is carried in the packet's payload. • Extension headers carry options that are used for special treatment of a packet along the way or at its destination, routing, fragmenting, and for security using the IPsec framework. • Fragmentation is handled only in the sending host in IPv6: routers never fragment a packet. By Dr. Shuchita Upadhyaya Bhasin