Skip to main content

What is Subnet Mask?



An IP address has two components, the network address and the host address. A subnet mask separates the IP address into the network and host addresses (<network><host>). Subnetting further divides the host part of an IP address into a subnet and host address (<network><subnet><host>). It is called a subnet mask because it is used to identify network address of an IP address by perfoming bitwise AND operation on the netmask.
A Subnet mask is a 32-bit number that masks an IP address, and divides the IP address into network address and host address. Subnet Mask is made by setting network bits to all "1"s and setting host bits to all "0"s. Within a given network, two host addresses are reserved for special purpose. The "0" address is assigned a network address and "255" is assigned to a broadcast address, and they cannot be assigned to a host.
Examples of commonly used netmasks for classed networks are 8-bits (Class A), 16-bits (Class B) and 24-bits (Class C), and classless networks are as follows:
ClassAddress# of HostsNetmask (Binary)Netmask (Decimal)
CIDR/4240,435,45611110000 00000000 00000000 00000000240.0.0.0
CIDR/5134,217,72811111000 00000000 00000000 00000000248.0.0.0
CIDR/667,108,86411111100 00000000 00000000 00000000252.0.0.0
CIDR/733,554,43211111110 00000000 00000000 00000000254.0.0.0
A/816,777,21611111111 00000000 00000000 00000000255.0.0.0
CIDR/98,388,60811111111 10000000 00000000 00000000255.128.0.0
CIDR/104,194,30411111111 11000000 00000000 00000000255.192.0.0
CIDR/112,097,15211111111 11100000 00000000 00000000255.224.0.0
CIDR/121,048,57611111111 11110000 00000000 00000000255.240.0.0
CIDR/13524,28811111111 11111000 00000000 00000000255.248.0.0
CIDR/14262,14411111111 11111100 00000000 00000000255.252.0.0
CIDR/15131,07211111111 11111110 00000000 00000000255.254.0.0
B/1665,53411111111 11111111 00000000 00000000255.255.0.0
CIDR/1732,76811111111 11111111 10000000 00000000255.255.128.0
CIDR/1816,38411111111 11111111 11000000 00000000255.255.192.0
CIDR/198,19211111111 11111111 11100000 00000000255.255.224.0
CIDR/204,09611111111 11111111 11110000 00000000255.255.240.0
CIDR/212,04811111111 11111111 11111000 00000000255.255.248.0
CIDR/221,02411111111 11111111 11111100 00000000255.255.252.0
CIDR/2351211111111 11111111 11111110 00000000255.255.254.0
C/2425611111111 11111111 11111111 00000000255.255.255.0
CIDR/2512811111111 11111111 11111111 10000000255.255.255.128
CIDR/266411111111 11111111 11111111 11000000255.255.255.192
CIDR/273211111111 11111111 11111111 11100000255.255.255.224
CIDR/281611111111 11111111 11111111 11110000255.255.255.240
CIDR/29811111111 11111111 11111111 11111000255.255.255.248
CIDR/30411111111 11111111 11111111 11111100255.255.255.252


Subnetting an IP network is to separate a big network into smaller multiple networks for reorganization and security purposes. All nodes (hosts) in a subnetwork see all packets transmitted by any node in a network. Performance of a network is adversely affected under heavy traffic load due to collisions and retransmissions.
Applying a subnet mask to an IP address separates network address from host address. The network bits are represented by the 1's in the mask, and the host bits are represented by 0's. Performing a bitwise logical AND operation on the IP address with the subnet mask produces the network address. For example, applying the Class C subnet mask to our IP address 216.3.128.12 produces the following network address:
IP:   1101 1000 . 0000 0011 . 1000 0000 . 0000 1100  (216.003.128.012)
Mask: 1111 1111 . 1111 1111 . 1111 1111 . 0000 0000  (255.255.255.000)
      ---------------------------------------------
      1101 1000 . 0000 0011 . 1000 0000 . 0000 0000  (216.003.128.000)


Subnetting Network 
Here is another scenario where subnetting is needed. Pretend that a web host with a Class C network needs to divide the network so that parts of the network can be leased to its customers. Let's assume that a host has a network address of 216.3.128.0 (as shown in the example above). Let's say that we're going to divide the network into 2 and dedicate the first half to itself, and the other half to its customers.
216 .   3 . 128 . (0000 0000)  (1st half assigned to the web host)
   216 .   3 . 128 . (1000 0000)  (2nd half assigned to the customers)
The web host will have the subnet mask of 216.3.128.128 (/25). Now, we'll further divide the 2nd half into eight block of 16 IP addresses.
216 .   3 . 128 . (1000 0000)  Customer 1 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1001 0000)  Customer 2 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1010 0000)  Customer 3 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1011 0000)  Customer 4 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1100 0000)  Customer 5 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1101 0000)  Customer 6 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1110 0000)  Customer 7 -- Gets 16 IPs (14 usable)
   216 .   3 . 128 . (1111 0000)  Customer 8 -- Gets 16 IPs (14 usable)
   -----------------------------
   255 . 255 . 255 . (1111 0000)  (Subnet mask of 255.255.255.240)


CIDR - Classless Inter Domain Routing 
Classless InterDomain Routing (CIDR) was invented to keep the Internet from running out of IP Addresses. The IPv4, a 32-bit, addresses have a limit of 4,294,967,296 (232) unique IP addresses. The classful address scheme (Class A, B and C) of allocating IP addresses in 8-bit increments can be very wasteful. With classful addressing scheme, a minimum number of IP addresses allocated to an organization is 256 (Class C). Giving 256 IP addresses to an organization only requiring 15 IP addresses is wasteful. Also, an organization requiring more than 256 IP addresses (let's say 1,000 IP addresses) is assigned a Class B, which allocates 65,536 IP addresses. Similarly, an organization requiring more than 65,636 (65,634 usable IPs) is assigned a Class A network, which allocates 16,777,216 (16.7 Million) IP addresses. This type of address allocation is very wasteful.
With CIDR, a network of IP addresses is allocated in 1-bit increments as opposed to 8-bits in classful network. The use of a CIDR notated address can easily represent classful addresses (Class A = /8, Class B = /16, and Class C = /24). The number next to the slash (i.e. /8) represents the number of bits assigned to the network address. The example shown above can be illustrated with CIDR as follows:
216.3.128.12, with subnet mask of 255.255.255.128 is written as
   216.3.128.12/25

   Similarly, the 8 customers with the block of 16 IP addresses can be
   written as:

   216.3.128.129/28, 216.3.128.130/28, and etc.
With an introduction of CIDR addressing scheme, IP addresses are more efficiently allocated to ISPs and customers; and hence there is less risk of IP addresses running out anytime soon. For detailed specification on CIDR, please review RFC 1519. With introduction of additional gaming, medical, applicance and telecom devices requiring static IP addresses in addition to more than 6.5 billion (July 2006 est.) world population, the IPv4 addresses with CIDR addressing scheme will eventually run out. To solve shortage of IPv4 addresses, the IPv6 (128-bit) address scheme was introduced in 1993.

Popular posts from this blog

HOW TO EDIT THE BCD REGISTRY FILE

The BCD registry file controls which operating system installation starts and how long the boot manager waits before starting Windows. Basically, it’s like the Boot.ini file in earlier versions of Windows. If you need to edit it, the easiest way is to use the Startup And Recovery tool from within Vista. Just follow these steps: 1. Click Start. Right-click Computer, and then click Properties. 2. Click Advanced System Settings. 3. On the Advanced tab, under Startup and Recovery, click Settings. 4. Click the Default Operating System list, and edit other startup settings. Then, click OK. Same as Windows XP, right? But you’re probably not here because you couldn’t find that dialog box. You’re probably here because Windows Vista won’t start. In that case, you shouldn’t even worry about editing the BCD. Just run Startup Repair, and let the tool do what it’s supposed to. If you’re an advanced user, like an IT guy, you might want to edit the BCD file yourself. You can do this

DNS Scavenging.

                        DNS Scavenging is a great answer to a problem that has been nagging everyone since RFC 2136 came out way back in 1997.  Despite many clever methods of ensuring that clients and DHCP servers that perform dynamic updates clean up after themselves sometimes DNS can get messy.  Remember that old test server that you built two years ago that caught fire before it could be used?  Probably not.  DNS still remembers it though.  There are two big issues with DNS scavenging that seem to come up a lot: "I'm hitting this 'scavenge now' button like a snare drum and nothing is happening.  Why?" or "I woke up this morning, my DNS zones are nearly empty and Active Directory is sitting in a corner rocking back and forth crying.  What happened?" This post should help us figure out when the first issue will happen and completely avoid the second.  We'll go through how scavenging is setup then I'll give you my best practices.  Scavenging s

AD LDS – Syncronizing AD LDS with Active Directory

First, we will install the AD LDS Instance: 1. Create and AD LDS instance by clicking Start -> Administrative Tools -> Active Directory Lightweight Directory Services Setup Wizard. The Setup Wizard appears. 2. Click Next . The Setup Options dialog box appears. For the sake of this guide, a unique instance will be the primary focus. I will have a separate post regarding AD LDS replication at some point in the near future. 3. Select A unique instance . 4. Click Next and the Instance Name dialog box appears. The instance name will help you identify and differentiate it from other instances that you may have installed on the same end point. The instance name will be listed in the data directory for the instance as well as in the Add or Remove Programs snap-in. 5. Enter a unique instance name, for example IDG. 6. Click Next to display the Ports configuration dialog box. 7. Leave ports at their default values unless you have conflicts with the default values. 8. Click N