IP Addressing
IP Addressing
10
Classless Addressing
• To simplify the handling of addresses, the internet authorities
impose three restriction on classless address blocks
• The address in a block must be contiguous, one after another
• The number of addresses in a block must be a power of
2(1,2,4,8,16…)
• The first address must be evenly divisible
• Example: A classless IP address assigned to a small organization
with only 16 IP Addresses
205.16.37.32
205.16.37.33
.
.
.
205.16.37.47
11
Classless Addressing
• A better way to define a block of address in classless addressing is
to select any address in the block and mask it.
• A mask is a 32bit number in which the n left most bits are 1s and
the 32-n rightmost bits are 0s.
• The mask can take a value from 0 to 32
• IN IPV4 classless addressing a block of addresses can be defined as
x.y.z.t/n in which x.y.z.t defines one of the addresses and the /n
defines the mask
• The address and /n notation completely define the whole block
( the first address, the last address , and the number of addresses.
• The first address in the block can be found by setting the 32-n right
most bits in the binary notation of the address 0.
• The last address in the block can be found by setting the rightmost
32-n bits to 1s.
12
Classless Addressing
• The number of address in the block can be found by using the
formula 232-n
• Example: Find the first address, the last address and the number of
addresses in the following classless block 205.16.37.39/28
Solution
Step 1: Convert the dotted decimal representation into binary
representation 11001101 00010000 00100101 00100111
Step 2: To find the first address in the block convert the 32-28 right
most bits to 0.
11001101 00010000 00100101 00100000=205.16.37.32.
Step 3: To find the last address in the block convert the 32-28 right
most bits to 1.
11001101 00010000 00100101 00101111=205.16.37.47.
Step 4: The number of address is 232-28 is 16.
13
Addressing the Network
The subnet mask: Is it on my network?
IPv4 address has a network portion and a host portion
Subnet mask is used to create and specify the network and host portions
We referred to the prefix length as the number of bits in the address giving us the
network portion
The prefix and the subnet mask are different ways of representing the network
portion of an address
Addressing the Network
The subnet mask: The Network Address
When an IPv4 packet is created or forwarded, the destination network address
must be extracted from the destination address.
This is done by a logic called AND
The IPv4 host address is logically ANDed with its subnet mask to determine the
network address to which the host is associated
When this ANDing between the address and the subnet mask is performed,
the result yields the network address
Anding operation:
1 AND 1 = 1
1 AND 0 = 0
0 AND 1 = 0
0 AND 0 = 0
Addressing the Network
The subnet mask: The Network Address
Example: ANDing of an IPv4 host address and subnet mask
Addressing the network
Subnetting Basics
With this addressing, we have subnets 4, 5, and 7 available for future networks, as
well as several other subnets available for WANs.