The Subnetmask defines how big the subnet is.
That means – how many Client-PCs will have place in
that subnetwork.
A Subnetmask of 255.255.255.0 means in binary
11111111.11111111.11111111.00000000
So, what do we see?
4 Blocks, divided with a “.”. Each of these blocks is also
called “octett”.Because – each Block has 8 bits.
To be able to do subnet-calculation, we first must
understand binary calculation.
Lets take the first block.
The first “1″ stands for a 128.
The second “1″ stands for a 64.
The third “1″ stands for a 32.
The fourth “1″ stands for a 16.
The fifth “1″ stands for a 8.
And so on. That means:
11111111=255
11110000=240
11100000=224
If we see something like “/24″, that means that
24 bits are set to “1″,
from the left side.
Examples:
/16 = 255.255.0.0 = 11111111.11111111.00000000.00000000
/20 = 255.255.240.0 = 11111111.11111111.11110000
If we would take a subnetmask of 255.255.255.255 that would
be
128+64+32+16+8+4+2+1.128+64+32+16+8+4+2+1.
128+64+32+16+8+4+2+1.
128+64+32+16+8+4+2+1
and in binary it would be
11111111.11111111.11111111.11111111
Calculation of Subnetmask big enough for a
specified number of Hosts
If they ask..
“create a subnet with minimum 10 host IPs”
than
1. calculate a power of two, that is minimum 10
2^3=8. That is not enough
2^4=16 That is higher than 10. Good.
2. Now put the LAST 4 Bits of your subnetmask to 0.
11111111.11111111.11111111.11110000
That is in decimal
255.255.255.240
With THIS Subnetmask, you have minimum 10 Host-Ips
in the Subnet,without wasting to much IP-Addresses.
————————————————————
Other example
If they ask
Create a subnet with minimum 70 Host-IPs
1. Calculate a Power of 2 that is MINIMUM 70
2^6=64. Not enough.
2^7=128. Thats higher than 70. Good.
2. Put the LAST 7 Bits of your Subnetmask to 0.
11111111.11111111.11111111.10000000
That is in decimal
255.255.255.128
You have a Subnetmask, with more than 70 Host-IPs.
————————————————————————-
Calculation what is the Broadcast-IP of a Subnet
When they ask
“There is subnet 172.16.64.0/20. What is the BROADCAST
ADDRESS
of that Subnet ,dude?”
1. Step
/20 meens 255.255.240.0
2. Step
Now analyze the Subnet Oktett to find out the
“network-jumps”
240 means 11110000
The LAST of the 1s is under decimal 16.
That are our “network jumps”
(128/64/32/16/8/4/2/1)
3. Step
Write down the network-jumps
172.16.64.0 – 172.16.79.255
+16 172.16.80.0 – 172.16.95.255
+16 172.16.96.0 – 172.16.111.255
+16 172.16.112.0 – 172.16.127.255
Because the NEXT Subnet in the example is
172.16.80.0, the broadcast must be 172.16.79.255,
cause THAT is the IP BEFORE the next
Subnet starts = the BroadcastAddress.
————————
Other example of Broadcast-IP calculation:
If it would be 172.16.64.0 /26
Same procedure
/26 means 255.255.255.192
192 is binary 11000000
The LAST 1 stands under the 64.
That are in that example our “net-jumps”.
172.16.64.0 – 172.16.64.63 <<64 – 172.16.64.127
172.16.64.128 – 172.16.64.191
———————————————————————
Calculating first and last possible IP for a Host
You have Network 192.168.20.32 /27
The very first IP is reserved for Default Gateway!
What is the first and last valid IP for a Host-PC?
1.Step
/27 is 255.255.255.224
2.Step
224 means 11100000
The LAST 1 is under the 32.
That are our “network-jumps” in this example
(128/64/32/16/8/4/2/1)
Valid IPs in that subnet:
192.168.20.33 – 192.168.20.62
(192.168.20.63 is NOT useable, this is the very
last IP and so the BROADCAST-IP).
192.168.20.64 <<
So, because the very first IP is
reserved
for Default Gateway, our first Host-PC IP would be
192.168.20.34
The very last Host-PC IP would be
192.168.20.62
###################################################################
Here some examples of real exam questions, and
step by step solutions:
Given that you have a class B IP address network range,
which of the subnet masks below will allow for 100
subnets with 500 usable host addresses per subnet?
A. 255.255.0.0
B. 255.255.224.0
C. 255.255.254.0
D. 255.255.255.0
E. 255.255.255.224
Solution:
Allways the same game… Like in 5 minute course..
Power of 2 that is minimum 500?
2^7=128
2^8=256
2^9=512 >>voila!
Now – put the last 9 Bits of your Subnetmask to “0″
11111111.11111111.11111110.00000000
That is in decimal
255.255.254.0
=====================================================================
If a host on a network has the address 172.16.45.14/30,
what is the address of the subnetwork to which this
host belongs?
A. 172.16.45.0
B. 172.16.45.4
C. 172.16.45.8
D. 172.16.45.12
E. 172.16.45.18
Solution:
172.16.45.14/30
/30 means 11111111.11111111.11111111.11111100
The last of the ones stands under the “4″.
That is our increment or network jump.
172.16.45.0 – 172.16.45.3
172.16.45.4 – 172.16.45.7
172.16.45.8 – 172.16.45.11
172.16.45.12 – 172.16.45.15
172.16.45.16 – 172.16.45.19
As we see, the Ip is in the Range of
172.16.45.12 – 172.16.45.15.
So the network Address is 172.16.45.12
=================================================
QUESTION NO: 9
Which two of the addresses below are available for
host addresses on the subnet 192.168.15.19/28?
(Select two answer choices)
A. 192.168.15.17
B. 192.168.15.14
C. 192.168.15.29
D. 192.168.15.16
E. 192.168.15.31
F. None of the above
Solution:
/28 means 11111111.11111111.11111111.11110000
The last 1 stands under the 16. This is increment
or network-jumps.
192.168.15.0 – 192.168.15.15
192.168.15.16 – 192.168.15.31
192.168.15.32 – 192.168.15.47
Only A and C are IPs in the right range.
Also E is in the right range.
But – this is not useable for hosts,
cause its broadcastaddress.
So answer is A and C.
################################################################
————————————————————————————————————————-
Calculation of Wildcard-Masks
(Needed for Access Lists and OSPF Configuration)
You have Network 192.168.32.0 /28
Only THIS network should be denied of accessing a network
or server.
1. Step
calculate the wildcard mask
/28 means 255.255.255.240
binary this is
11111111.11111111.11111111.11110000
For wildcard-mask only the ZEROS are interesting.
11110000 Make a addition of all the fields, that are set to zero
128/64/32/16/8/4/2/1
That is 8+4+2+1=15
So the wildcard-mask will be
0.0.0.15
access-list will be
access-list 1 deny 192.168.32.0 0.0.0.15
access-list 1 permit ip any any
now, we have to bind that access-list to a routerinterface.
In the example, this is e0.
interface e0
ip access-group 1 out (or in!)
exit
————————————————————————————————————————-
PS.
Its good to write on a BIG paper the powers of 2
2^2=4
2^3=8
2^4=16
2^5=32
2^6=64
2^7=128
2^8=256
2^9=512
2^10=1024
2^11=2048
2^12=4096
And write on that paper the numbers
128 192 224 240 248 252 254
Cause this are the Numbers, you will allways need
in calculating Subnets.
Burn them in your mind! Hang the paper in front
of your eyes to never forget them.Then you will be able
to calculate Subnets in your head in a half second!
Isnt live easy?