IPv4 Addressing and Subnetting
IPv4 Addressing and Subnetting
com
0 0 0 0 0 0 0 0 =0
1 1 1 1 1 1 1 1 = 255
0 0 0 0 1 0 1 0 = 10
from right to left, 2nd bit = 2 and 4th bit = 8 = 2+8 = 10
00001010.01100100.00101000.10000000
(8+2) . (64+32+4) . (32+8) . 128 = 10.100.40.128
192 . 168 . 64 . 10
11000000 . 10101000 . 01000000 . 00001010
(128+64) . (128+32+8) . 64 . (8+2)
www.cisconetsolutions.com
Hexadecimal D = 1 1 0 1
8 4 0 1 = 8 + 4 + 1 = 13 decimal
Hexadecimal F = 1 1 1 1
8 4 2 1 = 8 + 4 + 2 + 1 = 15 decimal
10.0.0.0 - 10.255.255.255 /8
172.16.0.0 - 172.31.255.255 /12
192.168.0.0 - 192.168.255.255 /16
www.cisconetsolutions.com
* The host number does not include the network address and broadcast address. They are
reserved for each individual subnet and are not assignable to any hosts. For example
8 host bits = 28 = 256 - 2 = 254
www.cisconetsolutions.com
Subnetting Example 1:
What network address would allow the maximum number of subnets for 172.16.1.0/23 with 30
hosts? The subnet mask defines the network portion (bold) and host portion of an IP address.
The subnet mask /23 (255.255.254.0) assigns 23 bits to the network portion and 9 bits to host
portion. The number of assignable hosts is 29 = 512 - 2.
network | host
172.16.1.0 = 10101100.00010000.0000000 1.00000000
255.255.254.0 = 11111111.11111111.1111111 0.00000000
network | host
255.255.255.224 = 11111111.11111111.11111111.111 00000
The question asked for a maximum of 30 hosts. The subnet mask is used to modify the network
portion and consequently the host portion as well. Moving the subnet mask to the right will
increase the network portion and decrease the host portion assignable. Assigning the rightmost
5 bits provides a maximum of 30 hosts from the subnetting table (32 - 2). The network address
and broadcast address cannot be assigned to hosts.
The host portion must be decreased from 9 bits to 5 bits. That will require increasing the subnet
mask from /23 to /27.
Subnetting Example 2:
What IP address is assignable to a host based on subnet mask 255.255.255.224?
A. 192.168.10.31
B. 192.168.10.29
C. 192.168.10.0
D. 192.168.10.32
The network address and broadcast address are not assignable to hosts. The subnet multiple is
calculated based on the bit value of bit position 6. Subnet multiples start at 0 with multiples of 32
(0, 32, 64, 96, 128, 160, 192, 224).
network | host
11111111.11111111.11111111.111 00000
255. 255. 255. 224
Subnetting Example 3:
Select the correct network address and subnet mask that allows at least ten web servers (hosts)
to be assigned to the same subnet?
A. 192.168.100.0 255.255.255.252
B. 192.168.100.16 255.255.255.248
C. 192.168.100.16 255.255.255.240
D. 192.168.252.16 255.255.255.252
The subnet mask defines the network portion and host portion of a subnetted address.
Increasing the subnet mask length will increase the number of subnets available. Creating 10
host assignments for web servers requires at least 4 host bits. That allows for 14 host
assignments where network and broadcast addresses are not assignable.
The 255.255.255.240 (/28) subnet mask starts at the bit 5 of the 4th octet and has a decimal
value of 16. The subnets are multiples of 16 (0, 16, 32, 48 etc).
Subnetting Example 4:
What is the second IP address available for host assignment from 172.33.1.64/30?
A. 172.33.1.64
B. 172.33.1.65
C. 172.33.1.66
D. 172.33.1.1
www.cisconetsolutions.com
The IP address is a nondefault Class A address. The subnet mask defines the number of bits
assigned to the network portion and host portion. The /30 subnet mask creates a network
portion of 30 bits and a host portion of 2 bits. The number of host assignments available with 2
bits = 22 = 4. The network address and broadcast address are not assignable to hosts. As a
result the number of host assignments = 4 - 2 = 2 IP addresses. The following is a list of all IP
addresses for subnet 172.33.1.64/30.
network | host
172.33.1.64 = 10101100.00100001.00000001.010000 00
255.255.255.252 = 11111111.11111111.11111111.111111 00
The rightmost bit of the subnet mask (network bits) determines the subnet multiple and where it
starts. For this example, bit 3 of the 4th octet has a decimal value of 4. The subnet multiple
starts at 0 with multiples of 4 (0, 4, 8, 12 etc). The next subnet available is 172.33.1.68/30.
Interfaces on the same router must be assigned to different subnets.
Wildcard Masks
The wildcard mask is a technique to match an IP address or range of IP addresses. It is used by
routing protocols and access control lists (ACL) to manage routing and packet filtering. The
wildcard mask is an inverted mask where the matching IP address or range is based on 0 bits.
The additional bits are set to 1 as no match required. The wildcard 0.0.0.0 is used to match a
single IP address. Wildcard mask for 255.255.224.0 is 0.0.31.255 (invert the bits so zero=1 and
one=0)
192. 168. 3. 0
11000000.10101000.00000011.00000000
00000000.00000000.00000000.11111111 = 0.0.0.255
www.cisconetsolutions.com
192. 168. 4. 0
11000000.10101000.00000100.00000000
00000000.00000000.00000000.00000011 = 0.0.0.3
The CIDR notation denotes the number of bits in the subnet mask. For instance a class C
address with subnet mask 255.255.255.240 = /28