Based on this code!


1. 2. 3. 4. Subnet mask Networks


Web Network address address Last host address broadcast address

Each IP class is equipped with its own default subnet mask which limits the IP class to the default number of networks and the default number per network host. Classful IP addressing does not provide any flexibility to have fewer hosts per network or more networks in the IP class.

What is Subnetting in Networking?

A subnetwork or subnet is a number of logical subdivisions of an IP network. Subnetting is the process or strategy of dividing a network into two or more networks. Subnetting is the process of taking a network and splitting it into smaller networks, known as subnetting. It is used to free up more public IPv4 addresses and segment networks for easier management and security purposes.

Computers belonging to the same subnet are addressed with a single-significant bit-group at their IP address. This turns out to be a logical split in two cases of an IP address. Such as: Network number or routing symptoms and the rest of the field or host identifier.

IPv4 Subnetting:

IPv4 allows subnetting network variations and the host segment of an IP address known as subnetting. Can be reasonably used to design a network. For example: An organization may have a single Internet network address that is familiar to users outside the organization, yet configure its internal network to different departmental subnets. Increases the local routing capacity of subnetwork addresses while reducing the number of required network addresses.

To illustrate this, consider a simple example. Suppose we have a designated Class C network address of 192.9.200 for our site. This means that we can have host addresses from to If we do not use subnetting, we can only apply or use a single IP network with 254 hosts.

Network Addressing and Routing:

Computers participating in a network such as the Internet have or have at least one network address. Typically, this address is unique to each device and can be configured automatically by a network server via Dynamic Host Configuration Protocol (DHCP), manually by an administrator, or automatically by stateless address auto configuration.

An address fulfills the task of identifying the host and identifying it on the network. An IPv4 address consists of 32 bits. An IPv6 address consists of 128 bits. In both systems the address of an IP is divided into two logical parts. Such as: network prefix and host identifier. The same network symptoms can be observed in all hosts within a subnetwork. This prefix occupies the most significant bit of the address. Depending on the network architecture the number of bits allocated in a network may vary between subnets.

This addressing structure allows IP packets to go to a destination host called a router via a special gateway computer via a special network, if the origin of the network and the symptoms of the destination host are different, or if they are sent to a target host on the local network. Routers form logical or physical boundaries between subnets and manage traffic between them. Each subnet is served by a default router, but can be composed of multiple physical Ethernet components interconnected by a network switch.

The routing symptom of an address is characterized by a subnet mask. Which is written in the same format used for IP addresses. For example: A subnet mask for a routing prefix is written as, which consists of the most important 24 bits of an IPv4 address.

The modern standard form of network prefix specification is CIDR notation, which is used for both IPv4 and IPv6. It counts the number of bits in the prefix and adds that number to the address after the slash (/) character separator. This notation was or is introduced with Classless Inter-Domain Routing (CIDR). IPv6 is the only value-based form of network or routing prefix.

In classical networking in IPv4, the network prefix can be obtained directly from the IP address before the introduction of CIDR based on its maximum order bit order. It determines the address class (A, B, C) and so the subnet mask. Since the introduction of CIDR, two parameters are required to assign an IP address and a subnet mask to the network interface.

Given an IPv4 source address, its corresponding subnet mask, and destination address, the router can determine if the destination is on a locally connected network or remote network. The destination subnet mask is not required, and it is not usually known to the router.

However, by careful design of the network, the more remote subnet collection routes within the tree classification branch can be integrated into a super network and represented by a single route.


The IPv6 address space design is significantly different from IPv4. The primary reason for subnetting in IPv4 is to improve or develop the ability to use relatively small address space, especially in enterprise. There is no such restriction in IPv6, since large address space is available, even for end users, it is not a limiting factor.

It is used to route traffic between subnets and the Internet within a global allocation space and customer network.