Docsity

Computer Networks: Complete Notes from Basics to Advanced, Study notes of Computer Networks

Toggle sidebar
bg1
Network Layer Protocols
Network Layer is responsible for the transmission of data or communication from one host to another host
connected in a network. Rather than describing how data is transferred, it implements the technique for efficient
transmission. In order to provide efficient communication protocols are used at the network layer. The data is
being grouped into packets or in the case of extremely large data it is divided into smaller sub packets. Each
protocol used has specific features and advantages. The below article covers in detail the protocols used at the
network layer.
Functions of Network Layer
The network layer is responsible for providing the below-given tasks:
โ€ข Logical Addressing: Each device on the network needs to be identified uniquely. Therefore network layer
provides an addressing scheme to identify the device. It places the IP address of every sender and the
receiver in the header. This header consists of the network ID and host ID of the network.
โ€ข Host-to-host Delivery of Data: The network layer ensures that the packet is being delivered successfully
from the sender to the receiver. This layer makes sure that the packet reaches the intended recipient only.
โ€ข Fragmentation: In order to transmit the larger data from sender to receiver, the network layer fragments
it into smaller packets. Fragmentation is required because every node has its own fixed capacity for
receiving data.
โ€ข Congestion Control: Congestion is defined as a situation where the router is not able to route the packets
property which results in aggregation of packets in the network. Congestion occurs when a large amount
of packets are flooded in the network. Therefore network layer controls the congestion of data packets in
the network.
โ€ข Routing and Forwarding: Routing is the process that decides the route for transmission of packets from
sender to receiver. It mostly chooses the shortest path between the sender and the receiver. Routing
protocols that are mostly used are path vector, distance vector routing, link state routing, etc.
Network Layer Protocols
There are various protocols used in the network layer. Each protocol is used for a different task. Below are the
protocols used in the network layer:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Computer Networks: Complete Notes from Basics to Advanced and more Study notes Computer Networks in PDF only on Docsity!

Network Layer Protocols Network Layer is responsible for the transmission of data or communication from one host to another host connected in a network. Rather than describing how data is transferred, it implements the technique for efficient transmission. In order to provide efficient communication protocols are used at the network layer. The data is being grouped into packets or in the case of extremely large data it is divided into smaller sub packets. Each protocol used has specific features and advantages. The below article covers in detail the protocols used at the network layer. Functions of Network Layer The network layer is responsible for providing the below-given tasks:

  • Logical Addressing: Each device on the network needs to be identified uniquely. Therefore network layer provides an addressing scheme to identify the device. It places the IP address of every sender and the receiver in the header. This header consists of the network ID and host ID of the network.
  • Host-to-host Delivery of Data: The network layer ensures that the packet is being delivered successfully from the sender to the receiver. This layer makes sure that the packet reaches the intended recipient only.
  • Fragmentation: In order to transmit the larger data from sender to receiver, the network layer fragments it into smaller packets. Fragmentation is required because every node has its own fixed capacity for receiving data.
  • Congestion Control: Congestion is defined as a situation where the router is not able to route the packets property which results in aggregation of packets in the network. Congestion occurs when a large amount of packets are flooded in the network. Therefore network layer controls the congestion of data packets in the network.
  • Routing and Forwarding: Routing is the process that decides the route for transmission of packets from sender to receiver. It mostly chooses the shortest path between the sender and the receiver. Routing protocols that are mostly used are path vector, distance vector routing, link state routing, etc. Network Layer Protocols There are various protocols used in the network layer. Each protocol is used for a different task. Below are the protocols used in the network layer:

Protocols at each Layer

1. IP (Internet Protocol) IP stands for Internet Protocol. Internet Protocol helps to uniquely identify each device on the network. Internet protocol is responsible for transferring the data from one node to another node in the network. Internet protocol is a connectionless protocol therefore it does not guarantee the delivery of data. For the successful delivery higher level protocols such as TCP are used to guarantee the data transmission. The Internet Protocol is divided in two types. They are: - IPv4: IPv4 provides with the 32 bit address scheme. IPv4 addressing has four numeric fields and are separated by dot. IPv4 can be configured either using DHCP or manually. IPv4 does not provide with more security features as it does not support authentication or encryption techniques. IPv4 is further divided into five classes as Class A, Class B, Class C, Class D and Class E. - IPv6: IPv6 is the most recent version of IP. If provided with a 128 bit addressing scheme. IP address has eight fields that are separated by colon, and these fields are alphanumeric. The IPv6 address is represented in hexadecimal. IPv6 provides with more security features such as authentication and encryption. IPv supports end-to-end connection integrity. IPv6 provides with more range of IP address as compared to IPv4. Difference between IPv4 and IPv6: IPv4 vs IPv 2. ARP (Address Resolution Protocol) ARP stands for Address Resolution Protocol. ARP is used to convert the logical address ie. IP address into physical address ie. MAC address. While communicating with other nodes, it is necessary to know the MAC address or physical address of the destination node. If any of the node in a network wants to know the physical address of

  • Static Entry: This type of entry is created when a user uses the ARP command utility to manually enter the IP to MAC address association.
  • Dynamic Entry: A dynamic entry is one that is automatically formed when a sender broadcasts their message to the whole network. Dynamic entries are periodically removed and are not permanent. 3. RARP RARP stands for Reverse Address Resolution Protocol. RARP works opposite of ARP. Reverse Address Resolution Protocol is used to convert MAC address ie. physical address into IP address ie. logical address. RARP provides with a feature for the systems and applications to get their own IP address from a DNS( Domain Name System) or router. This type of resolution is required for various tasks such as executing reverse DNS lookup. As Reverse Address Resolution Protocol works at low level it requires direct network addresses. The reply from the server mostly carries a small information but the 32 bit internet address is used and it does not exploit the full potential of a network such as ethernet. How Does RARP Work?
  • Data is sent between two places in a network using the RARP, which is on the Network Access Layer.
  • Every user on the network has two distinct addresses: their MAC (physical) address and their IP (logical) address.
  • Software assigns the IP address, and the hardware then builds the MAC address into the device.
  • Any regular computer connected to the network can function as the RARP server, answering to RARP queries. It must, however, store all of the MAC addresses' associated IP addresses. Only these RARP servers are able to respond to RARP requests that are received by the network. The information package must be transmitted over the network's lowest tiers.
  • Using both its physical address and Ethernet broadcast address, the client transmits a RARP request. In response, the server gives the client its IP address.

RARP

Difference between ARP and RARP: ARP vs RARP

4. ICMP ICMP stands for Internet Control Message Protocol. ICMP is a part of IP protocol suite. ICMP is an error reporting and network diagnostic protocol. Feedback in the network is reported to the designated host. Meanwhile, if any kind of error occur it is then reported to ICMP. ICMP protocol consists of many error reporting and diagnostic messages. ICMP protocol handles various kinds of errors such as time exceeded, redirection, source quench, destination unreachable, parameter problems etc. The messages in ICMP are divided into two types. They are given below: - Error Message: Error message states about the issues or problems that are faced by the host or routers during processing of IP packet. - Query Message: Query messages are used by the host in order to get information from a router or another host. How Does ICMP Work? - The main and most significant protocol in the IP suite is called ICMP. However, unlike TCP and UDP, ICMP is a connectionless protocol, meaning it doesn't require a connection to be established with the target device in order to transmit a message.

  • the host ID. In a subnet mask:
  • Binary 1s represent the network portion of the IP address.
  • Binary 0s represent the host portion. The subnet mask helps a device determine whether another device is on the same local network or on a different network, which in turn decides whether communication is direct or must go through a router. For example: Role of Subnet Mask Subnet masks help divide a large network into smaller logical networks called subnets, which improves network efficiency, security, and performance by reducing broadcast traffic and enabling better network management. Function of Subnet Mask
  • Separates an IP address into network ID and host ID.
  • Divides a large network into smaller subnets for better organization.
  • Improves network efficiency, security, and manageability by reducing unnecessary traffic.
  • Helps routers determine whether a packet should be forwarded locally or to another network. Why Use a Subnet Mask? Consider a Class A network, which can support approximately 16 million hosts. Managing such a large network as a single unit is impractical and introduces several challenges:
  • Maintenance becomes difficult due to the large number of connected devices.
  • Security risks increase, as all devices share the same network. For example, in an organization with multiple departments, allowing every department access to the entire network is neither efficient nor secure. Solution: Subnetting Subnetting addresses these issues by dividing a large network into smaller, manageable sub-networks called subnets using a subnet mask. Each department can be assigned its own subnet, which:
  • Improves security by isolating departments
  • Enhances network efficiency by reducing unnecessary traffic
  • Simplifies network management In a network without subnetting, identifying a device involves three steps:
  1. Identification of the network
  2. Identification of the host
  3. Identification of the process When subnetting is applied, address identification becomes more structured and involves four steps:
  4. Identification of the network
  5. Identification of the subnet
  6. Identification of the host
  7. Identification of the process Suppose we have a Class C network and we want to divide it into 4 subnets. To divide we need to choose 2 bits from the host part.

Network Classes The Internet Assigned Numbers Authority (IANA), through InterNIC, manages the allocation of IP addresses. To simplify addressing, IP addresses are divided into five classes (Aโ€“E):

  • Class A, B, C: Commonly used by end users.
  • Class D: Reserved for multicast.
  • Class E: Reserved for experimental purposes. Each class has a default subnet mask, and the first octet (first 8 bits) determines the class. Range of Classes Read more about classful IP addressing. Advantages of Subnetting
  • Reduces Congestion: Limits broadcast traffic, improving network performance.
  • Efficient IP Usage: Allocates IPs based on need, avoiding wastage.
  • Enhanced Security: Isolates sensitive data within specific subnets.
  • Departmental Segmentation: Prioritizes traffic for specific teams or services.
  • Scalable & Organized: Makes network expansion easier and manageable. Disadvantages of Subnetting
  • Fewer Usable Addresses: Network and broadcast IDs reduce host capacity.
  • Higher Hardware Costs: Routers or Layer-3 devices are often required.
  • Complex Setup: Needs careful planning and technical expertise.
  • Compatibility Issues: Legacy devices may not support modern subnets. Supernetting in Network Layer Supernetting is the opposite of subnetting. While subnetting splits a large network into smaller subnets, supernetting combines multiple smaller networks with similar prefixes into a larger network (supernet). It reduces routing table size, simplifies routing, and optimizes IP address usage, primarily through route summarization. Benefits of Supernetting:
  • Saves storage space in routing tables
  • Reduces the number of routing updates
  • Simplifies routing decisions
  • Helps manage the growth of routing tables as the Internet expands Important Points for Supernetting
  • All the Networks should be contiguous.
  • The block size of every network should be equal and must be in form of 2n.
  • First Network id should be exactly divisible by whole size of supernet. Example: Combining Four Class C Networks Consider Networks: 200.1.0.0, 200.1.1.0, 200.1.2.0, 200.1.3. Original Routing Table: Network Id Subnet Mask Interface 200.1.0.0 255.255.255.0 A 200.1.1.0 255.255.255.0 B
  • Control and reduce network traffic
  • Helpful to solve the problem of lacking IP addresses
  • Minimizes the routing table i.e, it cannot cover a different area of the network when combined and all the networks should be in the same class and all IP should be contiguous How to Calculate Number of Host in a Subnet? Last Updated : 2 Jan, 2026

Subnetting is a crucial process in network design that involves dividing a larger network into smaller, manageable subnetworks. Determining the number of hosts that each subnet can accommodate is crucial for efficient IP address allocation, preventing waste, and optimizing overall network performance. Proper subnet planning also improves security by isolating network segments and controlling traffic flow. Subnetting and IP Addresses Subnetting and IP addressing are fundamental components of network design, essential for efficient network management, performance optimization, and security. An IP address is a unique identifier assigned to each device on a network, allowing it to communicate with other devices. IPv4 addresses consist of 32 bits divided into four octets, while IPv6 addresses use 128 bits, providing a much larger address space. Subnetting divides a larger network into smaller, manageable segments called subnets, helping organize network traffic and optimize IP address usage. Key Benefits of Subnetting:

  • Subnet Mask: Differentiates the network and host portions of an IP address, guiding proper routing of network traffic.
  • Reduces Broadcast Domains: Limits broadcast traffic within each subnet, improving overall network performance.
  • Enhanced Security: Isolates subnet traffic, reducing exposure to unauthorized access or potential threats.
  • Efficient IP Address Allocation: Prevents IP wastage by allocating addresses according to subnet size and need.
  • Better Traffic Management: Allows control over traffic flow and departmental segmentation.
  • Improved Network Efficiency: Optimizes routing and performance through organized and structured subnetting. Practical Application:
  • Adjusting the Subnet Mask: For example, changing from 255.255.255.0 to 255.255.255.192 allows administrators to create smaller, more manageable networks.
  • Host Capacity Calculation: Uses formulas like 2(32-n)โˆ’2 to calculate the number of usable hosts per subnet, where n represents the number of bits designated for the network and subnet parts. Subnet Mask CIDR Notation Total Subnets Usable Hosts per Subnet 255.255.255.0 /24 1 254 255.255.255.128 /25 2 126 255.255.255.192 /26 4 62 255.255.255.224 /27 8 30 255.255.255.240 /28 16 14 255.255.255.248 /29 32 6 255.255.255.252 /30 64 2 Notes:
  • Usable hosts per subnet = 2^(32โˆ’n) โˆ’ 2, where n = number of bits in the subnet mask.
  • For /31 or /32 subnets, adjustments are needed since the standard - 2 formula does not apply. Explanation:
  • Subnet Mask: This is the mask used to determine what portion of an IP address refers to the network and what part refers to the host.
  • Subnet Notation: This is the CIDR (Classless Inter-Domain Routing) notation that also indicates the subnet mask.
  • Total Subnets: The number of distinct networks that can be created with the given subnet mask.
  • Usable Hosts per Subnet: The number of devices that can be assigned IP addresses within each subnet, excluding the network and broadcast addresses. We use fundamental networking formulas that are based on the number of bits allocated for network and host parts in the subnet mask. Hereโ€™s a breakdown of the calculations:

1) Identify the Class of the IP address To find the number of computers connected in the network first we need to identify the class of the IP address, there are 5 classes of IP addresses they are A, B, C, D, and E. Each IPv4 address consists of 32 bits, divided into 4 octets, 1 octet = 8 bits. Look at the first octet to find the class of the given IP address. The range of each class is given in the following table. IP Class First Octet Range Address Range Description Class A 1 โ€“ 126 1.0.0.0 โ€“ 126.255.255.255 Designed for very large networks Class B 128 โ€“ 191 128.0.0.0 โ€“ 191.255.255.255 Suitable for medium-sized networks Class C 192 โ€“ 223 192.0.0.0 โ€“ 223.255.255.255 Used for small networks Class D 224 โ€“ 239 224.0.0.0 โ€“ 239.255.255.255 Reserved for multicast groups Class E 240 โ€“ 255 240.0.0.0 โ€“ 255.255.255.255 Reserved for experimental use Example: If the IP address given is 64.19.23.0 then the first octet is 64 which is in the range of 0 to 127, so the given IP address belongs to class A. 2) Finding the Network IP address Finding the network IP address involves determining the portion of an IP address that identifies the specific network to which a device belongs. This can be accomplished by using the subnet mask along with the device's IP address. Here's how you can find the network IP address:

  • Understand IP Address and Subnet Mask : Every device on a network has an IP address and a corresponding subnet mask. The subnet mask helps in identifying how the IP address is divided into network and host parts.
  • Binary Conversion : Convert both the IP address and the subnet mask into binary. An IP address is composed of four octets (e.g., 192.168.1.15), as is the subnet mask (e.g., 255.255.255.0).
  • Perform a Binary AND Operation : Perform a bitwise AND operation between the binary form of the IP address and the subnet mask. This operation compares corresponding bits of the IP address and the subnet mask and applies the logical AND operation, which results in the network portion. For example: If the IP address is 192.168.1.10 (11000000.10101000.00000001.00001010 in binary ) and the subnet mask is 255.255.255.0 (11111111.11111111.11111111.00000000 in binary )

Then result of the AND operation would be 11000000.10101000.00000001.00000000, which corresponds to 192.168.1..

  • Convert Back to Decimal : Convert the result of the AND operation back to decimal format to get the network address. This is the part of the IP address that identifies the network to which the device is connected.
  • Verification : You can use various network tools or command-line utilities like ipconfig (on Windows) or ifconfig (on Unix/Linux) to display the IP address, subnet mask, and network address for verification. 3) Finding the number of hosts or number of computers connected to that network The class it belongs will tell the range of hosts that can connect to that network, it's given in the below table. Classes Number of networks possible Number of hosts possible in 1 network Number of usable hosts in 1 network A 126 224 224 - 2 B 16384 65536 65534 C 221 256 254 D no networks no hosts - E no networks no hosts - [Note: Class D is reserved for Multicasting, group email/ broadcast, possible IP address in class D are 228 Class E is reserved for experimental and research / military purposes, possible IP addresses in class E is 228 ] In simple words, the Number of hosts in any network can be calculated with the formula = 2x- 2, where x is the number of host ID bits in the IP address. Why do we subtract 2? Becausethe first and last addresses are not used for any hosts because the first IP is used to represent the whole network ID while the last IP is used as the broadcast address. Example: The given IP address is 192.168.254.1 it belongs to class C, when we perform AND operation on IP address with a default mask of class C, we get the network IP address as 192.168.254.0 this is the IP address used to represent the whole network and the broadcast address will be the last IP address of this network which is 192.168.254.

Why Do We Need VLSM? In traditional subnetting (Fixed Length Subnet Mask โ†’ FLSM), all subnets must have the same size. This often leads to wastage of IP addresses. Example of Wastage in FLSM If you use a /24 mask (255.255.255.0), each subnet gets 254 usable IP addresses. But if:

  • One department needs only 10 hosts
  • Another needs 50 hosts Both still receive 254 IPs โ†’ huge wastage. VLSM solves this by allowing subnets with different masks , such as:
  • Smaller subnet mask โ†’ More hosts
  • Larger subnet mask โ†’ Fewer hosts This ensures minimum IP wastage. What is VLSM? VLSM stands for Variable Length Subnet Mask. It means: You can use more than one mask inside the same Class A/B/C network. You can create subnets of different sizes based on actual requirements. It is often described as subnetting the subnet. VLSM improves scalability, optimizes IP usage, and is widely used in real-world routing environments (like OSPF, EIGRP, BGP). How VLSM Works (Step-by-Step Procedure) Letโ€™s take a scenario: A network administrator has the IP block: 192.168.1.0/24 , and four departments: Department Required Hosts Sales & Purchase 120 Development 50

Department Required Hosts Accounts 26 Management 5 Step 1: Determine Required Block Sizes Each subnet must provide enough hosts to cover:

  • Network address
  • Broadcast address
  • Host IPs So, pick block sizes โ‰ฅ required hosts. Step 2: Sort Requirements in Descending Order Largest requirements first:
  1. Sales & Purchase โ†’ 120 hosts
  2. Development โ†’ 50 hosts
  3. Accounts โ†’ 26 hosts
  4. Management โ†’ **5 hosts Step 3: Start Assigning Subnets from Largest Block
  5. Sales & Purchase (120 hosts)** Nearest block size โ†’ /25 (126 hosts) Subnet: 192.168.1.0/ Mask: **255.255.255.
  6. Development (50 hosts)** Nearest block size โ†’ /26 (62 hosts) Subnet: 192.168.1.128/ Mask: **255.255.255.
  7. Accounts (26 hosts)** Nearest block size โ†’ /27 (30 hosts) Subnet: 192.168.1.192/ Mask: **255.255.255.
  8. Management (5 hosts)**