You are on page 1of 44

Computer Networks

Netid and Hostid


an IP address in classes A, B, and C is divided
into netid and hostid.
These parts are of varying lengths, depending
on the class of the address.
Figure Netid and hostid
Classes and Blocks
One problem with classful addressing
- each class is divided into a fixed number of
blocks with each block having a fixed size.
Class A

Number of blocks in class A is 27 = 128 blocks.


Each block can be assigned to one organization.
Each block contains 16,777,216 addresses.
Figure Blocks in Class A
Note

Millions of class A addresses


are wasted.
Class B

Number of blocks in class B is 214 = 16,384.


Each block can be assigned to one organizations.
Each block contains 65,536 addresses.
Figure Blocks in Class B
Note

Many class B addresses are wasted.


Class C
Number of blocks in class C is 221 = 2,097,152.
Each block contains 256 addresses, that can be
assigned to 2,097,152 organizations
Each block contains 256 addresses.
Figure Blocks in Class C
Note

Not so many organizations are so small


to have a class C block.
Class D
Only one block of class D addresses, designed
for multicasting
Each address in this class is used to define one
group of hosts on the Internet.
Note

Class D addresses are made of one


block, used for multicasting.
Note

The only block of class E addresses was


reserved for future purposes.
Two-Level Addressing
When classful addressing was designed, it was
assumed that the whole Internet is divided into
many networks and each network connects
many hosts.
That is, the Internet was seen as a network of
networks.
A network was normally created by an
organization that wanted to be connected to the
Internet.
The range of addresses allocated to an
organization in classful addressing
was a block of addresses in
Class A, B, or C.
Since all addresses in a network belonged to a
single block, each address in classful addressing
contains two parts: netid and hostid.
Figure Two-level addressing in classful addressing
Extracting Information in a Block
Given any address in the block, we normally
like to know:
- the number of addresses
- the first address
- the last address.
For this, we need to know the class of the
address.
1. The number of addresses in the block,
N = 232−n.
2. To find the first address: keep the n leftmost
bits and set the (32 − n) rightmost bits to 0.
3. To find the last address: keep the n leftmost
bits and set the (32 − n) rightmost bits to 1s.
Figure Information extraction in classful addressing

netid 000 ... 0


First address
Example 7
An address in a block is given as 73.22.17.25. Find the number of
addresses in the block, the first address, and the last address.

Solution
1. The number of addresses in this block is N = 232−n =
16,777,216.
2. To find the first address, we keep the leftmost 8 bits and set the
rightmost 24 bits all to 0s. The first address is 73.0.0.0/8, in
which 8 is the value of n.
3. To find the last address, we keep the leftmost 8 bits and set the
rightmost 24 bits all to 1s. The last address is 73.255.255.255.
Figure Solution to Example 7
Example 8
An address in a block is given as 180.8.17.9. Find the number of
addresses in the block, the first address, and the last address.

Solution
1. The number of addresses in this block is N = 232−n = 65,536.
2. To find the first address, we keep the leftmost 16 bits and set
the rightmost 16 bits all to 0s. The first address is
18.8.0.0/16, in which 16 is the value of n.
3. To find the last address, we keep the leftmost 16 bits and set the
rightmost 16 bits all to 1s. The last address is
18.8.255.255.
Figure Solution to Example 8
Example 9
An address in a block is given as 200.11.8.45. Find the number of
addresses in the block, the first address, and the last address.

Solution
1. The number of addresses in this block is N = 232−n = 256.
2. To find the first address, we keep the leftmost 24 bits and set
the rightmost 8 bits all to 0s. The first address is
200.11.8.0/24, in which 24 is the value of n.
3. To find the last address, we keep the leftmost 24 bits and set the
rightmost 8 bits all to 1s. The last address is
200.11.8.255/24.
Figure Solution to Example 9
Example 10

Given the network address 17.0.0.0, find the class, the block, and
the range of the addresses.
Example 10

Given the network address 17.0.0.0, find the class, the block, and
the range of the addresses.

•Solution
The class is A because the first byte is between 0 and 127. The
block has a netid of 17. The addresses range from 17.0.0.0 to
17.255.255.255.
Example 11

 Given the network address 132.21.0.0, find the class, the block, and the range
of addresses.
Example 11

 Given the network address 132.21.0.0, find the class, the block, and the range
of addresses.

Solution

 The class is B, the block is 132.21, and the range is 132.21.0.0 to


132.21.255.255
Example 12

 Given the network address 220.34.76.0, find the class, the block, and the range
of addresses
Example 12

 Given the network address 220.34.76.0, find the class, the block, and the range
of addresses

Solution
 The class is C, the block is 220.34.76, and the range of addresses is
220.34.76.0 to 220.34.76.255
Network Address
- the first address of a block
- used in routing a packet to its destination network.
Note

The network address is the identifier of


a network.
Example 13

Given the address 23.56.7.91, find the beginning address


(network address).
Example 13

Given the address 23.56.7.91, find the beginning address


(network address).

Solution
The default mask is 255.0.0.0, which means that only the first
byte is preserved and the other 3 bytes are set to 0s. The network
address is 23.0.0.0.
Example 14

Given the address 132.6.17.85, find the beginning address


(network address).
Example 14

Given the address 132.6.17.85, find the beginning address


(network address).

Solution
The default mask is 255.255.0.0, which means that the first 2
bytes are preserved and the other 2 bytes are set to 0s. The
network address is 132.6.0.0.
Example 15

Given the address 201.180.56.5, find the beginning address


(network address).
Example 15

Given the address 201.180.56.5, find the beginning address


(network address).

Solution
The default mask is 255.255.255.0, which means that the first 3
bytes are preserved and the last byte is set to 0. The network
address is 201.180.56.0.

You might also like