Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 14

Network layer problems

IP addressing
1. An Internet Service Provider(ISP) has the following
chunk of CIDR-based IP addresses available with
it:245.248.128.0/20. The ISP wants to give half of this
chunk of addresses to Organization A, and a quarter
to Organization B, while retaining the remaining with
itself. Which of the following is a valid allocation of
addresses to A and B?
(A) 245.248.136.0/21 and 245.248.128.0/22
(B) 245.248.128.0/21 and 245.248.128.0/22
(C) 245.248.132.0/22 and 245.248.132.0/21
(D) 245.248.136.0/22 and 245.248.132.0/21
Solution for problem
Since routing prefix is 20,
the ISP has 2^(32-20) or 2^12 addresses.
Out of these 2^12 addresses, half (or 2^11) addresses have to be given to organization A
and quarter (2^10) addresses have to be given to organization B.
So routing prefix for organization A will be 21. For B, it will be 22.
If we see all options given in question, only options (A) and (B) are left as only these
options have same number of routing prefixes. Now we need to choose from option (A)
and (B).

To assign addresses to organization A, ISP needs to take first 20 bits from 245.248.128.0
and fix the 21st bit as 0 or 1. Similarly, ISP needs to fix 21st and 22nd bits for organization
B. If we take a closer look at the options (A) and (B),

we can see the 21st and 22nd bits for organization B are considered as 0 in both options.
So 21st bit of organization A must be 1. Now take the first 20 bits from 245.248.128.0 and
21st bit as 1, we get addresses for organization A as 245.248.136.0/21
Block address and subnet
In a block address, we know the IP address of
one host is 182.44.82.16/26. What are the first
address (network address) and the last address
(limited broadcast address) in this block?
Block address and subnet
In a block address, we know the IP address of
one host is 182.44.82.16/26. What are the first
address (network address) and the last address
(limited broadcast address) in this block?

Answer
182.44.82.0 is the subnet address
182.44.82.63 is the broadcast address
Block address and subnet
An organization is granted the block
130.56.0.0/16. The administrator wants to
create 1024 subnets.
a. Find the subnet mask.
b. Find the number of addresses in each subnet.
c. Find the first and last addresses in subnet 1.
d. Find the first and last addresses in subnet
1024.
Block address and subnet
Answer

a) 255.255.255.192 will be the subnet mask

b) 62 valid addresses can exist in each subnet

c) First address in subnet 1 will be 130.56.0.1 and last address is


subnet 1 will be 130.56.0.62

d) First address is 1024 subnet will be 130.56.255.193 and last


address in 1024 subnet will be 130.56.255.254
Subnet mask
If a class B network on the Internet has a subnet
mask of 255.255.248.0, what is the maximum
number of hosts per subnet?
(A) 1022
(B) 1023
(C) 2046
(D) 2047
Subnet mask
If a class B network on the Internet has a subnet mask of 255.255.248.0, what is the
maximum number of hosts per subnet?
(A) 1022
(B) 1023
(C) 2046
(D) 2047

Answer (C)

The binary representation of subnet mask is 11111111.11111111.11111000.00000000.


There are 21 bits set in subnet. So 11 (32-21) bits are left for host ids. Total possible values
of host ids is 2^11 = 2048. Out of these 2048 values, 2 addresses are reserved. The address
with all bits as 1 is reserved as broadcast address and address with all host id bits as 0 is
used as network address of subnet.
In general, the number of addresses usable for addressing specific hosts in each network is
always 2^N – 2 where N is the number of bits for host id.
Subnet mask
The address of a class B host is to be split into
subnets with a 6-bit subnet number. What is the
maximum number of subnets and the maximum
number of hosts in each subnet?
(A) 62 subnets and 262142 hosts.
(B) 64 subnets and 262142 hosts.
(C) 62 subnets and 1022 hosts.
(D) 64 subnets and 1024 hosts.
Subnet mask
The address of a class B host is to be split into subnets with a 6-bit subnet number. What is the
maximum number of subnets and the maximum number of hosts in each subnet?
(A) 62 subnets and 262142 hosts.
(B) 64 subnets and 262142 hosts.
(C) 62 subnets and 1022 hosts.
(D) 64 subnets and 1024 hosts.

Answer (C)
Maximum number of subnets = 2^6-2 =62.
Note that 2 is subtracted from 2^6. The RFC 950 specification reserves the subnet values consisting of
all zeros (see above) and all ones (broadcast), reducing the number of available subnets by two.

Maximum number of hosts is 2^10-2 = 1022.


2 is subtracted for Number of hosts is also. The address with all bits as 1 is reserved as broadcast
address and address with all host id bits as 0 is used as network address of subnet.
In general, the number of addresses usable for addressing specific hosts in each network is always 2^N
– 2 where N is the number of bits for host id.
See this for details
Longest Prefix Matching
Classless Inter-domain Routing (CIDR) receives a packet with address 131.23.151.76.
The router’s routing table has the following entries:

Prefix Output Interface Identifier


131.16.0.0/12 3
131.28.0.0/14 5
131.19.0.0/16 2
131.22.0.0/15 1

The identifier of the output interface on which this packet will be forwarded is ______.
(A) 1
(B) 2
(C) 3
(D) 5
Longest Prefix Matching
Answer: (A)

Explanation: In this question, we need to find out Netmask for each entry and BITWISE
AND with given packet address, whichever equals the Netid, is the ans. Ex. 1st entry in
table: 131.16.0.0/12.
its MASK is first 12 bits of network(they are all 1) and remaining 20 bits of host(they are all
0). so MASK is 255.240.0.0 AND 131.23.151.76 = 131.16.0.0. Last entry is 131.22.0.0/15
MASK—>255.254.0.0 AND 131.23.151.76 = 131.22.0.0. Two ans coming interfaces 1,3.

Longest Prefix Matching is used to decide among two. When one destination address
matches more than one forwarding table entry. The most specific of the matching table
entries is used as the interface.

The interface 1 has the longest matching prefix with the input IP address. Therefore 1 is
chosen.
• Thank you

You might also like