Sunteți pe pagina 1din 51

Network Layer

IP Addressing & ROUTING


McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Network Layer Design Issues

Implementation of Connectionless Service


Implementation of Connection-Oriented Service
Comparison of Virtual-Circuit and Datagram Subnets

Implementation of Connectionless Service


Routing within a diagram subnet.

Implementation of Connection-Oriented Service

Routing within a virtual-circuit subnet.

Network Layer
Logical Addressing Scheme
(IP Addressing)

IPv4 ADDRESSES
An IPv4 address is a 32-bit address that uniquely and
universally defines the connection of a device (for
example, a computer or a router) to the Internet.

Network Layer covers:


Classeful Addressing
Classless Addressing
Routing

IPV4

An IPv4 address is 32 bits long.

IPV4

The IPv4 addresses are unique


and universal.

IPV4

The address space of IPv4 is


232 or 4,294,967,296.

Dotted-decimal notation and binary notation for an IPv4 address

Example 1
Change the following IPv4 addresses from binary
notation to dotted-decimal notation.

Solution
We replace each group of 8 bits with its equivalent
decimal number and add dots for separation.

Classfull Addressing
In classful addressing, the address
space is divided into five classes:
A, B, C, D, and E.

Classfull Addressing

IP address formats.

Figure Finding the classes in binary and dotted-decimal notation

Example 2 GATE 2012: 1 Marks


In the IPv4 addressing format, the number of
networks allowed under Class C addresses is:
(A) 214
(B) 27
(C) 221
(D) 224

Solution : C
Explanation. For class C address, size of network field
is 24 bits. But first 3 bits are fixed as 110 for the
representation of class; hence total number of
networks possible is 221.

Table Number of blocks and block size in classful IPv4 addressing

Limitations of Classfull addressing:

In classful addressing, a large part of the


available addresses were wasted.
The efficiency of addressing can be
improved with help of Subnetting and
Supernetting

Two-level hierarchy in an IPv4 address

Note

Each address in the block can be


considered as a two-level
hierarchical structure:
the leftmost n bits (prefix) define
the network identity;
the rightmost 32 n bits define
the host identity.

Three-level hierarchy in an IPv4 address

Note:

Each address in the block can be


considered as a three-level
hierarchical structure:
the n bits defines
the netid, subnetid,
And hostid.

CLASSLESS ADDRESSING
SCHEME

Classless Addressing

Classful addressing, which is almost


obsolete, is replaced with classless
addressing.

Classless Addressing

Classless addressing, uses slash


notation or CIDR(Classless Inter Domain
Routing) notation.

Table Default masks for classful addressing

Note

In IPv4 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.

Note

The first address in the block can be


found by setting the rightmost
32 n bits to 0s.

Example
A block of addresses is granted to a small organization.
We know that one of the addresses is 205.16.37.39/28.
What is the first address in the block?

Solution:
The binary representation of the given address
is
11001101 00010000 00100101 00100111
If we set 3228 rightmost bits to 0, we get
11001101
00010000 00100101 00100000
or 205.16.37.32

Note

The last address in the block can be


found by setting the rightmost
32 n bits to 1s.

Example
Find the last address for the block in previous.

Solution
The binary representation of the given address is
11001101 00010000 00100101 00100111
If we set 32 28 rightmost bits to 1, we get
11001101 00010000 00100101 00101111
or
205.16.37.47
This is actually the block shown in Figure.

Figure A network configuration for the block 205.16.37.32/28

Note

The number of addresses in the block


can be found by using the formula
232n.

Example
Find the number of addresses in above problem.

Solution
The value of n is 28, which means that number
of addresses is 2 3228 or 16.

Problem:1
In a class B network on the internet has a IP
Address
144.97.17.132
Subnet Mask 255.255.255.192
Calculate the net id and host id for the IP address.
Solution:
Subnet Mask: 11111111 11111111 11111111
11000000
Net id ..
Host id .

Problem:2
In a class B network on the internet has a Subnet
Mask 255.255.240.0
Calculate the maximum no. of host per subnet.
Solution:
Subnet Mask: 11111111 11111111 11111111
11000000
No of Host per Subnet: ?

Problem: GATE 2003


The Subnet mask for a particular network is 255.255.31.0
Which of the following pairs of IP Addresses could
belong to this network?
a. 172.57.88.62 to 172.56.87.62.2
b. 10.35.28.2 to 10.35.29.2
c. 191.203.31.87 to 191.234.31.88
d. 128.8.129.43 to 128.8.161.55
Solution : c & d
Explanation. Both ranges belongs to class B

Problem: GATE 2005


An organization has a class B network and wishes to
from subnets for 64 departments. The subnet mask
should be:
a. 255.255.0.0
b. 255.255.64.0
c. 255.255.128.0
d. 255.255.252.0
Solution : d
Explanation. For class B network 64 sub networks can
be created by using 26 . So 6 bits will be used to create
sub network. So mask will be :
11111111 11111111 11111100 00000000

Problem: GATE 2006


Two computers C1 and C2 are configured as follows. C1 has IP
address 203.197.2.53 and net mask 255.255.128.0. C2 has IP address
203.197.75.201 and net mask 255.255.192.0. which one of the
following statements is true?
a. C1 and C2 both assume they are on the same network
b. C2 assumes C1 is on same network, but C1 assumes C2 is on a
different network
c. C1 assumes C2 is on same network, but C2 assumes C1 is on a
different network
d. C1 and C2 both assume they are on different networks.

Solution : c
Explanation: IP address of C1 is 203.197.2.53 and
Subnet mask is 255.255.128.0 ending gives the network
id which is 203.197.0.0.

Explanation: Continuied

When C1 sees the ip address 203.197.75.201, to find the


network id it will and with its subnet mask, which gives
203.197.0.0.
So C1 assumes that C2 is on the same network with C1.
Similarly, IP address of C2 is 203.197.75.201, subnet mask is
255.255.192.0 ending gives the network id which is
203.197.64.0.
When this computer looks at IP address of C1, to find the
network id, it will and with its network mask giving
203.197.0.0.
Therefore C1 assumes that C2 is on the same network with
C2, but C2 assumes C1 is on a different network.

Problem: GATE 2008


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
c. 2046

b. 1023
d. 2047

Solution : c
Explanation:
Number of bits for subnet mask = 21
Number of bits for host = 11
Number of hosts = 211-2 = 2046

Problem: GATE 2010


Suppose computers A and B have IP addresses
10.105.1.113 and 10.105.1.91 respectively and they both
use the same net mask N. Which of the values of N given
below should not be used if A and B should belong to the
same network?
(A) 255.255.255.0
(C) 255.255.255.192

(B) 255.255.255.128
(D) 255.255.255.224

Solution : d
Explanation: For both IP address of A & B if Subnet mask is
255.255.255.0 gives the same network id for A & B which is
10.105.1.0.

Explanation: Continued

For both IP address of A & B if Subnet mask is 255.255.255.128


gives again the same network id which is 10.105.1.0.

For both IP address of A & B if Subnet mask is 255.255.255.192


gives again the same network id which is 10.105.1.64.

For both IP address of A & B if Subnet mask is 255.255.255.224


gives the different network id which is 10.105.1.92 for A and
10.105.1.64 for B.

Therefore Subnet mask is 255.255.255.224 should not be


used for A & B different network.

Note

The first address in a block is


normally not assigned to any device;
it is used as the network address that
represents the organization
to the rest of the world.

Problem:GATE 2012

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/24 and 245.248.132.0/21

Solution: (A)

Explanation:
Since half of 4096 host addresses must be given
to organization A, we can set 12th bit to 1 and
include that bit into network part of organization
A, so the valid allocation of addresses to A is
245.248.136.0/21
Now for organization B, 12th bit is set to 0 but
since we need only half of 2048 addresses, 13th
bit can be set to 0 and include that bit into
network part of organization B so the valid
allocation of addresses to B is 245.248.128.0/22

Problem:GATE 2011

A layer-4 firewall (a device that can look at all protocol


headers up to the transport layer) CANNOT
(A) Block entire HTTP traffic during 9:00PM and 5:00AM
(B) Block all ICMP traffic
(C) Stop incoming traffic from a specific IP address but
allow outgoing traffic to the same IP address
(D) Block TCP traffic from a specific user on a multi-user
system during 9:00PM and 5:00Am

Solution

Answer : A

Problem: GATE 2014

Problem on TTL Question no: 25

Routing

McGraw-Hill

The McGraw-Hill Companies, Inc., 2000

Problem: GATE 2012(Ques:40)

Consider the directed graph shown in the figure


below. There are multiple shortest paths between
vertices S and T. Which one will be reported by
Dijkstras shortest path algorithm? Assume that, in
any iteration, the shortest path to a vertex v is updated
only when a strictly shorter path to v is discovered.

(A) SDT (B) SBDT (C) SACDT (D) SACET

S-ar putea să vă placă și