- This topic has 0 replies, 1 voice, and was last updated 19 hours, 33 minutes ago by
Pankaj6in.
- AuthorPosts
Pankaj6in
KeymasterA subnet mask is a 32-bit number (for IPv4) that defines which portion of an IP address identifies the network and which portion identifies the host. It works hand-in-hand with the IP address to determine where packets should be delivered in a network.
________________________________________
1. Purpose of a Subnet Mask
An IPv4 address is split into two parts:
• Network part: Identifies the network where the device belongs.
• Host part: Identifies the specific device in that network.
The subnet mask uses binary 1’s to represent the network bits and binary 0’s for host bits.
For example:
• IP Address: 192.168.10.25
• Subnet Mask: 255.255.255.0
• Binary mask: 11111111.11111111.11111111.00000000
Here, the first 24 bits (the 1’s) are network bits, and the last 8 bits (the 0’s) are host bits.
________________________________________
2. How It Works
When a device receives an IP packet, it applies the subnet mask using a bitwise AND operation to find the network address.
Example:
• IP: 192.168.10.25
• Mask: 255.255.255.0
• Network Address: 192.168.10.0
If the destination network address matches the device’s own network, it sends packets directly; otherwise, it forwards them to a router.
________________________________________
3. Subnet Mask Types
• Classful Masks (older method):
o Class A: 255.0.0.0 (/8)
o Class B: 255.255.0.0 (/16)
o Class C: 255.255.255.0 (/24)
• Classless Masks (CIDR – Classless Inter-Domain Routing):
o Can have variable-length subnet masks (VLSM) like /27 or /30 for more granular control.
________________________________________
4. Why We Use Subnet Masks
• Efficient IP Allocation: Break large networks into smaller subnets to reduce IP wastage.
• Improved Security: Limit broadcast domains to control access.
• Better Performance: Smaller subnets reduce unnecessary broadcast traffic.
________________________________________
5. OEM Examples
Different networking equipment vendors use subnet masks in configuration but may have different interfaces or commands.
Cisco
In Cisco IOS:
plaintext
CopyEdit
Router(config)# interface GigabitEthernet0/0
Router(config-if)# ip address 192.168.10.1 255.255.255.0
Here, 255.255.255.0 defines a /24 subnet.
________________________________________
Juniper Networks
In Junos OS, subnet masks are given in CIDR notation:
plaintext
CopyEdit
set interfaces ge-0/0/1 unit 0 family inet address 192.168.10.1/24
Here, /24 means the mask is 255.255.255.0.
________________________________________
HPE Aruba
In ArubaOS-Switch CLI:
plaintext
CopyEdit
switch(config)# vlan 10
switch(vlan-10)# ip address 192.168.10.1 255.255.255.0
This assigns the subnet mask to VLAN 10’s IP.
________________________________________
MikroTik RouterOS
In WinBox or CLI:
plaintext
CopyEdit
/ip address add address=192.168.10.1/24 interface=ether1
Here, /24 is the subnet mask equivalent to 255.255.255.0.
________________________________________
6. Practical Example
Suppose a company has 192.168.10.0/24 (255.255.255.0). It can split it into smaller subnets using different masks:
• 192.168.10.0/26 → 64 IPs per subnet
• 192.168.10.64/26 → next block of 64 IPs
This helps allocate IPs to different departments efficiently.
________________________________________
In summary, a subnet mask is like a “filter” that separates the network from the host portion of an IP address. Whether you configure a Cisco router, Juniper firewall, HPE Aruba switch, or MikroTik device, the subnet mask serves the same function—it defines the network boundary so devices know where to send traffic.- AuthorPosts