Computer Network Module 3 : Network Layer (sem 5)

3 Network Layer 7
3.1 Network Layer: Communication Primitives, IPv4 Addressing (classful and
classless), Subnetting, IPv4 Protocol, Network Address Translation (NAT),
IPv6 addressing, IPv4 vs IPv6 addressing, Routed vs Routing protocols,
Classification of Routing algorithms, Shortest Path algorithms (Dijkastra‗s),
Link state routing, Distance Vector Routing

The network layer is the third layer in the Open Systems Interconnection (OSI) model of computer networking. It is responsible for routing data packets from the source network to the destination network. The network layer also provides other services, such as fragmentation and reassembly of data packets, error checking, and congestion control.

Communication Primitives

Communication primitives are the fundamental building blocks of network communication. They provide a common interface between different network layers and protocols. Some of the most common communication primitives include:

  • Data packets: Data packets are the units of data that are transmitted over a network. They consist of a header, which contains information about the source and destination of the packet, and a payload, which contains the data that is being transmitted.
  • Sockets: Sockets are a programming interface that allows applications to communicate with the network layer. Sockets provide a way for applications to send and receive data packets.
  • Ports: Ports are used to identify different applications on a computer. When a data packet arrives at a computer, the network layer uses the port number to determine which application should receive the packet.

IPv4 Addressing

IPv4 is the fourth version of the Internet Protocol (IP). It is the most widely used IP protocol today. IPv4 addresses are 32-bit numbers that are used to identify devices on a network. IPv4 addresses can be divided into two parts: the network address and the host address. The network address identifies the network to which the device belongs, and the host address identifies the device on the network.

There are three classes of IPv4 addresses:

  • Class A: Class A addresses are used for large networks. They have a network address that is 8 bits long, and a host address that is 24 bits long.
  • Class B: Class B addresses are used for medium-sized networks. They have a network address that is 16 bits long, and a host address that is 16 bits long.
  • Class C: Class C addresses are used for small networks. They have a network address that is 24 bits long, and a host address that is 8 bits long.

IPv4 Addressing: Classful vs Classless

Classful addressing and classless addressing are two different ways of assigning IPv4 addresses. Classful addressing is the older of the two methods, and it is no longer widely used. Classless addressing is a more efficient way to use IPv4 addresses, and it is now the preferred method.

Classful addressing assigns IPv4 addresses to networks based on the size of the network. This can lead to inefficient use of IPv4 addresses, as large networks may be given more addresses than they need, while small networks may be given too few addresses.

Classless addressing, on the other hand, assigns IPv4 addresses to networks based on their actual needs. This can lead to more efficient use of IPv4 addresses, as networks are only given the number of addresses that they need.

Subnetting

Subnetting is a technique that is used to divide a network into smaller subnetworks. This can be useful for several reasons, such as:

  • Improving security: Subnetting can be used to improve security by isolating different subnetworks from each other. This can help to prevent unauthorized access to the network.
  • Improving performance: Subnetting can be used to improve performance by reducing the amount of traffic on the network. This can help to improve the speed of data transmission.
  • Making it easier to manage the network: Subnetting can make it easier to manage the network by dividing it into smaller, more manageable pieces.

IPv4 Protocol

The Internet Protocol (IP) is a protocol that is used to route data packets over a network. IP is a best-effort delivery protocol, which means that there is no guarantee that a data packet will reach its destination. However, IP provides a number of features that make it a reliable protocol for routing data packets.

Network Address Translation (NAT)

Network Address Translation (NAT) is a technique that is used to translate one IP address into another. NAT is often used to allow multiple devices to share a single public IP address. This can be useful for several reasons, such as:

  • Conserving IP addresses: NAT can be used to conserve IP addresses by allowing multiple devices to share a single public IP address.
  • Improving security: NAT can be used to improve security by hiding the private IP addresses of devices on a network from the public internet.
  • Making it easier to manage the network: NAT can make it easier to manage the network by simplifying the network configuration.


IPv6 Addressing

IPv6 is the sixth version of the Internet Protocol (IP). It was developed in the 1990s to address the limitations of IPv4, such as the limited number of IP addresses and the lack of support for mobility. IPv6 addresses are 128 bits long, which means that there are an almost infinite number of possible IPv6 addresses. This makes it possible to assign a unique IPv6 address to every device on the internet.

IPv6 also includes a number of other features that are not available in IPv4, such as:

  • Automatic address configuration: IPv6 devices can automatically configure themselves with an IPv6 address. This makes it easier to deploy IPv6 networks.
  • Improved security: IPv6 includes a number of security features that are not available in IPv4. These features can help to protect networks from attacks.
  • Improved performance: IPv6 can provide better performance than IPv4. This is because IPv6 headers are smaller than IPv4 headers, and IPv6 supports larger packets.

IPv6 address

IPv4 vs IPv6 Addressing

The following table summarizes the key differences between IPv4 and IPv6 addressing:

FeatureIPv4IPv6
Address length32 bits128 bits
Number of possible addresses4.3 billion3.4 × 10^38
Address typeHierarchicalFlat
Automatic address configurationNoYes
SecurityLimitedImproved
PerformanceGoodBetter

Routed vs Routing protocols

Routed and routing protocols are both used in computer networking to send data packets from one network to another. However, there are some key differences between the two.

A routed protocol is a set of rules that govern how data packets are forwarded through a network. Routed protocols are typically implemented in hardware, such as routers, and they are responsible for routing data packets at the lowest level of the network stack.

A routing protocol, on the other hand, is a software program that is used to exchange routing information between routers. Routing protocols are responsible for discovering the best path for data packets to travel through a network.

In other words, routed protocols are the “how” of routing, while routing protocols are the “what” of routing.

Classification of Routing algorithms

Routing algorithms can be classified into two main categories:

  • Static routing: Static routing algorithms use a manually configured routing table to determine the best path for data packets to travel. Static routing is typically used for small networks where the topology is not likely to change.
  • Dynamic routing: Dynamic routing algorithms use a routing protocol to exchange routing information with other routers in the network. This allows dynamic routing algorithms to adapt to changes in the network topology. Dynamic routing is typically used for large networks where the topology is likely to change.

Shortest Path algorithms (Dijkastra’s)

Dijkstra’s algorithm is a shortest path algorithm that is commonly used in routing. The algorithm works by finding the shortest path between two nodes in a graph. The graph represents the network, and the nodes represent the routers. The edges of the graph represent the links between the routers.

Dijkstra’s algorithm is a greedy algorithm, which means that it always chooses the shortest path available at each step. This can sometimes lead to suboptimal paths, but it is a relatively simple algorithm to implement.

Link state routing

Link state routing is a dynamic routing protocol that uses the Dijkstra’s algorithm to calculate the shortest path between routers. In link state routing, each router floods the network with information about its links to other routers. This information is then used by other routers to calculate the shortest path to any destination in the network.

Link state routing is a very efficient routing protocol, but it can be computationally expensive to implement.

Distance Vector Routing

Distance vector routing is another dynamic routing protocol that uses the Bellman-Ford algorithm to calculate the shortest path between routers. In distance vector routing, each router maintains a routing table that contains the distance to each destination in the network. The routing table is updated periodically by exchanging information with other routers.

Distance vector routing is a simple routing protocol to implement, but it can be slow to converge to the shortest path.

Other Modules

Team
Team

This account on Doubtly.in is managed by the core team of Doubtly.

Articles: 482