Network Engineer's Networking IP Subnet Mask Allocation

Published 2022-12-23 20:54 411 words 3 min read

Primary Introduction When learning network engineering, you will often need to divide network segments yourself. (Nothing much to write at home during the holiday, so here's a filler post.) For...

Primary Introduction

When learning network engineering, you will often need to divide network segments yourself. (Nothing much to write at home during the holiday, so here’s a filler post.)

For example: Given a company has 192.168.1.0/24, with four departments A, B, C, D, each with 30 computers, please plan their subnet IPs.

Read the Problem Carefully Before Solving

The problem is assumed as follows: Given a company has 192.168.1.0/24, with four departments A, B, C, D, each with 30 computers, please plan their subnet IPs. So we need 4 subnets, 30 hosts, mask 24. The 24-bit binary conversion is 11111111.11111111.11111111.00000000.

Subnetting Correctly After Reviewing the Problem

As we all know, subnetting is achieved by sacrificing host bits, which means occupying one host bit at a time.

Now define the sacrificed host bits as n. The formula is: 2^n ≥ the number of subnets to be divided. According to the formula, we need to occupy 2 host bits, but the key point is: the host number and subnet number are not allowed to be all 0s or all 1s. When you choose to occupy two bits, the mask becomes: 255.255.255.192.

Convert to binary:

11111111.11111111.11111111.00000000 # not usable 11111111.11111111.11111111.01000000 11111111.11111111.11111111.10000000 11111111.11111111.11111111.11000000 # not usable

Because the host number and subnet number cannot be all 0s or all 1s, the first and last ones are in an unusable state. So in reality only two subnets are allocated, which does not meet the requirement.

So I need to occupy one more bit. After occupying three bits, the subnet mask becomes: 255.255.255.224. Converted to binary:

11111111.11111111.11111111.00000000 # not usable 11111111.11111111.11111111.00100000 11111111.11111111.11111111.01000000 11111111.11111111.11111111.01100000 11111111.11111111.11111111.10000000 11111111.11111111.11111111.10100000 11111111.11111111.11111111.11000000 11111111.11111111.11111111.11100000 # not usable

But this gives us eight, with two unusable. We only need to use four, so just take the first four and keep the rest as spare. Then the subnets converted are:

255.255.255.32 255.255.255.64 255.255.255.96 255.255.255.128 255.255.255.160 255.255.255.192

Calculating Usable IPs

Let’s calculate the usable IPs:

255.255.255.32: 00100000-00111111 255.255.255.64:01000000-01011111 255.255.255.96:01100000-01111111 255.255.255.128:10000000-10011111 255.255.255.160:not needed, keep as spare 255.255.255.192:not needed, keep as spare

Because in an IP, the first address is the subnet address and the last is the broadcast address — this is the rule. Then convert:

255.255.255.32: 001 00001-001 11110 255.255.255.64:010 00001-010 11110 255.255.255.96:011 00001-011 11110 255.255.255.128:100 00001-100 11110

So the usable IPs are:

192.168.2.33- 192.168.2.62 subnet: 192.168.2.32 192.168.2.65- 192.168.2.94 subnet: 192.168.2.64 192.168.2.97- 192.168.2.126 subnet: 192.168.2.96 192.168.2.129- 192.168.2.158 subnet: 192.168.2.128

Practice Makes Perfect

Keep going, network engineers!

If you enjoyed this, leave a comment~

... Page views
© 2021 - 2026 Vullfin @VV
Powered by theme astro-koharu · Inspired by Shoka