M242 – COMPUTER NETWORS AND SECURITY

UNIT - III TCP/IP SUIT 1. Explain TCP/IP vs. OSI / Explain the functions of TCP/IP Layers TCP/IP (transmission control protocol/ protocol) is the suite of communications protocols that is used to connect hosts on the Internet and on most other computer networks as well.

 The two main protocols in the Transport layer of TCP/IP protocol suite are Transport Control Protocol (TCP) and User Datagram Protocol (UDP).  The TCP ensures that the communication between the sender and the receiver is reliable, error – free and in sequence.  The IP layer sends the individual data grams through various routers, choosing a path for each datagram each time.  The TCP is responsible for checking any errors, reporting them and acknowledging the correct delivery of data grams. Whereas the UDP does not offer reliability, therefore faster. Functions of TCP/IP Layers Network Interface Layer  The Network Interface layer (also called the Network Access layer) is responsible for placing TCP/IP packets on the network medium and receiving TCP/IP packets.  TCP/IP can be used to connect differing network types. These include LAN technologies such as Ethernet and Token Ring and WAN technologies such as X.25 and Frame Relay.  The Network Interface layer encompasses the Data Link and Physical layers of the OSI model. Internet Layer The Internet layer is responsible for addressing, packaging, and routing functions. The core protocols of the Internet layer are IP, ARP, ICMP, and IGMP.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 1

 The (IP) is a routable protocol responsible for IP addressing, routing, and the fragmentation and reassembly of packets.  The Address Resolution Protocol (ARP) is responsible for the resolution of the Internet layer address to the Network Interface layer address such as a hardware address.  The Internet Control Message Protocol (ICMP) is responsible for providing diagnostic functions and reporting errors due to the unsuccessful delivery of IP packets.  The Internet Group Management Protocol (IGMP) is responsible for the management of IP multicast groups.

Transport Layer The Transport layer (also known as the Host-to-Host Transport layer) is responsible for providing the Application layer with session and datagram communication services. The core protocols of the Transport layer are Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP).  TCP provides a one-to-one, connection-oriented, reliable communications service.  UDP provides a one-to-one or one-to-many, connectionless, unreliable communications service. UDP is used when the amount of data to be transferred is small. Application Layer The Application layer provides applications the ability to access the services. There are many Application layer protocols and new protocols are always being developed. The most widely-known Application layer protocols are those used for the exchange of user information:  The Hypertext Transfer Protocol (HTTP) is used to transfer files that make up the Web pages of the World Wide Web.  The File Transfer Protocol (FTP) is used for interactive file transfer.  The Simple Mail Transfer Protocol (SMTP) is used for the transfer of mail messages and attachments.  Telnet, a terminal emulation protocol, is used for logging on remotely to network hosts. Additionally, the following Application layers protocols help facilitate the use and management of TCP/IP networks:  The Domain Name System (DNS) is used to resolve a host name to an IP address.  The Routing Information Protocol (RIP) is a routing protocol that routers use to exchange routing information on an IP internetwork.  The Simple Network Management Protocol (SNMP) is used between a network management console and network devices (routers, bridges, intelligent hubs) to collect and exchange network management information. ------

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 2

2. Explain Connection Oriented and Connectionless Services

Connection Oriented Service In connection oriented service we have to establish a connection before starting the communication. The following steps are performed in connection oriented service 1. Connection is established. 2. Send the message or the information 3. Release the connection.

 Connection oriented service is more reliable than connectionless service. Example of connection oriented is TCP (Transmission Control Protocol) protocol.  It is similar to the postal services, as it carries the full address where the message (letter) is to be carried. Each message is routed independently from source to destination. Connectionless Oriented Service

 In connectionless service the data is transferred in one direction from source to destination without checking that destination is still there or not or if it prepared to accept the message.  Authentication is not needed in this. Example of Connectionless service is UDP (User Datagram Protocol) protocol. ------3. Explain the comparison between Connection & Connectionless Service

Connection oriented service Connectionless service Authentication is required No need for authentication Makes a connection and checks whether It does not guarantees the delivery Message is received or not, if not it resends the message again. More reliable Unreliable Stream based Message based

------4. Explain Socket in detail

Sockets Applications running on different computers or devices communicate with the help of TCP with the concept called PORT. For example the various protocols in application layer use the respective ports: FTP: 20 and 21 SMTP: 25

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 3

HTTP: 80 A port identifies a single application on a single computer. The term socket address or simply socket is used to identify the IP address and the port number concatenated together.

IP address + Port number = Socket 80

For eg: IP address Port number Socket address 200.23.56.8 + 69 - 200.23.56.8:69 ------5. Explain the concept of Transport Layer Protocol • In the TCP/IP protocol suite, there are two major transport protocols: Transmission control protocol (TCP) and user datagram protocol (UDP).

Basic Features • TCP provides connection-oriented communication (virtual circuit connection, like telephone communication). It manages a point-to-point and full-duplex connection for an application between two computers: • creates a connection before communication; • sends and receives data over this connection; • closes a connection after communication. • TCP guarantees reliable data delivery. The TCP recipient will receive data in a correct order without data loss or error.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 4

Format of a TCP segment / TCP Header:

Source Port: 16 bits, the source port number. Destination Port: 16 bits, the destination port number. Sequence Number: 32 bits, the sequence number of the first data octet in this segment Acknowledgment Number: 32 bits, If the ACK control bit is set this field contains the Value of the next sequence number Reserved: 6 bits, reserved for future use. Must be zero. Code Bits: 6 bits (from left to right): URG: Urgent Pointer field significant ACK: Acknowledgment field significant PSH: Push Function RST: Reset the connection SYN: Synchronize sequence numbers FIN: No more data from sender Window: 16 bits, the size of the sliding window for transferring data bits. Checksum: 16 bits, the checksum field is the 16 bit for providing error free data Urgent Pointer: 16 bits, it points to the sequence number of the urgent data. ------6. Explain the concept of User Datagram Protocol (UDP) – UDP is another popular transport protocol. – Basic Properties of UDP • UDP is a connectionless transport protocol. – A UDP application sends messages without establishing and then closing a connection. – UDP has a smaller overhead then TCP, especially when the total size of the messages is small. • UDP does not guarantee reliable data delivery. – UDP messages can be lost or duplicated, or they may arrive out of order; and they can arrive faster than the receiver can process them.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 5

– The application programmers using UDP have to consider and tackle these issues themselves. • UDP has no mechanism for flow control. • Difference between UDP and IP – UDP distinguishes among applications within a given host via the destination port number; an IP datagram only identifies a destination host via the IP address.

Format of a UDP segment / UDP Header:

Source Port Number: The first 16 bits of the UDP header contain the port number of the application sending the data.

Destination Port Number: The next 16 bits contain the port number of the application that receives this data.

Message Length: The next 16 bits identify how long the datagram is in bits.

Checksum: 16 bits, the checksum field is the 16 bit for providing error free data. ------

7. Explain network layer protocols and its types Network Layers Protocol: The various protocols at network layer of TCP/IP protocol suite are  IGMP  ICMP  ARP  RARP

IGMP

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 6

 The Internet Group Management Protocol (IGMP) is an Internet protocol that provides that manages group membership. The IGMP protocol gives the multicast routers information about the membership status of hosts (routers) connected to the network. .  IGMP is a companion to the IP protocol  IGMP is a group management protocol. It helps a multicast create and update a list of loyal members related to each router interface

ICMP  The Internet Control Message Protocol (ICMP) is one of the main protocols of the Internet Protocol Suite.  The IP protocol delivers the datagram form source to destination. The IP Protocol has no error reporting or error correcting mechanism, it is an unreliable protocol.  If any error occurs in reaching the destination that error situation is handled by ICMP. So it is called the companion to IP protocol.  It is used by network devices, like routers, to send error messages indicating, for example, that a requested service is not available or that a host or router could not be reached.  ICMP messages are divided into two broad categories: error-reporting messages and query messages.  The error-reporting messages report problems that a router or a host (destination) may encounter when it processes an IP packet.  The query messages, which occur in pairs, help a host or a network manager get specific information from a router or another host.  Error reporting –ICMP only reports the error, but do not correct the error. The error correction is handled by higher llevel protocols.  Five type of error are handled:

Destination unreachable – When a router cannot route a datagram the host sends a destination unreachable message.

Source quench – This means the source host does not know the about the traffic whether routers between the source and destination

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 7

Time exceeded –Time delay occurs for sending data grams then time exceeded message is reported. Parameter Problem – If any router or destination host discovers any missing parameters in datagram, it discards the datagram and sends a parameter-problem message back to the source. Redirection – Redirecting the data grams to the destination host with the help of static routing.

Query Apart from error reporting, ICMP can diagnose network problems. This is accomplished by the query messages.

ARP Address Resolution Protocol (ARP) is a protocol for mapping an Internet Protocol address (IP address) to a physical machine address that is recognized in the local network. A table, usually called the ARP cache, is used to maintain a correlation between each MAC address and its corresponding IP address.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 8

RARP The Reverse Address Resolution Protocol (RARP) is an network layer protocol used by a client computer to request its Internet Protocol(IPv4) address from a computer network, when all it has available is its link layer or hardware address, such as a MAC address.

------3.3. IP Addressing:

8. Explain the concept of IP Addressing in detail An Internet Protocol address (IP address) is a numerical label assigned to each device (e.g., computer, printer) participating in a computer network that uses the Internet Protocol for communication.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 9

The two most common versions of IP in use today are Internet Protocol version 4 (IPv4) and Internet Protocol version 6 (IPv6). Both IPv4 and IPv6 addresses come from finite pools of numbers. For IPv4, this pool is 32-bits (232) in size and contains 4,294,967,296 IPv4 addresses.

Dot-decimal notation Dot-decimal notation is a presentation format for numerical data. It consists of a string of decimal numbers, each pair separated by a full stop (dot). Example:

Classes of IP address: • divided into 5 classes – class A: start with 0, then 7-bit code • 224 = 16,777,216 hosts in – class B: start with 10, then 14-bit code • 216 = 65,536 hosts in subnetwork – class C: start with 110, then 21-bit code • 28 = 256 hosts in subnetwork – class D: start with 1110 • used for multicasting – class E: start with 11110 • reserved for future use • IPv6 extends address size to 128 bits – extensions support authentication, data integrity, confidentiality

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 10

Classes of IP Address ------9. Explain Subnetting in detail  A subnetwork or subnet is a logical subdivision of an IP network. The practice of dividing a network into two or more networks is called subnetting.  In general the IP address is a two-level hierarchy with Network id and Host id. When subnetting the larger network the IP address consists of Network id,Subnet id and Host id thus forming the three-level hierarchy.  Subnet mask: Subnet mask is a 32 bits long address used to distinguish between network address and host address in IP address. Subnet mask is always used with IP address. Subnet mask has only one purpose, to identify which part of an IP address is network address and which part is host address. For example how will we figure out network partition and host partition from IP address 192.168.1.10 ? Here we need subnet mask to get details about network address and host address. In decimal notation subnet mask value is from 1 to 255 represent network address and value 0 represent host address. In binary notation subnet mask ON bit 1 represent network address while OFF bit[0] represent host address. In decimal notation IP address 192.168.1.10 Subnet mask 255.255.255.0 Network address is 192.168.1 and host address is 10. In binary notation IP address 11000000.10101000.00000001.00001010 Subnet mask 11111111.11111111.11111111.00000000 Network address is 11000000.10101000.00000001 and host address is 00001010

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 11

------10. Explain supernetting in detail Supernetting  Supernetting is the opposite of Subnetting. In subnetting, a single big network is divided into multiple smaller .  In Supernetting, multiple networks are combined into a bigger network termed as a Supernetwork or Supernet.  Supernetting is used in route aggregation to reduce the size of routing tables and routing table updates.

Supernetwork ------11. Explain VLSM technique in detail Variable Length Subnet Mask (VLSM) extends classic Subnetting. VLSM is a process of breaking down subnets into the smaller subnets, according to the need of individual networks. VLSM allows us to divide an IP address space into a hierarchy of subnets of different sizes, making it possible to create subnets with very different host counts without wasting large numbers of addresses.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 12

VLSM Example ------12. Explain IPV6 in detail IPV6  In order to communicate over the Internet, computers and other devices must have sender and receiver addresses. These numeric addresses are known as Internet Protocol addresses.  IPv6 is the Internet's next-generation protocol, designed to replace the current Internet Protocol, IP Version 4.  Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet.  Compared to IPv4, the most obvious advantage of IPv6 is its larger address space. The most obvious improvement in IPv6 over IPv4 is that IP addresses are lengthened from 32 bits to 128 bits.

------

3.4 Application Layer Protocols The various protocols in application layer are : FTP Telnet SMTP HTTP DNS POP

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 13

13. Explain File Transfer Protocol (FTP) in detail FTP  The File Transfer Protocol (FTP) is a standard network protocol used to transfer computer files between a client and server on a computer network.  FTP is built on client-server model architecture and uses separate control and data connections between the client and the server.  It is a standard mechanism provided by TCP/IP for copying file from one host to another. FTP uses the services of TCP. It needs two TCP connections. The well- known port 21 is used for the control connection and the well-known port 20 for the data connection.

 FTP presents the user with a prompt and allows entering various commands for accessing and downloading files that physically exist on a remote computer.  After invoking an FTP application, The user identifies a remote computer and instructs FTP to establish a connection with it.  FTP contacts the remote computer using the TCP/IP software.  Once the connection is established, the user can choose to download a file from the computer or the user can send a file from his computer to be stored on the remote computer.

------

14. Explain Telnet protocol Telnet  TELNET is a general-purpose client-server application program. TELNET enables the establishment of a connection to a remote system in such a way that the local terminal appears to be a terminal at the remote system.  TELNET has two parts, the client and server.  The client portion of TELNET software resides on an end user’s machine, and the server portion resides on a remote server machine.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 14

 This server is the TELNET server, which provides an interactive terminal session to execute commands on the remote host.  In timesharing systems, all users log into the centralized server and uses its resources. This is called local login.

 A user’s terminal sends the commands entered by the user from the terminal is carried to the terminal driver which is running on the server and it is the part of the server machine operating system.  The terminal driver then sends the requests to the appropriate module of the server operating system.  The operating system then processes this commands and invokes the appropriate application program, which executes on the server machine and the result is send back to the terminal. ------15. Explain SMTP Protocol in detail  Simple Mail Transfer Protocol (SMTP) is used to send mail across the internet.  The TCP/IP protocol that supports electronic mail on the internet is called SMTP. It is the system for sending messages to other computer users based on e-mail addresses. SMTP provides for mail exchange between users on the same or different computers and supports: 1. sending single message to one or more recipients. 2. sending messages that include text,voice,video or graphics. 3. sending messages to users on networks outside the internet.

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 15

 UA - users agent. This is the program a user will use to type e-mail. It usually incorporates an editor for support. The user types the mail and it is passed to the sending MTA.  MTA - Message transfer agent is used to pass mail from the sending machine to the receiving machine. There is a MTA program running on both the sending and receiving machine. ------

16. Explain HTTP Protocol in detail  One of the application layer protocol is HTTP. Hyper Text Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands.  For example, when a URL is entered from a client browser, this actually sends an HTTP command to the Web server directing it to fetch and transmit the requested Web page. Some of the HTTP commands are: GET,HEAD,PUT,POST,DELETE,LINK

------

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 16

17. Explain Domain Name System

A simple idea in identifying computer networks and computers on those networks by some name is the basis for domain names. Domain name is a name given to a group of computers that are called by single name is called Domain. These Domain names are to be translated to its respective IP addresses because this IP address is handled by the TCP/IP or the internet understands while sending and receiving any messages. This translation is handled by DNS. The Domain Name System (DNS) is basically a large database which resides on various computers and it contains the names and IP addresses of various hosts on the internet and various domains.

Every domain name has a suffix that indicates which top level domain (TLD) it belongs to. There are only a limited number of such domains. For example:  gov - Government agencies  edu - Educational institutions  org - Organizations (nonprofit)  mil - Military  com - commercial business  net - Network organizations  ca - Canada  in – India

Because the Internet is based on IP addresses, not domain names, every Web server requires a Domain Name System (DNS) server to translate domain names into IP addresses.

------

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 17

18. Explain Post Office Protocol (POP) in detail The Post Office Protocol (POP3) is an Internet standard protocol used by local email software clients to retrieve emails from a remote mail server over a TCP/IP connection. Email servers hosted by Internet service providers also use POP3 to receive and hold emails intended for their subscribers. Periodically, these subscribers will use email client software to check their mailbox on the remote server and download any emails addressed to them. Once the email client has downloaded the emails, they are usually deleted from the server, although some email clients allow users to specify that mails be copied or saved on the server for a period of time. Email clients generally use the well-known TCP port 110 to connect to a POP3 server. The following picture depicts the sequence of actions be, while retrieving mail from the mail server by the user computer

------

SPC/COMP/IV SEM: M242 – Computer Networks & Security Unit III - Page 18