IP Address
Note:
- IP addresses are globally managed by Internet Assigned Numbers Authority(IANA) and Regional Internet Registries(RIR).
- While finding the total number of host IP addresses, 2 IP addresses are not counted and are therefore, decreased from the total count because the first IP address of any network is the network number and whereas the last IP address is reserved for broadcast IP.
IP addresses belonging to class A are assigned to the networks that contain a large number of hosts. The network ID is 8 bits long.
The host ID is 24 bits long.
IP addresses belonging to class A ranges from 0.0.0.0 – 127.255.255.255.
Class B
- The network ID is 16 bits long.
- The host ID is 16 bits long.
- 2^14 = 16384 network address
- 2^16 – 2 = 65534 host address
Class C
- The network ID is 24 bits long.
- The host ID is 8 bits long.
- 2^21 = 2097152 network address
- 2^8 – 2 = 254 host address
Range of Special IP Addresses
127.0.0.0 – 127.255.255.255 : Loop-back addresses
0.0.0.0 – 0.0.0.8: used to communicate within the current network.
Rules for Assigning Host ID
Host IDs are used to identify a host within a network. The host ID is assigned based on the following rules:
- Within any network, the host ID must be unique to that network.
- A host ID in which all bits are set to 0 cannot be assigned because this host ID is used to represent the network ID of the IP address.
- Host ID in which all bits are set to 1 cannot be assigned because this host ID is reserved as a broadcast address to send packets to all the hosts present on that particular network.
Rules for Assigning Network ID
- The network ID cannot start with 127 because 127 belongs to the class A address and is reserved for internal loopback functions.
- All bits of network ID set to 1 are reserved for use as an IP broadcast address and therefore, cannot be used.
- All bits of network ID set to 0 are used to denote a specific host on the local network and are not routed and therefore, aren’t used.
1. Subnetting Overview
Subnetting divides a larger IP network into smaller, manageable segments (subnets). This is useful for organizing network devices logically, improving security, and conserving IP addresses.
Each subnet functions as an isolated network with its own range of IP addresses, and this setup allows devices within a subnet to communicate directly while restricting external access.
Why Subnetting?
- Efficient Use of IP Addresses: Subnetting helps to allocate the appropriate number of IP addresses for each network segment, preventing waste.
- Improved Network Management: It allows administrators to organize devices logically, such as by department or geographical location.
- Enhanced Security: Traffic within a subnet can be isolated from other subnets, protecting internal communications.
- Reduced Broadcast Traffic: Smaller networks reduce the volume of broadcast traffic, which can improve network performance.
2. Subnet Masks
A subnet mask is used to identify the network and host portions of an IP address. It essentially "masks" the IP address to distinguish the parts used for network identification from those used for hosts.
For example:
- Subnet Mask for Class A:
255.0.0.0
- Subnet Mask for Class B:
255.255.0.0
- Subnet Mask for Class C:
255.255.255.0
These default masks can be adjusted to create smaller subnets, allowing us to control the number of subnets and the number of hosts per subnet.
3. CIDR Notation
Classless Inter-Domain Routing (CIDR) notation simplifies the process of subnetting by allowing us to use a "prefix length" to indicate how many bits are used for the network portion. This notation is written as an IP address followed by a /
and the number of bits used for the network portion.
For example:
- 192.168.1.0/24: This CIDR notation means the first 24 bits are the network portion, and the last 8 bits are available for host addresses within this subnet. This is commonly used for Class C addresses.
- 172.16.0.0/16: Here, the first 16 bits are the network portion, and the remaining bits are for hosts, typically used for Class B addresses.
4. Subnetting Example
Let’s look at how to create subnets within a Class C network using CIDR notation.
Suppose we have the network 192.168.1.0/24
. By default, this subnet mask (/24
) allows for 256 IP addresses (from 192.168.1.0 to 192.168.1.255), with 254 usable addresses for hosts.
Example: Dividing 192.168.1.0/24
into Smaller Subnets
If we want to divide this network into smaller segments (e.g., four subnets), we can extend the subnet mask by 2 more bits, creating a /26
mask (which uses the first 26 bits for the network portion).
- Subnet Mask:
255.255.255.192
or/26
- Number of Hosts per Subnet: Each
/26
subnet has 64 IP addresses, but 62 are usable for hosts (as the first address is the network address and the last is the broadcast address).
These four subnets would be:
- 192.168.1.0/26 - Host range:
192.168.1.1
to192.168.1.62
- 192.168.1.64/26 - Host range:
192.168.1.65
to192.168.1.126
- 192.168.1.128/26 - Host range:
192.168.1.129
to192.168.1.190
- 192.168.1.192/26 - Host range:
192.168.1.193
to192.168.1.254
This way, we have split the original Class C network into four subnets, each with 62 usable IP addresses.
5. Key Points for Subnetting with CIDR Notation
- Bits Used in Subnet Mask: The more bits we allocate to the network portion (the higher the
/
number), the fewer hosts each subnet can support. - Subnet Calculation Formula:
- Total Number of Subnets =
- Total Hosts per Subnet = (Subtracting 2 for the network and broadcast addresses)
- Total Number of Subnets =
Using these formulas, you can create customized subnets based on the specific needs of your network.
Comments
Post a Comment