Search this blog ...

Friday, September 24, 2010

IP Subnetting Manual Calculation

Here is a nifty online subnetting calculator http://www.subnet-calculator.com/

And here is an excellent doc that describes how the calculation is made http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800a67f5.shtml

Below are some manual calculations that I performed:

The machines has an ip address 10.228.137.4, with assigned subnet mask 255.255.248.0

This IP addresses falls in the Network Class A range (1.0.0.0 - 127.255.255.255)

Thus, it has a standard network mask of 255.0.0.0

Representing 255.255.248.0 in binary :-

(n = standard network mask)

(s = subnet bits claimed)

(h = available host bits)

n   n   n   n   n   n   n   n     s   s   s   s   s   s   s   s     s   s   s   s   s   h   h   h     h   h   h   h   h   h   h   h
128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001 

             255                               255                         128+64+32+16+8 = 248

meaning 13 bits (8 + 5) are now being repurposed for subnet bits
2^13 = 8192 maximum subnets

8 standard network mask bits + 13 repurposed bits = 21 mask bits in total.

11 bits (3 + 8) remain for hosts
2^11 = 2048 ;
subtract 1 for broadcast address; subtract 1 as host ids all 0 are now allowed; = 2046 hosts per subnet

# 21 mask bits activated, 11 bits remaining for host
n   n   n   n   n   n   n   n     s   s   s   s   s   s   s   s     s   s   s   s   s   h   h   h     h   h   h   h   h   h   h   h
128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001   128 064 032 016 008 004 002 001 

# representing 10.228.137.4 as binary
0   0   0   0   1   0   1   0     1   1   1   0   0   1   0   0     1   0   0   0   1   0   0   1     0   0   0   0   0   1   0   0

# leaving the host/subnet portion unchanged, zero out the host bits
0   0   0   0   1   0   1   0     1   1   1   0   0   1   0   0     1   0   0   0   1   0   0   0     0   0   0   0   0   0   0   0
# = 10.228.136.0

# leaving the host/subnet portion unchanged, replace host bits with all 1's
0   0   0   0   1   0   1   0     1   1   1   0   0   1   0   0     1   0   0   0   1   1   1   1     1   1   1   1   1   1   1   1
# = 10.228.143.255

thus current mask 255.255.248.0 using ip 10.228.137.4 falls is in the subnet with range 10.228.136.1 through 10.228.143.254

given we have 21 mask bits (8 standard network mask bits + 13 repurposed bits) .. we could write the above subnet as...

10.228.136.0/21

No comments:

Post a Comment