Professor Department of Computer Science & Applications CONTEN Transport layer : TS 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 TCP The Transmission Control Protocol: • Transmission Control Protocol (TCP) Guarantees delivery of IP datagrams; is a TCP/IP standard that is based on point-to-point communication Performs segmentation and reassembly of large between two network hosts. blocks of data sent by programs; • TCP receives data from programs Ensures proper sequencing and ordered delivery of and processes this data as a stream segmented data; of bytes. Performs checks on the integrity of transmitted data by using checksum calculations; • TCP provides a reliable, connection- oriented packet delivery service. Sends positive messages depending on whether data was received successfully by using selective • Additional functions specified by acknowledgments, negative acknowledgments for TCP are the same order delivery, data not received are also sent; reliable delivery, and flow control. Offers reliable session-based data transmission, • It allows a byte stream originating such as client/server database and e-mail programs. on one machine to be delivered TCP also handles flow control to make sure a fast without error on any other machine sender cannot swamp a slow receiver with more on the Internet. messages than it can handle. • Before two TCP hosts can exchange data, When services send data using TCP, segments may arrive at they must first establish a session with each their destination out of order. other. For the original message to be understood by the recipient, the data in these segments is reassembled into the original • A TCP session is initialized through a process order. known as a three-way handshake. Sequence numbers are assigned in the header of each • This process synchronizes sequence packet to achieve this goal. numbers and provides control information During session setup, an initial sequence number (ISN) is that is needed to establish a virtual set. connection between both hosts. This initial sequence number represents the starting value • Once the initial three-way handshake for the bytes for this session that will be transmitted to the completes, segments are sent and receiving application. acknowledged in a sequential manner As data is transmitted during the session, the sequence between both the sending and receiving number is incremented by the number of bytes that have been transmitted. hosts. The receiving TCP process places the data from a segment • A similar handshake process is used by TCP into a receiving buffer. before closing a connection to verify that Segments are placed in the proper sequence number order both hosts are finished sending and receiving and passed to the Application layer when reassembled. all data. Any segments that arrive with non-contiguous sequence • TCP segments are encapsulated and sent numbers are held for later processing. Then, when the within IP datagrams, as shown in the segments with the missing bytes arrive, these segments are processed • 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. 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, the level numbering of TCP segments. If you are using TCP should send the data that has accumulated without TCP, each byte of data is assigned a sequence waiting to fill the segment. number. If SYN flag is set ,then this is the initial RST : Reset the connection.. A RESET causes both sides sequence number. For example, let the first byte immediately to release the connection and all its resources. of data by a device in a particular TCP header will SYN : This flag means synchronize sequence numbers. Source have its sequence number in this field 50000. If is beginning a new counting sequence. In other words, the TCP this packet has 500 bytes of data in it, then the segment contains the sequence number of the first sent byte next packet sent by this device will have the sequence number of 50000 + 500 + 1 = 50501. (ISN). 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). 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 Key application layer protocols that use UDP include: UDP does not guarantee delivery or verify sequencing for any datagrams. Domain Name System (DNS) Simple Network Management Protocol • UDP has the advantage of providing for low overhead data delivery because it has a small (SNMP) datagram header and no network management Dynamic Host Configuration Protocol traffic. (DHCP) • The pieces of communication in UDP are called Routing Information Protocol (RIP) datagrams. Trivial File Transfer Protocol (TFTP) • Applications that use UDP include: Domain Name Online games System (DNS), Video Streaming, Voice over IP (VoIP) etc. • 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 Unlike TCP, Checksum calculation is not mandatory in including header and the data. It is UDP. No Error control or flow control is provided by UDP. 16-bits field. Hence UDP depends on IP and ICMP for error reporting. • Checksum : Checksum is 2 Bytes long field. It is the 16-bit one’s complement of the one’s complement sum of the UDP header IP Basic characteristics: • 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
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. • 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. IPv4 Addressing 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 IPv 6 • The main driving force for the redesign of Major goals for a new version of IP were: Internet Protocol is the foreseeable • Support of billions of hosts. IPv4 address exhaustion. • IPv6 has a vastly larger address space than IPv4. • Reduce size of routing tables. • This results from the use of a 128-bit address, • Simplify the protocol, to allow routers to whereas IPv4 uses only 32 bits. process packets faster. • The new address space thus supports 2128 • Provide better security than current IP. (about 3.4×1038) addresses. This expansion • Pay more attention to type of service, provides flexibility in allocating addresses and routing traffic. particularly for real-time data. • Network security is integrated into the design of • Aid multicasting by allowing scopes to be the IPv6 architecture. specified. • Internet Protocol Security (IPsec) was originally • Make it possible for a host to roam without developed for IPv6, but found widespread changing its address. optional deployment first in IPv4. The IPv6 • Allow the protocol to evolve in the future. specifications mandate IPsec implementation as a fundamental interoperability requirement. • Permit the old and new protocols to coexist for years. 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; 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. • IPv6 options are placed in separate headers that are located between the IPv6 header and the transport layer header. • The extension headers are: Hop-by-Hop Option, Routing (Type 0), Fragment, Destination Option, Authentication, Encapsulation Payload. 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. • 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.