0 ratings0% found this document useful (0 votes) 2K views45 pagesAcn Chapter 1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here.
Available Formats
Download as PDF or read online on Scribd
Network La (or 8 Prot,
SE Se \
Network Laye
~The network layer is responsible for carrying the packet
from the source all the way to destination. In short it is
responsible for host-to-host delivery.
~The network layer has a higher responsibility than the
data link layer, because the data link layer is only
Supposed to move the frames from one end of the wire
to the other end,
~ Thus network layer is the lowest layer that deals with
the end to end transmission,
1d Position of Network Layer :
~ Fig. 1.1. shows the position of network layer in the 5
layer internet model. Its the third layer.
[Network layer provides services to the transport layer
Network layer thes serves fm he data nk yor
(6-435) Fig. 1.1.1: Position of network layer
~ _Tereceives services from the data link layer and provides
‘Services to the transport layer.
1.1.2 Network Layer Duties ;
Fig. 1.12 shows the set of duties ofthe network layer,
Duties ofthe network layer
Intemetworking Addressing Routing Packatizing Fragmenting
(6-496 Fig. 1.2 : Duties of the network layer
1. Internetworking :
This is the main duty of network layer. It provides the
'ogical connection between different types of Networks,
2 Addressing :
~ _ Addressing is necessary to identity each device on
the Internet uniquely, This is sir
imilar to a telephone
‘system.
~The addresses used in the
able to uniquely define
computer to the Intemet un
Network layer should be
the connection of a
iversally
3. Routing:
In a network, there are multiple roots avai, 1
from a source to a destination and one oF then.
tobe chosen.
= The network layer decides which root is to
taken. Ths is called as routing and it depends cy
various criterions.
4. Packetizing :
- As discussed earlier, the network layer receives the
packets from upper layer protocol ang
‘encapsulates them to form new packets.
~ This is called as packetizing. A network layer
protocol called IP (Interetworking Protocol), does
the job of packetizing.
5. Fragmenting :
The sent datagram can travel through different
‘networks. Each router decapsulates the IP datagram
from the received frame. Then the datagram is
Processed and encapsulated in another frame.
Other issues :
‘The other issues which are not directly related to the
Cuties of network layer but need to be discussed are :
1. Address resolution.
2. Multicasting.
3. Routing protocols.
Other supporting protocols ;
The Internetworking Protocol
(P) needs the Support of
‘another protocol ICMP or ARP
etc. in the network layer,
How to achieve the goals 7
the network layer must
the communication subnet
It also should choose.
‘communication,ACN (Comp. /Sem. S/MSBTE) 13 Network Layer & Protocols
1.2
IPv4 Addresses :
Each computer connected to the Internet should be
identified uniquely. The identifier used for this purpose
is called as the Internet address or IP address.
The hosts and routers on the Internet have unique IP
addresses.
The current version of IP (Internet Protocol) is IPv4
whereas the advanced version is IPv6.
The IPv4 address is a 32-bit address and it is used for
defining the connection of a host or router to the
Internet. Thus an IP address is an address of the
interface.
1.2.1 Uniqueness of IP Addresses :
The IP address is unique and universal. That means
each IP address defines only one connection to the
Internet.
‘At any given time, no two devices connected to the
Internet can have the same IP address.
But if a device is connected to the Intemet via two
connections through two different networks, then it can
have two different IP addresses.
All the IPv4 addresses are 32 bit long and they are used
in the source address and destination address fields of
the IP header.
‘The IP addresses for hosts are assigned by the network
‘administrator. For Internet it has to be obtained from
the network information center.
1.2.2 Address Space :
‘The IPv4 protocol has an address space. It is defined as,
the total number of addresses used by the protocol
IFN number of bits are used for defining an address
then the address space will be 2" addresses.
For IPv4, Nis 32 bits. Hence its address space is 2" or 4,
234, 967, 296 (more than 4 billion). So. theoretically
more than 4 billion devices could be connected to the
Internet.
Thus the address space of Pv is 2°.
1.2.3 Notation :
The IPv4 addresses can be shown use three different
notations as follows
1. Binary notations (base 2)
2. Dotted decimal notation (base 256)
3. Hexadecimal notation (base 16)
= Out of these the dotted decimal notation is most
commonly used
Dotted decimal notation :
= This notation has become popular because of the two
advantages it offers. This notation makes the IPv4
address more compact and easy to read.
~The 32 bit IPV4 address is grouped into groups of 8-bits
each separated by decimal points (dots).
= Each B-bit group is then converted into an equivalent
decimal number as shown in Fig. 1.2.
= Each octet (byte) can take a value between 0 and 255.
Therefore the IPv4 address in the dotted decimal
‘notation has a range from 010.00 to 255.255.255.255.
~ For example the IPv4 address of 1001 0001.00001010
00100010 00000021 is denoted in the dotted decimal
form as 14510343.
° 1
“Qe
Dated decal [5-10 +94 +9
(G-2001) Fig. 12.2 : Dotted decimal notation
1.2.4 IPv4 Address Format :
= A32bit IPv4 address consists of two parts. The first part
is called as net id ie. network identification which
identifies a network on the Internet and the second part
is called as the host id which identifies @ host on that
network,
= Fig. 12.2 shows the IPv4 address format. Note that the
net id and host id are of variable lengths depending on
the class of address.
~ Note that class D and & addresses are not divided into
net id and host id for the reasons discussed later on
k-— bits ——
[netid [host] IP v4 address
(G-2002) Fig. 1.2.2 : IPv4 address formatcn (Comp. /Sem. S/MSBTE)
The concept of IP addresses is few decades old. It uses
{he concept of classes. This architecture is called as the
classful addressing.
Later on in mid 1990s a new architecture of addressing
was introduced which was known as classless
‘addressing. This new architecture has superseded the
Original architecture.
Ii this section we are going to discuss the classful
addressing,
1.3.1 IPv4 Address Classes :
In the classful addressing architecture, the IP address
Pace has been divided into five classes : A,B, C, D and
E
Fig. 13.1 shows the percentage of occupation of the
Address space by each class.
~The number of class A addresses is the highest ie. 50%
‘and those of classes D and E is the lowest ie. 6.25%.
A
BL | 25%
c | | 126%
D | | 625%
Ee | 2" | e25%
(G-2003) Fig. 1.3.1 : Classful addressing occupation of
‘address space
1.3.2 Formats of Various Classes :
bits,
7 24 bite:
(Px rer Ta]
(G-531) Fig, 13.2(0) : Class A IPv4 address formats
14
NOWeH L0" 8 Fog,
Class A format
The formats used for IPv4 address are as sho,
© Fig. 132. The IPv4 address for class A nena” ®
shown in Fig. 13.2(0).
is 7 bit long as shown in Fig. 23,
= The network field is 7 bit “
and the host field is of 24 bit length. So the netae
field can have numbers between 1 to 126.
= But the host numbers wil range from 0000 ,,
127.255.255.255.
= Thus in class A, there can be 126 types of networks ang
17 million hosts.
~The “0” in the first field identifies that it is a class 4
network address.
Class B format :
~The class B address format is shown in Fig. 1.3.26).
— The first two fields identify the network, and the
‘number in the first field must be in the range 128 - 191
14 bits 16 bits
(6-532) Fig. 13.2(b) : Class B format
~ Class B networks are large. Host numbers 0.0 and
255.255 are reserved, so there can be upto 65,534
(216-2) hosts in a class B network. Most of the 16,382
class B addresses have been allocated. The first block
covers address from 128.0.0.0 to 128.255.255.255 and
the last block covers from 191.255.00 to
191.255.255.255.
~ Example : 128.89,0.26, for host 0.26 on net 128.89,
Class C format :
~ The class C address format is shown in Fig. 13.2(c)
a te
2
(6-533) Fig. 1.3.2(c) : Class C format
The first block in class C covers addresses from
192.0.0.0 to 192.0.0.255 and the last block covers
addresses from 223.255.2550 to 223.255.255.255,
Class D format :ACN (Comp. /Sem_ SMSSTE) 15 Network Layer & Protocols
= The dass format allows for upto 2 milion networks with
upto 254 hosts each and dass D format allows the
multicast in which a datagram is directed to multiple
hosts.
Class E address format :
= Fig. 132(e) shows the address format for 2 class &
address. This address begins with 11110 which shows
that itis reserved for the future use.
Fig. 1.3.2(¢) : IP address for class E network
~The 32 bit (4 byte) network addresses are usually
written in dotted decimal notation. In this notation each
of the 4-bytes is written in decimal from 0 to 255.
= So the lowest IP address is 0.0.0.0 ie. all the 32 bits are
1
zero and the highest IPv4 address is 255.255.255.255.
3.3 How to Recognize Classes ?
‘When an IPv4 address is given to us either in the binary
or dotted decimal notation, we can find the class of the
address.
If the given address is in the binary notation then we
can identify its class by inspecting the first few bits of
the address. This is as shown in Fig. 1.3.32).
Byto2 Bytes Byte 4
Class A
Byto 1
|
Class B
Bye
caseo
Bye
coo omy TT
1
Byte
|
Class E
{6-2006 Fig. 1.3.3(0) : Finding the address class
If the given address is in the dotted decimal notation
then we can identify the address class by inspecting the
first byte of the address. Ths is as shown in Fig. 1.3.3).
Bye,
Clase A Owe [ems [ome]
eye
cane [ies to] Set [es Lowe
Byo2
usec [fse-225] Ove? | Ores | Broa
Bye t
cased [Bes -255] ere? | eves | eves |
eye!
Classe [ao - 288] Bye2 | Byes | Byes
{6-2005) Fig. 1.3.3(b) : Finding the address class
= is important to note here that there are some special
addresses which fall in class A or E. These special
addresses are to be treated as the exceptions to the
dlassful addressing.
= In computers, the IPv4 addresses are generally stored in
the binary notation format. Therefore it is possible to
write an algorithm which can identify the address class
by using the continuous checking process.
= The principle of such an algorithm has been shown in
Decision box to
‘check the next bit
(6.2006) Fig. 1.3.4 : Algorithm to identify address class
1.3.4 Two Level Addressing :
= The IPv4 addressing is used for defining @ destination
for an Intemet packet at the network layer.
— At the time when classful addresses were designed, the
Internet was considered as the network of networks. In
other words the whole Intemet was divided into a
umber of smaller networks with many hosts connected
to each network.
— Normally an organization which wants to connect to the
Internet creates a network and the Internet authorities
allocate @ block of address to the organization. These
addresses can be in class A, B or C
= Allthe addresses allotted to an organization belong to
2 single block. Therefore each IPv4 address in classful
‘TechKnowledgsNetwork Layer & Pr
[ACN (Comp. (Sem. SMSBTE) 16 = _ eee
3, Last address In the block
addressing system is made up of two parts namely net
Geameunaeenagise
#32 bts 4
ret aeons reer ta]
Fn bits ate (2 m) Bi
(G-2007) Fig. 1.3.5 : Two level addressing
eens
~ ‘The job of the met id is to define a network and that of
Frat tees areata eter
- ‘As shown in Fig. 135 if n bits define net Id then the
ring Gao dene host
= Trrtas erie note ora be cases fc
Taepend onthe cases thown n Tale 3
Table 13.1
pa)
A n=8
B | n=16
n=26
1.3.5 Extracting Information In a Bloc!
= A block is nothing but a range of addresses. For any
given block we would be interested to extract the
following three pieces of information :
1. The total number of addresses in the block.
2. The first address ofthe block
3. The last address in the block.
‘extracting all this information, we have to
identify the class of the address as discussed earlier.
‘Once we find the dass of the block, we will have the
values of ‘n* (the length of net id in bits) and (32 - n)
i.e. the length of the host id in bits.
It is now possible to obtain the three pieces of
information mentioned above as shown in Fig. 13.6.
‘Total number of addresses In the block :
The total number of IPv4 addresses in the given block
will be equal to,
N= 20° 3.2)
2. First address in the block :
‘The first address in the given block can be obtained by
keeping the leftmost “n* bits in the address as it is and
setting all the (32 ~ n ) rightmost bits to 0 as shown in
Fig. 136.
the given block can be obtained g,
raping te lefmest “0” its i the adres 95 ang
reeretting al the 20) rightmest Bits £0235 shown
in Fig. 136.
(32-7) bits
1.3.6 Network Address :
The network address is an address that defines the
network itself. It cannot be assigned to a host. Fig. 13.7
shows the examples of network addresses for different
classes.
‘Not 1D Host ID
6 E20) 115.837.90 —Neto that 115 is common
inthe address ofall
‘machinos in class
‘Anetwork
18.90.1214
Network aderoos
(cass A network address
151.1500 151.156769
Note that 151.15 ia
common inthe address
ofall machines in lass
B notwork
151.189091
Network address
(b) Class B network address
(6-536 Fig. 1.3.7 (Contd.)ACN (Comp. ‘Sem. SMSBTE) s Network Layer & Protocols
58 Note that 22321.70 is
‘common in the address of
‘ll machines in class.
+, Cretwork
223.21.70.126
Network address
(©) Class C network address
(6536 Fig. 13.7
~The following examples will enable you to find the
network address.
Ex.1.3.1: For the address 24.46.8.95 identity the type of
network and find the network address.
Soin. :
— _Bramine the first byte. Its value is 24 ie.
‘and 127. So itis a class A network.
= So only the first byte defines the Net id. So we can find
the network address by replacing the host id with 0s.
= The process of obtaining the network address is shown
between 0
in Fig. P.132.
fe Not kts} host ld ——a]
be ee |
Replace host id by o's
Netw wereen —+
(6-537) Fig. P. 2.3.2
So the network address is 24.0.0.0.
Ex.132: For the address 132.7.21.84 find the type of
network and the network address.
- Sola,
Examine the first byte. It is 132 ie. between 128 and
192. So it is a class B network.
= Sothe first two bytes define the net id. Replace the host
id with 0's to get the network address as shown in
Fig. P.13.2.
Not ip —+}e— host id —+}
ie
‘replace host id by O's
neworcacroe [eT [0-0]
(@-538) Fig. P. 1.3.2
So the network address is 132.7.0.0.
Ex. 1.3.3: Find the class of the network if the address is
221.46.75.64,
Soin. :
The first byte is 221i. between 192 and 255. So this is
a dass C network. The net id and host id are as shown in
Fig. P.133.
J+ Not ig) ——sf host
(6-530 Fig. P.13.3,
What is the difference between net id and network
address ?
The network address is different from a net id. A
network address has both net id and host id, with Os for the
host id.
Where to use the network address 7
‘The network address is used to route the packets to the
desired location.
1.3.7 Network Mask or Default Mask :
— Earlier we have discussed the methods for extracting
different pieces of information. But all these methods
are theoretical methods which are useful in explaining
the concept.
— But practically these methods are not used. When a
packet arrives at the input of the router in the Internet,
it uses an algorithm to extract the network address
from the destination address in the received packet.
is can be achieved by using a network mask.
Definition of default mask :
‘Anetwork mask or default mask in classful addressing
is defined as a 32-bit number obtained by setting all the “n”
leftmost bits to 1s and all the (32 ~ n) rightmost bits to 0.
1.3.8 Default Masks for Different Classes :
= We know that the value of n is different for different
classes. Therefore their default masks also will be
different.
v Tectaewtedyt\CN (Comp. Sem. 5/MSBTE)
~The default masks for class A, B and C addresses are as
shown in Fig. 1.3.8,
Class A:nas
bens 6s (22 - n= 24 iso}
[iti e0000090 Teoooea00 [55500000] 255.00.
‘MI (22—) nghemost
bats eottoos
Alot most n* ta
sao is
(0) Default mask for class A address
Clase Bn = 16
be nw 16 ig (22-0) = 18 too}
CET TAT SATTTTAT 17777 [06000000] 258.255.00
(©) Defautt mask for class B address
(22-n) = bits
Sy] LLAITHTAT 00000000] 255.255.256,0
(©) Default mask for class C address
(6-200 Fig. 13.8
~ Table 13.2 enlists the default masks of the three classes
Of IPv4 addresses,
Table 1.3.2 : Default masks
A 255.0.0.0
B 255.256.0.0
c 255.255.255.0
1.3.9 Finding Network Address using Default
Mask :
~ The router uses the AND operation for extracting the
‘network address from the destination address of the
received packet.
~The router ANDs the destination address with the
default mask to extract the network address as shown
inFig. 139,
~ _ tis possible to use the defauit mask to find the number
of addresses and the last address in the block.
dross Dofauit mask
address
(©2019 Fig. 1.3.9: Finding a network address using
the default mask
(0 Three Level Addressing : Subnetting
‘As discussed earlier, the originally designey
addresses were with two level addressing with ne
and host id. ;
The two level addressing is based on the principle thy,
in order to reach a host on the Internet, we have
reach the network frst and then the host.
But very soon it became evident that the two ley
addressing would not be sufficient for the following two
reasons :
1. First it was needed to divide a large network of an
‘organization (to which a block in class A or B is
allotted) into many smaller subnets (subnetworks)
for improved management and security
2. Second reason is more important. The blocks in
class A and B were almost depleted and the blocks
in class C were smaller than the needs of most
‘organization. Therefore the organizations had to
divide their allotted class A or B block into smaller
subnetworks and share them.
Definition of subnetting :
~ We can define the subnetting as the principle of
splitting a block of addresses into smaller blocks of
addresses.
~ _In the process of subnetting we divide a big network
into smaller subnetworks or subnets.
~ Each such subnet has its own subnet address,
Subnet mask :
- The network mask or default mask that we discussed
cari is used when the given network is not to be
ivided into smaller subnetworks ie. when Subnetting
is not to be done.ACN (Comp. /Sem. SMSBTE)
= In Fig. 13.10, we have shown the default mask and
subnet mask when a cass C network is to be divided
into 8 subnets.
(32-7) =8
ery
Dotaun mask [FrarnssT ersasnte] erate [00000000]
Tass C network
fein 29 +3 = 27 a}
Suorot mack [FATT | a aTT | FTTH O00]
-——— No change
Shera
te
(G-2011) Fig. 1.3.10 : Default and subnet masks
1.3.11 Special IP Addresses :
«ag 1st nena ec se
eae
as
as
ee
(at:
oe
(G-540 Fig, 1.3.21 : Special IP addresses
= All zeros means this host or this network and all 1s,
means broadcast address to all hosts on the indicated
network.
~The IP address 0.0.00 is used by the hosts when they
are being booted but not used afterward.
~The IP addresses with 0 as the network number refer to
their own network without knowing its number as
shown in Fig.1.3.11(b).
‘The address having all ones is used for broadcasting on
the local network such as a LAN as shown in
Fig. 13.110).
Refer Fig. 1.3.11(d). This is an address with proper
network number and all 1s in the host field. This
address allow machines to send broadcast packets to
distant LANs anywhere in the Internet.
If the address is “127. Anything® as shown in
Fig. 13.11(e) then it is a reserved address loopback
testing. This feature is also used for debugging
network software
1.3.12 Limitations of IPv4 :
‘The most obvious limitation of IPv4 is its address field.
TP relies on network layer addresses to identify
‘end-points on networks, and each networked device
has a unique IP address.
IPv4 uses a 32-bit addressing scheme, which gives it 4
billion possible addresses. With the proliferation of
networked devices including PCs, cell phones, wireless
devices, et, unique IP addresses are becoming scarce,
and the world could theoretically run out of IP
addresses.
If a network has slightly more number of hosts than a
particular clas, then it needs either two IP addresses of
that class or the next class of IP address. For example,
let use say a network has 300 hosts, this network needs
either a single class B IP address or two class C IP
addresses. If class B address is allocated to this network,
as the number of hosts that can be defined in a class B
network is (2"° ~ 2), a large number of host IP addresses
are wasted.
If two class C IP addresses are allocated, as the number
of networks that can be defined using a class C address
is only (2%), the number of available class C networks
will quickly exhaust. Because of the above two reasons,
2 lot of IP addresses are wasted and also the available
IP address space is rapidly reduced.
Other identified limitations of the IPv4 protocol are:
Complex host router configuration,
hierarchical addressing, difficulty in re-numbering
addresses, large routing tables, non-trivial
implementations in providing security, QoS (Quality of
Service), mobility and multi-homing, multicasting etc.
and ron-
To overcome these problems the intemet protocol
version 6 (IPV6) which is also known as internet
protocol, next generation (IPng) was proposed.
In IPV6 the internet protocol was extensively modified
for accommodating the unforeseen growth of the
internet.
The format and length of the IP addresses has been
changed and the packet format also is changed.
‘TedsNetwork Layer &
W cn (comp. rSem. SMSBTE) val
Restrictions
Ex.1.3.4: A router inside an organization receives the
same packet with a destination address
190.240.34.95. If the subnet mask is /19 (first
19-bits are 18 and following bits are Os). Find
the subnet address.
Soin. :
~ To find the subnet address, AND the destination
‘dress withthe subnet mask as shown in Fig. P. 134
fe—— 1019 —— v4 100 ——¥
S.t0
a] as.
ey
ce EI
ore eon
2
wre
es
=
comnass
Thus the subnet address is 190.240.32.0.
1.3.13 Classless Addressing :
Eventhough the number of actual devices connected to
Intemet is much less than 4 billion, the address
depletion has taken place due to flaws in the dlassful
addressing scheme.
We have run out of class A and B addresses. To
overcome these problems, the classless addressing is
now being tried out.
In the classless addressing, there are no classes but the
‘address generation take place in blocks.
Address blocks :
‘Address block is defined as the range of addresses.
In the classless addressing, when an entity wants to get
connected to the internet, a block (range) of addresses
is granted to it.
The size of this block ie. number of addresses depends
on the size of the entity as well as its nature.
That means for a small entity such as @ household only
‘one or two addresses will be given whereas for a larger
entity like an organization, thousands of addresses can
be allotted.
ici address blocs,
restriction on classless 7
a
simplify the process of address handling.
The addresses in a block should be continuo,
i. serial in manner.
The total number of addresses in BlOCk has to by
‘equal to some power of 2 Le. 2.27.2) ete.
‘The first address should be evenly divisible by the
number of addresses.
1.3.14 Supernetting :
The class A and class 8 addresses are almost depleted,
But class C addresses are still available.
But the size of class C address with a maximum number
of 256 addresses does not satisfy the needs of an
‘organization. More addresses will be required.
— The solution to this problem is supernetting.
= In superetting an organization combines several class
C blocks to create a large range of addresses i.e. several
networks are combined to create a supernetwork.
- By doing this the organization can apply for a set of
dass C blocks instead of just one.
Example of supernetting :
~ If an organization needs 1000 addresses, they can be
‘obtained by using four C blocks one C block
corresponds to 256 addresses).
~ The organization can then use these addresses as one
‘supernetwork as a whole.
1
1.3.15 Who Decides the IP Addresses ?
~ Ne two IP addresses should be same. This is ensured by
2 central authority that issues the prefix or the network
number portion of the IP address,
~ Locally an ISP is to be contacted in order to get 2
Unique IP address prefix “
~ At the ‘global level the Internet Assig
ned Number
Authority (IANA) allots an IP address prefix to the ISP.
Thus it is ensured that the IP addresses are not# ACN (Comp. (Sem, SMSBTE) 1 Network Layer & Protocols
Conceptually IANA is a wholesales and ISP is a retailer
of the IP addresses because ISP purchases IP addresses,
from LANA and sells them to the customers.
3.16 Registered and Unregistered
Addresses :
computer that is connected to the Intemet.
other technologies for protecting the computers.
Internet to access them.
~ These workstations are given the unregistered private IP
addresses. These addresses are assigned by the network
administrator without obtaining them from an ISP
(internet Service Provider) or IANA.
= These are special network addresses in each class as
shown in Table 13.3. These addresses are to be used for | ~
are called unregistered
private networks and
addresses.
~ We can choose any of these unregistered address while
building our own private network.
‘Table 1.3.3: IP addresses for private networks
‘A. | 10.0.0.0 through 10.255.255.255
Registered IP addresses are required for computers
which are accessible from the Intemet but not every
For security reasons, networks use firewalls or some
The firewalls will enable the workstations to access the
Intemet but do not allow the other systems on the
Soin.
‘Step 1: To find the subnet address :
In order to find the subnet address we have to AND the
IP address and the mask as follows
120 14 2 19
: IP address
255 255. 12 o
ayy it111111 . 10000000. MASK
(6-559 Fig. P.1.3.5(0)
So the subnet address is 1201400.
Similarly we can find the other subnet addresses.
Step2: Host id:
~ Examine the first byte of the subnet address. It is 120
which is between 0 and 127. Hence this is a class A
network.
So only the first byte corresponds to the net id and the
remaining three bytes correspond to the host id as
shown in Fig. P.135(b).
a
Netid
Host id
(@-554) Fig. P. 1.3.5(b)
So the host id is 14.00,
Similarly we can find the other host id.
B__| 172,16.0.0 through 172.31.255.255 Ex. 13.6: The IP address of a host on class C network is
496.123.46.237. Four networks are allowed for
| 102.168,0.0 through 192.168.255.255 this network. What is subnet mask ?
Soin
1.3.17 Solved Examples : The default mask for a class C network is,
£x.1.35: Find the sub-network address and the host Id feared
" In order to have four networks, we must have two extra
for the folowing: 1s, Hence the default mask and subnet mask are shown in
Fig, P.136.
255. 255. 256 . 0
(a) | 120,14.22.16 | 255.255.1280 Ld
(o) | 140.11.96.22 | 256.255.256.0 255 . 255.286. 192
Subnet
(| 141.181.14.16 | 256.255.224.0 mask
(6) _| 200.34.22.166 | 265.255.256.240 ce)
(6-555) Fig. P.13.6
‘Thus the required subnet mask is 255.255.255.192.Wercmenaeng Tan
ACN (( ‘Sem. 5SMSBTE) ibnets are
othe various addresses of 6 $4 85 shown g
What is the subnet address if the destination
address is 200,45.34.56 and subnet mask is
255.255.240.07
En 137:
Soin,
To find the subnet address we have to AND the IP
‘address and the subnet mask as shown in Fig. P. 13.7.
Eotetate
Ld ooo. or10110r 790010 OO
ee aors
et
Joo
ane
Stet [io wore oom
(6-556 Fig. P.1.3.7
Thus the required subnet address is 200.45.32.0.
Ex.1.38: A company is granted a site address
201.70.64.0. The company needs six subnets.
Design the subnets.
Soin. :
= Thisis a class C network. So the default mask is,
255.255.2550
‘As we need 6 subnets, we need three extra 1s. So the
subnet mask is,
255.255.255.200
In the binary form the subnet mask is as shown in
Fig. P.138.
(6-557) Fig. P.138
In order to have six subnets, we can have 6 different
combinations of the 3-extra 1s as shown in
Table P. 1.38(@).
Table P, 1.3.8(a)
ao eee
y
201,70.64.32 to 201.70.64.63
201.70.64.64 to 201.70.64.95
201.70.64.96 10 201.70.64.127
201, 70.64.128 to 201.70.64.159
'201.70,64.160 to 201.70.64.191
in
For a given class C network 195.168.65.0
design equal subnets in such a way tha each
subnet has atleast 60 nodes.
E139:
Soin. :
Fig. P. 139(2) shows the structure of a class C address
in which 3-bytes are reserved for net ID and 1-byte for
host ID.
3 byte ————e — byte —t
‘bits
(6-550 Fig. P. 1.3.9(0)
We are expected to design equal subnets such that
each subnet has atleast 60 nodes (i.e. 60 users).
In order to identity at least 60,users we need 6-bits in
the host ID.
The remaining 2-bits are assigned for subnetting as
shown in Fig. P.13.9(0).
(6-559) Fig. P.1.3.9(6)
This shows that there will be four equal subnets each
‘one having at least 60 nodes.
ec
Ex.1.3.10: Show by caloulations how many network each
son. IP address class can have with one example ?
Number of networks in different IP address :
Class A address :
~The format of dass A address is shown
ir
Fig. P1310). Here one byte defines the seswort ID
don | Subnet number |
000 Subnet 1
oot Subnet2
010 Subnet 3
o1t ‘Subnet 4
100 ‘Subnet §
101 Subnet 6
‘and three bytes define the host ID.
WetACN (Comp. /Sem. SMSBTE) [Network Layer & Protocols
fe} byte
——Sbyies—$—$<4
(6-560) Fig. P.1.3.10(a) : Class A address
= The MSB in the network field is reserved, So actually
there are only 7-bits in the network fields.
= So the number of networks in class A address will be
128.
Class B address :
- The format of class B address is shown in
Fig, P, 13.10(b). Here 2-bytes are reserved for network
field and remaining two bytes are forthe host fel.
= Out of 26-bits in the network field the first two bits
(MBs) are reserved. So actually 14 bits are available in
the network field
(@-56n Fig, P. 13.10(b) : Class B address
= So the number of networks in class B address is
2 = 16, 368.
Class C address :
= The format of class C is shown in Fig. P. 1.3.10(0. Here
S+bytes are reserved for network field and only one
byte for the host field
= Out of 24-bits in the network field 3-bits are again
reserved. So actually only 21-bits are available.
(6-562 Fig. P. 1.3.10(¢) : Class C address
~ So the number of networks in class C addresses is 2,
097, 152.
Ex.1.3.11: How many host per network in each IP
address class can exist, show with example ?
Soln, :
Number of hosts in different IP addresses :
Class
There are 3-bytes (24-bits) in the host field. Hence the
number of hosts in class A address will be 2 = 16, 7772, 16.
Class B:
There are 2-bytes (16-bits) in the host field. So the
‘number of hosts in class B address will be 65536 i. 2" per
network.
Class C:
There is 1-byte (B-bits) in the host field. So number of
hosts in class C address will be 2° = 256 per network.
Ex. 1.3.12: Convert the IP address whose hexadecimal
representation is C22F15B2 to dotted decimal
(6-563) Fig. P. 1.3.12
. The IP address in the dotted decimal notation is as
follows :
194,79.21.226
‘A class B network on intemet has a subnet
mask of 255.255.240.0. What is the maximum,
‘number of hosts per subnet ?
Ex. 1.841
The structure of class 8 address is as shown in
Fig. P.1.3.13(0).
4614 bits —rhe—=16 bits —o1
(G-564) Fig. P, 1.3.13(a) : Class B address
The given subnet mask is 255.255.2400. So it is as
shown in Fig. P.1.3.13(b).
12bits tor
ost ID
(G-565) Fig. P. 1.3.13(b) : Subnet mask
Thus there are 4 extra 1s as shown in Fig. P. 1.3.13(b). So
there will be 16 subnets and each subnet can have
2 = 4096 hosts.
PeterietePerform the subnetting of the following IP
‘Address 160.111. X.X Original subnet mask
255,255.0.0 Number of subnets 6 (six)
Soin. :
~The original subnet mask indicates that we are dealing
with a class B address.
~ Marder to have six subnets we need to use 3 extra bits
from the bits that are reserved for host ID. So the
subnet mask is as shown in Fig. P. 13.14
3 bis for
‘brat
2852s *3bie
[eu sevafisssnes [ifeoeo foc coo
(Net ID +e Host ID»
(6-366) Fig. P. 2.3.14
~The bits reserved for subnetting will have 8
combinations from 000 to 111 out of which any six
‘combinations can be used for 6 subnets.
= Let us decide that the combinations 000 to 001 are not
to be used. Then the subnet masks for the 6 possible
subnets will have the following addresses.
285.255.224.0
1.4 Classless Addressing In IPv4
= Eventhough the number of actual devices connected to
Internet is much less than 4 billion, the address
depletion has taken place due to flaws in the classful
‘addressing scheme.
~ We have run out of class A and B addresses. To
‘overcome these problems, the super netting and
subnetting has been tried as discussed earlier.
- But subnetting and supernetting also could not solve
the problem of address depletion in IPv4,
Network Layer & p
114
W cw comp. /som. susers) of Internet users
Due to increased number se it
evident that a larger address space ead begs
Fr ong term solution to this Problem. For q,
th of the IP address should be increaseg wy,
ree the IP packet itself must be changed
1g term solution is to switch to IPV6. But ay,
Seales ses the same address space,
Aa i fr tet Bi KOM 3 cag
addressing.
In the classless ada
address generation take place in blocks.
‘The classless addressing was announced by the Inter
authorities in 1996 in which blocks of variable leng,
which do not belong to any class are used.
essing, there are no classes but y,
1.4.1. Varlable Length Blocks :
‘Address block is defined as the range of addresses.
In the classless addressing, when an entity wants to ge,
connected to the internet, a block (range) of addresse,
is granted tot.
= The size of this block ie, number of addresses depends
on the size of the entity as well as its nature.
= That means for a small entity such as a household only
fone or two addresses will be given whereas for a large
entity like an organization, thousands of addresses can
be allotted.
- Fig. 14.1 shows how the address space is divided int
non overlapping address blocks.
(6-1806 Fig. 1.4.1; Variable length blocks in classless
addressing
‘Two level addressing :
~ _ We have discussed the two level addressing for classtul
addressing which divided an address into two part
‘namely : net id and host id.
Defines the network. Defines the host
(6-805) Fig. 1.4.2 : Two layer addressing in classfull
addressing
wrestACN (Comp. S/MSBTE) _ 116, Network Layer & Protocols
= The net id and host id define the network and host
respectively. It is possible to use the same idea in the
classless addressing as well.
= A block of addresses granted to an organization is
divided into two parts called as the prefix and the
suffix.
= The role of prefix is same as that of the net id whereas
as the role of suffix is same as that of the host id. Thus
in a block granted to an organization, al the addresses
will have the same prefix but each address will have @
different suffix.
= Thus the prefix defines the network (organization to
Which the address block has been granted) while the
suffix defines individual hosts on the network,
= The concept of two level addressing in classless
addressing using the prefix and suffix is as shown in
Fig. 143.
= The IPv4 address is 32 bit long out of which the prefix
will be of length “a” which can take any value from 0 to
32 and the length of the suffix will be (32 n) bits.
= Note that the value of “n* ie. length of the prefix
depends on the length of the: address block allotted
(granted) to an organization.
'}-——— 22 bits ——
fe nia —efe— (82-1) bits —f
(6-006 Fig. 1.4.3: Two level addressing using prefix
‘ond suffix for classless addressing
Ex.1.4.1: Find out the values of prefix and suffix lengths
in classless addressing if all the available
addresses in IPv4 is to be considered as one
single block.
Soln.:
= The total addresses in v4 is 2° = 4,294,967,296.
We have to consider this as one block hence the prefix
length n = 0. Whereas all the hosts will have their
individual addresses. So all the 32 bits willbe allotted to
the suffix length
Ex.14.2: For the same data of the previous example
find out the values of prefix and suffix lengths if
all the available IPv4 addresses are divided
into 4,294,967,296 blocks with each block
having only one host.
Soln.:
= Here the prefix length for each block is n = 32, and the
suffix length would be (32-n) = 0. The address of the
single host in each block will be same as its block
address itself.
1.4.2 The Slash Notation (CIDR Notation) :
= fan address (classful or classless) is given to us and we
want to extract information from it, then the net id in
classful addressing or the prefix in classless addressing
are extremely important and useful to us.
= However it is not easy to identity the prefix bits in a
given classless address. It is easy to identify the net id
from the given classful address.
= For a given classless address it is not possible to find
the prefix length because the given address can belong
to a block with any prefix length.
~ Therefore, in classless addressing jit is essential to
include the prefix length to each address if the block of
the given address is to be found.
= Hence the prefix length “n* is added to the classless
address separated by a slash and the notation is known
as the slash notation.
— Fig. 144 demonstrates a classless address with slash
notation,
Classloss accross
(ve TT eve TT eve TT eve VET]
PREFIX longi
SLASH notation
(G-1007) Fig. 1.4.4 Slash notation
- The slash notation is also called as Classless
Interdomain Routing or CIDR notation.14.3 Network Mask :
~ We have discussed the concept of network maskin the
‘dassful addressing. The same concept is also applicable.
in the classless addressing as well.
~ A network mask in classless addressing is a 32 bit
‘number. With its “n* left most bits (corresponding to
the prefix) all set to 2s and the remaining (32-0) bits
Corresponding to the suffix all set to Os.
Ex.14.3: For the following addresses identity the
‘number of prefix bits and write down the
network mask :
1 12.26.25.79/8
2. 130.12.230.156 / 16
Soln,
1. Classless CIDR address : 12.26.25.70/8
AS per the slash notation we have n = 8 ie. number
of prefix bits is 8
‘Therefore the number of suffix bits = 32-8 = 24.
~ In order to obtain the network mask the prefix bits
all set to 18 and the suffix bits all set to zero as
shown in Fig. P.
2. Classless CIDR Address : 130.12290.156/16
AAs per the slash notation, n= 16 ie. number of
prefix bits is 16.
Number of suffix bits = 32-16 = 16
~ In order to obtain the network mask, set all the
prefix bits to 1s and set all the suffix bits to 0s as
shown in Fig. P.1.43(b).
(6-109) Fig. P. 14.300)
= Thus the network mask = 255,255.00
4.44. Extracting the Block Information :
= We can extract all the required information from the
given classless address in the CIDR notation. The
information that we can obtain is as follows:
1. The first address (network address)
2. The number of addresses.
3. Thelastaddress.
We can obtain the number of addresses in a block as
follows :
Number of addresses in a block N
Where n = Number of prefix bits.
The fist address or network address in block can be
obtained by ANDing the address with the network
mask.
First address = (Any address) AND (Network mask)
(14.2)
- OR what we can do is keep the “n” leftmost bits of any
address as it is and set the remaining (32-n) bits to Os.
This is equivalent to the ANDing operation mentioned
above.
= _Tnorder to obtain the last address in the block we have
to add the first address with the number of addresses in
the block directly.
«+ Last address = Fist address + Number of addresses in the
bed (1.43)
~ tis also possible to obtain the last address by ORing
the address with complement of the network mask.
+ Last address = (Any address) OR [NOT (Network Mask]
44)
One more way of obtaining the last address of the
block isto keep all the ‘n' left most bits (prefix bits) 35
aoe (4a)
itis and set al the (32-n) bits (sufix bits) to 1s.ACN (Comp. ‘Sem. SMSETE)
Ex. 144: It an address in a block is given in CIDR
Classless notation as 64.32.16.8 / 27 then find
the following :
1. Number of addresses in the block (N)
2. The first address and
3. The last address.
‘Soin. :
Step1: Findn:
Given address = 64.32.68 /27
Hence n = 27 from the slash notation.
cons D7bits,
». Prefix bits = 27, suffix bits = 32-27=5
‘Step2: | Number of addresses in the block (N) :
N= 25927232
‘Stop3: Find the first address :
- Refer Fig. P. 1.44(a) to obtain the first address in the
block For this we have to AND the given address with
the network mask.
Network Layer & Protocols
n_@@-n)
‘Network mask = 27 ones | 5 zer08
cs Network mask = 255.255.255.224
= For ANDing write the given address and network mask
in their binary notations as shown in Fig. P. 144(0).
“x. From Fig, P. 14.4(@) we get the first address in the block
as:
Ans.
First address = 6432160
‘Step 4: Find the lest address :
To obtain the last address in the block, we have to keep
the left most 27 bits in the given address as itis and set the
remaining 5 bits to 1s as shown in Fig. P. 1.4.4(0).
‘From Fig. P. 144(b) we get the last address in the
block as follows
Last address = 64.32.1631W cn
Ex14.5: For the classless address 129.65.33.01 / 24
find the following :
1. Number of addresses in the block (N)
2. The first address.
3. The last address.
/Sem. SMSBTE)
Soin, :
Step1: Find:
Given address = 129.65.33.01 / 24 hence n = 24 from the
slash notation.
n= 24bits
= Prefix bits = 24, suffix bits = 32-24 =8
Step2: Number of addresses In the block (N) :
N = 27222 256 ww Ans.
‘Step 3: Find the first address :
~ Refer Fig. P. 1.45(a) to obtain the first address in the
block. For this we have to AND the given address with
the network mask.
a (2-n)
+ Network mask = 255.255.255.0
- For ANDing write the given address and network mask
in their dotted decimal notations as shown.
(6-112) Fig. P. 1.4.5(a) : First address in the block
From Fig. P. 1.4.5(a) we get the first address in the
block as :
First address = 129.65.33.0 Ans.
‘Step Find the last address :
To obtain the last address in the block, we have to keep
the left most 24 bits in the given address as it is and set the
remaining 8 bits to 1s as shown in Fig. P. 1.4.5(b).
(G-1813) Fig. P. 1.4.5(b) : Last address in the block
= From Fig. 1A5{b) we get the last adressin he
is as follows :
Last address = 129.65.33.255 an
1.4.5 Block Allocation :
Now let us understand how to allocate the BIOCKS in ng
classless addressing. The global authority for the bloc,
allocation is ICANA means Internet Corporation fg,
‘Assigned Names and Addresses.
But the individual addresses of the Internet users isnot
allotted by the ICANA. Instead ICANA will assign large
blocks of addresses to various ISPs or large
organizations. These ISPs or organization will assign
addresses to the individual Internet users from thei
allotted blocks.
Restrictions
Some of the restriction on classless address blocks have
been imposed by the internet authorities in order to
simplify the process of address handling.
1. The addresses in a block should be continuous, ie.
serial in manner.
2, The total number of addresses in a block has to be
equal to some power of 2 Le. 24, 2", 2° ete.
3. The first address should be evenly divisible by the
number of addresses.
1.4.6 Relation to Classful Addressing :
~The classful addressing may be imagined as the special
‘case of classless addressing such that the blocks of
addresses in class A, B and C type addresses will have
the prefix lengths ng = 8, ng = 16 and ne = 24,
Table 14.1 lists the prefix lengths for class A to F
lassful addresses and using this information we can
change a block in classful addressing to a block in
classless addressing.
Table 1.4.1 : Prefix lengths for classful addressingACN (Comp. /Sem. 5/MSBTE)
14.7 Subnetting :
= The concept of subnetting in dassless addressing
domain is similar to that discussed for the classful
addressing,
= The subnetting is used for creating a three level
hierarchy in the classless addressing domain.
= An organization or an ISP have a biock of addresses
granted to them. It can divide these addresses into
several subgroups and each subgroup of addresses is
assigned to a subnetwork or subnet.
~The subnetworks may be subdivided further if the
organization want it that way.
1.4.8 Designing Subnets :
LetN = Total number of addresses granted to an
organization.
n= Prefix length
Assigned number of addresses to each
‘subnetwork
Prefix length for each subnetwork
Total number of subnetworks.
New =
ss
~ Now follow the steps given below to ensure that the
subnetworks operate propery.
Steps to follow :
= The number of addresses in each subnetwork should
always be equal to a power of 2. ie. 2°, 2',2%...ete.
= We can use the following expression to find the prefix
length of each sunetwork.
nev net
(45)
= The starting address in each subnet should be divisible
by the number of addresses in that subnework, To
achieve this we need to first assign address to larger
1.4.9 Finding Information about Each
Network >
After designing the subnetworks, we can find the
information about the subnets such as starting and last
addresses, we can use the same procedure that was
Network,
sed to find the information about each network in the
Internet.
Ex 146
‘A block of addresses granted to an ISP is
‘given by 130.34.13.64 / 26. These addresses
fare to be divided into four subnetworks with
equal number of hosts. Design the
subnetworks and obtain all the information
‘about each subnet.
Soln.:
Step 1: Find total number of addresses (N) :
= From the given address we get n = 26 (prefix length).
= Hence the number of addresses in the whole network
will be
N= 288% 2). a 6
= The first address in this block will be 130.34.13.64 / 26
whereas the last address will be 130.34.13.127 / 26.
‘These values have been obtained using the procedure
that we have discussed earlier.
‘Subnet design :
‘Step2:
= There are four subnetworks with equal number of
guests.
Find number of hosts per subnetwork :
Number of hosts per subnetwork is given by,
N84
N= N=N=Ne=g 2g 216 Ans.
~ Note that the first requirement that 64 / 16 should be a
power of 2 has been satisfied here.
Step 3: Find the prefix lengths of the subnets :
~The pref lengths of the four subnets are given by,
N
Ay = ngeny=ny=n-+ loge] 5 —
6 + log, 4
wns.
Starting and ending addresses of all the
subnets :
~ Refer Fig. P. 146 which shows all the starting and
ending addresses of the 4-subnets.
Step 4:
It should be noted from Fig. P. 1.46 that all the starting
addresses should be divisible by the number of
addresses in the subnet ie, by 16.1-20
I Se Tonwarang ager n we 8 cee sytem
ee | maps fond 9 the OE SAH Srey
Ea 20 tee see ey pret forwarding packets i a5 O1OWS
| f saa ere soon asa packet aves 2.2 TOURE 2p,
eee pee rea dress was shied HOht BY 28 bry
a “eee ‘obtain a 4 bit class number.
sonaner Me 2, A é-way branch then sorts packets into class»
COL eed at supported) with eight of the cass
‘Address aggregation is considered to be one of the cass A four of the cases for class B, 1WO of thy
cases for class Cand one each for Dand E.
advantages of CIDR architecture. As we know, ICANN assigns then masked off the &
3
2a large block of addresses to an ISP which is divided into
smaller subnets and assigned to the customers by the ISPs.
‘Thus many blocks of addresses are aggregated in one block
and assigned to one ISP.
peas ee caeeaes Ree
‘The code for each class
16-, or 24- bit network n\
itina 32 bit word.
sic number was then searched in the A
yumber and right alignes
4, The networ
BorC table.
Ex 147:
routing table :
Address/Mask Next Hop
195.46,56.022 Interface 0
135.46.60.0/22 Interface 1
192.53.40.0/28 Router 1
Default Router 2
For each of the following IP addresses, what
does the router do if a packet with that address:
arrives ?
1. 195.46.63.10 2, 192.53.56.7
Soin. :
CIDR - Classless inter Domain Routing +
‘A router has following CIDA entries in its
IP is being heavily used for decades. However, due to
the exponential growth of intemet, IP is running out of
addresses.
This is a potential disaster and the internet community
has begun discussion over it. In this section we are
going to discuss one of the solutions to this problem.
One of the solutions is CIDR (Classless Inter Domain
Routing). The CIDR is based on the principle of
allocating the remaining IP addresses in variable-sized
blocks regardless of the class.
Ifa site needs say 2000 addresses, then a block of 2048
addresses on the 2048 byte boundary is given to it.
However the classless routing makes forwarding of
'As soon as the entry was found, the outgoing line
was decided and the packet was forwarded upon
it
Forwarding with CIDR :
‘The simple forwarding algorithm explai
not work with CIDR.
Instead now each router table entry is extended by
siving if a 32 bit mask So now there is a single routing
table for all networks (no different tables for class A. B,
C ete) which consists of an array of triples. Each triple
consists of an IP address, subnet mask and outgoing
earlier does
line.
When a packet arrives at the input, the router first
extracts its destination IP address. Then the routing
table is scanned entry by entry to look for a match.
It is possible that different entries with different subnet
‘mask lengths match. In such a case the longest mask is
used. For example if there is a match for a/20 mask and
2/24 mask then /24 entry is used.
Solution of problem :
= Convert the IP address to bits and then AND it with the
subnet mask of the interface whose address is closest to
that of the IP addresses.
= The result of the ANDing will give you the network
address and the interface to send the packet to.
packets more complicated.IP = 138.46.63.10:
The interface whose address is closest to this IP is
interface 1. This interface uses a 22 bit mask. So AND the
given IP address with a 22 bit mask as follows :
IP = 136.4669.10 = 10000111.00101110.00111111.00001010
22 bt mask = 255.256 25200 = 11911191.11111911.11111100,00000000
1P AND Mask = 10000111.00101110.00111100.00000000
TP ANO Mask = 135.46.0.0
(61575)
This result of ANDing matches with the network address
Of interface 1. Hence the router will forward this packet
to interface 1.
2 P= 102.53.56.7:
The interface whose address is closest to this IP is
interface 2. This interface uses a 23 bit mask. So AND
the packet IP address with a 23 bit mask as follows :
IP 19288567 = 11000000.00110101.00111000.00000111,
Za bit mask = 255.255.2540 0 1448111.41111111.11111190.00000000
JP AND Mask = 11000000.00110701.00111000,00000000
= 19253560
e974)
This result of ANDing does not match with the network
addresses of interface 0 or 1. Hence the packet will
forwarded to the default ie. Router 2.
1.5 Special Addresses :
In the dlassful addressing, some addresses were
reserved for special purpose. Similarly in the classless
addressing as well some addresses are reserved.
1.5.1 Special Blocks :
Some address blocks have been reserved for special
Purpose.
1.5.2 All Zeros Address :
= The block (20.0.0 / 32 contains only one address. It is
called as the all zero address and has a prefix length of
n= 32,
~ This address has been reserved for communication
when a host has to send an IPv4 packet but it does not
know its own address.
~ In such situations, the host sends an IPv4 packet to a
DHCP server using this all zero address as the source
[ACN (Comp /Sem. SMSSTE) 4.21 Network Layer & Protocols
Address and a limited broadcast address (all one
address) as the destination address, so as to find its
own address.
1.5.3 All One Address-Limited Broadcast
= The block 255.255.255.255 / 32 contains only one
address. It is called as an all one address and has a
prefix length of n = 32.
= This all one address has been reserved for limited
broadcast address ie. if a host wants to send message
to all the hosts simultaneously then the sending host
‘can use all one address as a destination address inside
the IPv4 packet.
= Such a broadcasting is confined to the network only
because routers do not allow the all one packet to pass
through them.
= The datagram sent with the all zero address as
destination will be received and processed by all the
hosts on the network.
1.5.4 Loopback Address :
= Alloopback address is the address which is used to test
the software on a machine, The block 127.0.0.0 / 8 with
2 prefix length of 8 is used for the loopback address.
= On using this address, a packet does not leave the
machine at all but it returns to the protocol software. It
can be used for testing the IPv4 software.
1.5.5 Private Addresses :
= The address blocks that are not recognized globally still
‘assigned for private use are known as private addresses.
~ These addresses are neither connected to nor isolated
from the Network Address Translation (NAT)
techniques.
~ Table 15.1 depict such address blocks.
Table 1.5.1: Private addresses
Block | Number of
Et aiiteoenen
10.00.0/8 | 16,777,216 |192.168.00/16| 65,536
172.16.0.0/12| 1,047,584 |169.254.0.0/16| 65536Network Layer &
122
\CN (Comp. /Sem. SMSBTE) tion to this problem iS NAT ie. neg
ut a
1.5.6 Multicast Addresses :
The block 2260.00 / 4 with a prefix length of n = 4 has
been reserved for the multicast IP communication.
1.5.7 Special Addresses in Each Block :
~The usage of some address in each block for special
addresses has been recommended. But it has not been
‘made mandatory. These addresses are not assigned to
any host.
One important point to be remembered is that a very
small block of addresses should not be used as special
addresses.
1.5.8 Network Address :
~The network address is defined as the first address (with
the suffix set all to Os) in a block. It is used for defining
the network itself. It does not define any host in the
network.
~ With the same principle, the first address in a
‘Subnetwork is called as the subnetwork address.
1.5.9 Direct Broadcast Address :
~ We can use the last address in a block or subblock (with
the suffix part set to all 1s), as a direct broadcast
address for that block or subblock,
wick sol ;
e translation. It is described in RFC 3022
address
the basic idea in NAT is that each COMPANY is asi,
e
ingle P address or at the most a small number g,
a sing!
addresses so as to access the Internet.
Within the company, every computer gets 2 unique
address which is used for routing the internal trafic gy
the office
But when a packet goes out of the company, and gos,
to ISP, the translation of IP address takes place there,
In order to make this scheme work, three ranges of p
‘addresses have been declared as private. Companie;
can use these addresses internally as per ther
requirement. However no packet containing these
addresses is allowed to appear on the Internet. The
three reserved ranges are as follows :
10.0.0.0 to 10.255.255.255/8 | 16777216 Hosts
1048 576 Hosts |
~ A router generally uses this address for sending a
Packet to all the hosts connected to a specific network.
This address is used as the destination address in the
Pv packet and all the hosts will accept and process the
datagram which has this destination address,
1.6 NAT — Network Address Translation
mn Address Translation :
~ The problem that existing number of IP addresses is
tess than the actully required ones is practically
important,
~ Along term solution to this problem is thatthe whole
Intemet should be migrated from IPv4 to IP. Ths has
begun, but will take year to get complete. (That means
all the computers should have IPV6 addresses instead of
v4 addresses),
_| 173.31.255.255/12 |
| Ranges | 192.168.0.0 to 65536Hosts
5 | 102.168.255.258116
|
Generally most companies choose the addresses from
the first range.
Refer Fig. 1.6. which explains the operation of NAT. It
Shows that within the company premises, every
Machine has a unique address of the form 12abe.
But when @ packet leaves the company premises, it
Passes through the NAT box This box converts the
internal IP address 120.02 in Fig. 161 to the
ComPany/s true IP address 198.6049 19,
The NAT box is Senerally combined with a firewall Iti
3150 possible to integrate the NAT box into company’s
‘outer.ACN (Comp. /Sem. S/MSBTE)
1.7__Internet Protocol Version 4 (IPv4)
— We have already discussed the addressing mechanism,
for the IP packets.
— Now we will discuss the format of IP packet in the next
few sections.
= _ In the discussion we will see that an IP packet consists
of a base header and options which are sometimes
Useful in controlling the packet delivery.
1.7.1 Position of IP :
= The main protocols corresponding to the network layer
in the TCP/IP suite as well as Intemet layer are : ARP,
RARP, IP, ICMP and IGMP. This is as shown in Fi
- Out of these protocols IP is the most important
protocol. It is responsible for host to host delivery of
datagrams from a source to destination. But IP needs to
take services of other protocols.
~ IP takes help from ARP in order to find the MAC
(physical) address of the next hop.
1.7.2
Network Layer & Protocols,
IP uses the services of ICMP during the delivery of the
datagram packets to handle unusual situations such as
presence of an error.
IP is basically designed for unicast delivery. But some
new Internet applications as well as multimedia need
multicast delivery.
S0 for multicasting, IP has to use the services of another
protocol called IGMP.
IPv4 is the current version of IP whereas IPv6 is the
latest version of IP.
Internet Protocol (IP) :
The Internet Protocol is the host to host delivery
protocol which belongs to the network layer and is
designed for the Internet.
IP is used as the transmission mechanism by the
TCP / IP protocols. That means the TCP or UDP packets
‘are encapsulated in the IP packet and the IP carries it
from source to destination.
PP is a connectionless datagram protocol with no
guarantee of reliability.
It is an unreliable protocol because it does not provide
any error control or flow control.
IP can only detect the error and discards the packet if it
is corrupted
If IP is to be made more reliable, then it must be paired
with a reliable protocol such as TCP at the transport
layer.
Each IP datagram is handled independently and each
one can follow a different route to the destination.
So there is a possibility of receiving out of order packets
at the destination. Some packets may even be lost or
corrupted.
IP relies on a higher level protocol to take care of all
these problems,
The version of IP that we are going to discuss is called
as IPv4 ie. IP version 4,
IP is also called as a best effort delivery protocol. The
meaning of the term best effort delivery is that the IP
Packet can get lost or corrupted or delayed. They may
arrive out of order at the destination or may create
congestion in the network.
TochKnewlodgsACN (Comp. ‘Sem. SMSBTE)
1.7.3 Datagram:
= Packets in IP layer are called datagrams. Fig. 17.2 shows
yer 9
the typical format of an IP packet
A datagram has two parts namely the header and data
as shown, The length of datagram is not fied. It varies
from 20 bytes to 65536 bytes.
~The length of the header is 20 to 60 bytes. The
information necessary for the routing and delivery of
the datagram has been stored in the header
= The other part of the datagram is the data field which is
of variable length
720 to 65596 byles
(6-525) Fig. 1.7.2: IPv4 datagram format
— Its a custom in TCP/IP to show the header in 4-byte
(22 bit) sections.
1.7.4 IPv4 Header Format :
~The IP frame header contains routing information and
control information associated with datagram delivery.
The IP header structure is as shown in Fig. 1.7.3.
31
Destination IP address
‘Options + Padding
(0 - 40 bytes)
(6-2082) Fig. 1.7.3 :1Pv4 header format
= _ Various fields in the header format are as follows :
1. VER (Version) :
— This is a 4 bit field which is used to define the
version of IP protocol. The current version of IP is 4
i.e. IPv4 but in future it may be completely replaced
by the latest version of IP i. IPv6.
= This field will indicate the IP software running on
the processing machine that this datagram belongs
to IPv4 version,
4-24
Network Layer & Pio,
essing machine
gram
some
If the proc
0 of IP, then the
ersio il be discardes
HLEN (Header length) :
‘This 4-bit long field is
of the datagram header i!
this field is multiplied by 4 to get,
Pv header which varies between z,
sed f0r defining the ln,
- in 4-byte words
= The value of
length of the
and 60 bytes.
there are no
~ inet he header length is 5x 4 = 20 bytes,
men the value of option field i maximum the
aan of HLEN field is 15 and the corresponding
rane length is maximum ie. 15 x 4 = 60 bytes,
options, the value of this Fela,
‘Service type =
In the earlier designs of IP header, this field was
called as Type of Service (TOS) field and its job
was to define how the datagram should be
handled.
= At that time, a part of this field used to define the
precedence of datagram and the remaining part
used to define the type of service out of different
possible services such as low delay, high
throughput etc.
= But now the interpretation of this field has been
changed by IETF. This field is now supposed to
define a set of differential services. Fig. 17.4
illustrates the new interpretation of the service
type field
TTT fo
Procedon0e epee Pt
intorrotation = epee b fot
Differential
service interpretation
(G-2083) Fig. 1.7.4 : New interpretation of service type field
~ As seen in Fig. 1.7.4, in the new interpretation, the
ae ‘ye fed is divided into two subfields
paaree ee codepoint subfield and a 2 bit
We can use the 6-bit codepoint subfield in two
different ways, as follows
1 For the
interpretation,
Purpose of precedence
2. For the differential service interpretation.
Technolog4
wv
ACN (Comp. ‘Sem. SMSBTE)
Network Layer & Protocols
Wren corp Som swseTe) Oe
Precedence Interpretation :
= If the three right most bits are zeros, then the three
leftmost bits are interpreted the same as the
precedence bis in the service field (old interpretation)
‘That means itis compatible with the old interpretation
of this fila
= The precedence interpretation is used for defining the
priority level of this datagram (from 0 to 7) in the
situations lke congestion.
In the event of congestion, the datagrams with lowest
precedence (0) will be discarded first.
\tferential service interpretation :
When the three rightmost bits are not all zeros, the 6
bit codepoint subfield is used for differential service
interpretation.
In that case these 6 bits can be used for defining a total
of 56 (64 - 8) services, on the basis of the priorities
assigned by the Intemet or local authorities as per
Table 17.1.
Table 1.7.1 : Values of codepoints
1 xxxxx0 | Internet
2 | xxxxt1 | Local
3, | xxxx01 | Temporary or Experimental
The first, second and third categories contain 24, 16 and
16 service types respectively.
The Intemet authorities assign the first category. The
local authorities assign the second while the third one is
temporary and can be used for experimental purposes.
Total length :
= This 16 bit field is used to define the total length of
the IP datagram. The total length includes the
length of header as well as the data field
- The field length of this fields is 16 bits so the total
length of the IP datagram is restricted to
(2° - 1) = 65535 bytes out of which 20 to 60 bytes
constitute the header and the remaining bytes are
reserved to carry data from upper layers.
This field allows the length of a datagram to be
upto 65,535 bytes, although such long datagrams
are impractical for most hosts and networks.
= Alllhosts must be prepared to accept datagram of
upto 576 bytes, regardless of whether they arrive
whole or in the form of fragments.
~The hosts are recommended to send datagram
larger than 576 bytes only if the destination is
prepared to accept larger datagram.
= We can find the length of data by subtracting the
header length from the total length.
= As stated earlier the header length can be obtained
bby multiplying the contents of HLEN field by four.
Length of data = Total length— header length
= The total length (maximum value) of 65,535 bytes
might seem to be large but in future the size of IP
datagram is likely to increase further because the
improvement in technology will allow more
bandwidth,
Why do we need the total length field ?
We might feel that the total length field is not at all
required because the host or router will drop the
header and trailer when it receives a frame. Then why to
include this field ?
The answer to this question is that in many situations
‘we do not need this field at all.
But in some special situations, only the datagram is not
encapsulated in the frame but there are some padding
bits as well that are included.
In such situations, the machine (host or router) that
decapsulates the datagram, needs to check the total
length field so as to understand how much is the data
and how much is the padding ?
Identification :
This field is used to identify the datagram
‘originating from the source host. When a datagram
is fragmented, the contents of the identification
field get copied into all fragments. This
identification number is used by the destination to
reassemble the fragments of the datagram,
W eaten,ACN (Comp. /Sem. SMSBTE)
6 Flags:
~ Flags : This is a three bit field. The 3 bits are as
shown in Fig 175.
Con
oe] Ln treme
This is do not fragment bit
(©-2nFig, 17.5: lag bits
~ First bits reserved, and it should be 0.
- ‘The second bit is known as the “Do Not Fragment”
bit If this bit is “1” then machine understands that
the datagram is not to be fragmented.
- But if the value of this bit is 0 then the machine
should fragment the datagram if and only if
necessary
~ The third bit is known as “More Fragment Bit” (M).
M = 1 indicates that the datagram is not the last
fragment and M = 0 indicates that this is the last or
the only fragment.
Fragmentation offeet :
- This is a 13 bit field which is used to indicate the
relative position of this fragment with respect to
‘the complete datagram.
~ _ Itis the offset of the data in the original datagram
‘Measured in units of 8 bytes.
~ Tounderstand this refer Fig. 1.7.6.
— The original IP packet (datagram) contains 4000
bytes numbered from 0 to 3999, It is fragmented
into three fragments.
~ The firs fragment contains 1400 bytes numbered
from 0 to 1399, The offset for this fragment is
0/8 = 0. Similarly the offsets for the other two
fragments are 1400/8 = 175 and 2800/8 = 350
respectively as shown in Fig. 1.76,
~The offset is measured in units of 8 bytes. Because
fragments should be of size such that first byte
‘umber is divisible by 8,
This is an 8-bit field which controls the maximum
number of routers visited by the datagram during
its lifetime.
A datagram has a limited lifetime for travelling
through an Internet.
= Originally the TTL field was designed to hold the
timestamp. This timestamp value was
decremented by one, everytime the datagram visits
arouter.
~ AS soon as the timestamp value reduces to zero
the datagram is discarded. But for this scheme to
become successful, all the machines must have
synchronized clocks and they must know the time
taken by a datagram to travel from one router to
the other.
~ Today the TTL field is used to control the
maximum number of hops ie. router by a
datagram.
~ _Atthe time of sending a datagram, the source host
wil store a number in the TT field. This number is
approximately twice the maximum number of
‘outers present between any two hosts.
~ Everytime this datagram visits a outer, this value is
decremented by one. If after decrementing, the
value of TTL field reduces to Zero then that router
discards the datagram,
Need of TTL feld :
the length of the offet field is 13 bits, so the ~AGN (Comp. ‘Sem. SMSBTED - Network Layer & Protocols,
- ‘The TTL field is needed in such situ ions for limiting
the lifetime of a datagram.
= The TTL field is also used to iit the Journey of
packet intentionally. For exemple if @ packet is to be
confined to a local network ‘only then 2 1 is stored in
the TTL field of this packet.
= As soon as it reaches the first router, then TTL field
value is decremented from 1 to 0 and the packet will be
discarded
9. Protocol :
= This is an 8-bit field which is used for defining the
higher level protocol which uses the services of IP
layer.
_ The data from different high level protocols can be
encapsulated into an IP datagram. These protocols:
could be UDP, TCP, ICMP, IGMP etc.
The protocol field contents would tell the name of
the protocol at the final destination to which this IP
datagram is to be delivered.
— At the destination, the value of this field helps in
the process of demultiplexing.
= Table 1.7.2 shows some of the values of this field
corresponding to different high level protocols.
Table 172
value | ) |
1 ICMP 17 UDP
2 IGMP 89 OSPF
6 | Top
10, Header checksum :
‘A checksum in IP packet covers on the header only.
‘Since some header fields change, this field is
recomputed and verified at each point that the Internet
header is processed,
11. Source address :
This field is used for defining the IP address of the
source. Itis a 32 bit field.
12, Destination address
This field is used for defining the IP address of the
destination. Its also 2 32 bit field.
13. Options
Options are not required for every datagram. They are
used for network testing and debugging, We have
discussed all the options in detail, later in this chapter,
Fragmentatio!
1.8 Fragmentation:
= Inthe Internet, a datagram sent by a host has to travel
through different networks before it is delivered to the
destination host.
_ at every router, the received frame is decapsulated, the
1p datagram is extracted and processed and
encapsulated in another frame.
= The size and format of the frame received by @ router
depends on the protocol used by the previous physical
network to the router.
— Asan example, imagine that a router connects a LAN to
a WAN, Then the frame received by the router is in the
LAN format and the one forwarded by itis in the WAN
format.
4.8.1. Maximum Transfer Unit (MTU) :
= The frame format of each data link layer protocol is
different in its own way. One of the important field in
the frame format is the maximum size of data field.
= Therefore when we encapsulate an IP datagram in a
frame, the datagram size should be less than the
maximum data size specified by the maximum size field.
= The concept of MTU has been illustrated in Fig. 1.8.1.
(6-2084) Fig. 1.8.1 : Concept of MTU
= Now the problem is that the value of MTU changes
from one protocol to the other used for the physical
network.
- We have to make the IP protocol independent of the
physical network. In order to do so the maximum length
of IP datagram was decided to be equal to 65,535
bytes.\CN (Comp. ‘Sem. /MSBTE)
~ we use a physical network protocol which has
MTU = 65,535 bytes, then the transmission will become
more efficient.
For the other protocols having MTU smaller than 65,535
bytes, the IP datagram is divided into small parts called
So that they can pass through the physical
etworks successfully,
This processes of dividing the IP datagram in smaller
Parts is called as fragmentation.
~ The fragmentation generally does not take place at the
‘Source because the transport layer there will adjust the
‘Segment size in such a way that they will fit in the IP
datagrams and data link layer frames.
~ After fragmentation, each fragment will have its own
hheader. Most of the fields of the original header are
Copied into the fragment header but some fields are
changed.
~ Such a fragmented datagram can be fragmented
further if it comes across a network with even ‘smaller
MTU.
~The fragmentation of a datagram can be carried by the
‘source host or any router on the route of the datagram.
— But the process of reassembly of all the fragments will
be carried out only by the destination host.
- All the fragments of a datagram are free to take any
route and we do not have any control over them. In
short each fragment acts as an independent datagram.
= The reassembly of fragments is not done during the
transmission because of the loss of efficiency associated
with it.
— At the time of fragmentation, all the required parts of
the header are copied into the fragments. But the
‘options field may or may not be copied as discussed
later on.
= The following three fields are altered when the host or
router fragments a datagram :
1 Flags.
2. Fragmentation offset.
; Network Layer & p
1.8.2. Flelds Related to Fragmentation
The following three fields in an TP datagram hea,
related tothe fragmentation and reassembly oy,
datagram.
1. Identification.
2. Flagsand
3. Fragmentation offset field.
49 Options:
= Inthe IP header there are two parts : A fixed part ang,
variable part. We have already discussed the fixed pay
of 20 byte length,
= At the most 40 byte long variable part consists of
‘options which we are going to discuss inthis section
~ Options as the name suggests are not required for
datagram. Their main application is for network testng
‘and debugging.
= Options are not a required part of a datagram but
‘option processing is very much a required part of the
software.
~ This implies that if the options are present in the
header, then all the implementations should be able to
handle them.
1.9.1 Format:
= The format of an option has been shown in Fig. 1.9.1. As
shown, it consists of three fields. namely, a type field (1-
byte), length field (1-byte) and a variable length value
field.
Je byle—vie— 1 byto—sle Variable —o
Copy L cass L Number
(G-2009) Fig. 1.9.1: Option format
3. Total length.
= The remaining fields in the IP header are copied as its.
The value of checksum should be calculated again
regardless of fragmentation.
~ And the final point about fragmentation is that only
data in a datagram is fragmented.
~ _Letus discuss these fields one by one.
1. Type:
~ As shown in Fig. 1.9.1, the type field is an B-bit field
4nd it contains three subfields as follows
1 Copy (bit,
2 Class @ bits),
3. Number (5 bits)W 40 comp. som. SMSBTE)
(@) Copy
This is a 1 bit subfield. So it can have only two
possible values, 0 or 1. If copy = 0, then the option
‘must be copied only into the frst fragment.
‘Whereas if copy = 1, then the option field must be
copied into all the fragments.
0 _| Copy option field only in first fragment.
1._ | Copy option field in all fragments
(>) Class:
This 2-bit subfield is used to define the purpose of
‘option. It has four possible values, out of which
‘only two (00 and 10) are defined right now. The
‘ther two possible values (01 and 11) are not yet
defined.
If dass = 00, it indicates that the option is being
used for datagram control, Whereas if copy = 10
then the option is used for debugging and
10_| Debugging and management.
11_| Not defined or reserved.
(©) Number;
This 5-bit subfield is used for defining the type of
‘option. This subfield has 32-possible values (types),
but currently only 6-types are defined as shown in
Table 191.
Table 19.1
(00000 _| End of option.
00001 | Nooption.
00011 | Loose source route
00100 _| Timestamp
00111 | Record root
01001 _| Strict source route
4.29
2
3.
Network Layer & Protocols
‘We will discuss these later inthis chapter.
Length :
~ This 8-bit field is used for defining the total length
Cf the option with the type field and the length
field included.
= The length field will not be present in al the option
types.
Value :
= This is variable length field which contains the
specific data which is required by that option.
= Similar to the length field, the value field also will
not be present in all the option types.
10 Option Type
‘As we started earlier, only six options are being used
currently. Fig. 1.10.1 shows the classification of these
options.
(62086 Fig, 1.10.1 : Categories of options
Options are classified into two option types is. single
byte options and multiple byte options.
There are two single byte options which do not require
the data or length fields.
‘The remaining four options are multibyte options which
the data and length fields.
Let us now discuss these options one by one.
1.10.1 No Operation Option :
This is a single byte option which is being used as a
filler between options.
‘As shown in Fig. 1.102, we can use the no operation
‘option to align the next option on a 16 bit or 32 bit
boundary.
eee[No-oP ]
‘An 11 - byte option
(©) NO-OP Is being used to align _(<) NO-OP is being used
beginning of an option to align the next option
(G-2087) Fig. 1.10.2 : No operation option
1.10.2 End of Option Option :
~ The second one byte option is the end of option
Option. It finds its application in padding at the end of
the option field.
~ Two important points about this option are as follows :
1. We can use it only as the last option.
2. We can use only one end of option. That means
after this option, the receiver should expect the
Payload data to arrive,
~ There if we need more than 1 byte to align the option
field, then we must use more than one no-operation
options and after that only one end-of-operation
option as shown in Fig. 1.10.3.
Type 0
190000000.
(@) End-of-option (b) Used for padding
(G-2088) Fig. 1.10.3
1.10.3 Record-Route Option :
~The record route option is a multiple byte option and it
is used for recording the Intemet routers which handle
the datagram,
Since the maximum size of the header is 60 bytes,
including 20 bytes of base header, this option can list
upto 9-1P addresses of the routers.
~ So actually only 40 bytes are left for the option part.
The format of the record-root option is as shown in
Fig. 1.104. The source creates fields that are to be filled
by each router visited by the datagram,
Network Layer & Pry,
1:30 ‘
At
‘only Hot
addros908, omy
‘can be ben
stored ate
{(¢-2089) Fig. 1.10.4 : Round trip option
‘The pointer field is an offset integer field which cont,
the byte number of the frst empty entry. That means, 1
points towards the first available entry. :
All the empty fields for the IP address are empty whe
the datagram leaves the source. The value of pointy
field is 4 which points to the first empty field.
‘When the datagram starts travelling, each router visite,
by this datagram, will insert its outgoing IP address in
the next empty field and increments the value of
pointer by 4 :
4 Strict-Source-Route Option :
= This is also @ multi byte option which is used by the
source to determine the route in advance for the
datagram travelling over the Internet.
~ Due to this it becomes possible for the sender to
choose root to get a specific type of service
(ie. minimum delay, maximum throughput etc).
~ _ Itis also possible for a sender to choose a safer and
more reliable root.
— Ifa datagram specifies a strict source route, then the
datagram must visit all the routers which are defined in
the option,
~ It should not visit any router whose IP address is not
sted in the detagram. If it does so then that datagram
willbe discarded and an error message wil be issued.
However the strict source routing is not generally
Preferred even by the regular users of the Intemet, as
they are not much aware of the phys pology
wysical toy of
the Internet.
:(6-2090) Fig, 1.10.5 : Format of strict source root option
1.10.5 Loose-Source-Root Option :
This option is similar to the strict source root option
discussed earlier. However this option is not as strict as
the strict source root option, itis more relaxed.
Here each router whose IP address is mentioned in the
list must be visited by the datagram as before but the
l
‘Unused (All zeros)
‘tthe rocolved IP datagram including
‘of datagram data
(G-2110) Fig. 1.12.6 : Format of parameter
problem error message
1.12.5 Redirection Error Messagi
If a router or host wants to send a packet to another
network then it should know the IP address of the next
router.
= The routers and hosts must have a routing table to find
‘the address of the next router and the routing table has
to be updated automatically on a continuous basis. The
redirection message is used for such updating.
TechKaowledsNetwork Layer & p,
ACN ( /Sem. SMSBTE) oe,
Code = 2: Redirection f0€ dome fr ang
~The ICMP sends a redirection message back to its host
to.carry out an automatic periodic updating
~ In order to ensure higher efficiency, the hosts do not
Participate in the process of routing table update. This
{5 because the number of hosts in the Internet is much
higher than the number of routers.
~ If the routing tabies of hosts are updated dynamically
then it creates an unwanted trafic.
~ Generally the static routing is used by the hosts. That
means the routing table of a host contains limited
‘number of entries. Generally a host knows the IP
‘address of only one router that isthe default router.
= Due to this, a host can send a datagram which is
destined for another network, to a wrong router.
~ Here the datagram receiving router will route the
datagram the correct router. However it sends a
redirection message to the host to update the routing
table of the host.
= Fig. 1.12.7 shows the format of the redirection error
message,
fea iB ho
[Tyee 18 [cose “Oto EE Ghecksum 7]
(6-211) Fig. 1.12.7 : Format of the redirection message
‘As shown in Fig. 1127, the second row of the
redirection message contains the IP address of the
appropriate target router.
It is important to understand that the redirection
message is different from the other error message
eventhough it is considered as an error reporting
message.
What is the difference ? In this case the router does not
discard the erroneous datagram. Instead itis sent to the
‘appropriate router.
This process of redirection is narrowed down by the
contents of the code field as follows:
1 Code = 0 : Redirection will be for a network
specific route.
2. Code = 1: Redirection is to be done for a host
specific route.
specific route and based UPON 8 specifc yo."
service
Code = 3 : Redirection is to be done for sj,
speci rote on the Bass of SPecied yg,
service.
“A route sends the redirection message back
1.13 Query Messages. (ICMPv4) :
Query
‘The ICMP can diagnose some of the network problem,
This is in addition with the error reporting feature. Suc,
1a diagnosis is done through the query messages.
‘The query messages is a group of five different pais 1
messages as shown in Fig. 1.13.1.
4. Echo request and reply
2, Time stamp request and reply
8, Address mask request and reply
4. Router solatation and advertisement
65. Information request and reply messages
(G-2112) Fig. 1.13.1 : Query messages
However out of these five pairs of messages, only two
pairs are being used today. They are :
1. Echo request and reply.
2. Timestamp request and reply.
Let us discuss them one by one.
1.13.1 Echo Request and Reply :
This pair of query messages has been designed for the
diagnostic purpose. This pair of messages is utilized by
the network managers and users for identifying the
network problems,
This pair of query messages would determine whether
the two given systems (either hosts or routers) can
communicate with each other or not.
‘The communication will take place as follows
1. Abost or router sends the echo-request message
to another host or router it wants to communicate
to.
2. The host or router which receives the echo request
message will create an echo-reply message and
sends it back to the original sender.ACN (Comp. ‘Sem. SMSBTE) 1
= We can also use the echo-request echo-reply pair to
determine if the IP level communication is present or
not
= The network managers can use the echo request and
echo reply pair of messages to check the operation of
P protocol
= Ahost can also use this message pair to see if another
host is reachable or not. At the users level, this is done
by invoking the packet Internet groper command
ing).
= Now a days a version of ping command is provided by
most systems which can create a string of echo-request
‘and echo-reply messages for providing statistical
information.
= It is also possible to check whether a node is
functioning properly or not with the help of the echo-
request echo reply pair of messages. The format of the
echo request echo reply pair of messages is as shown in
Fig. 1132.
mf 00m he 10th
(G-2119 Fig. 1.13.2: Echo request and echo reply messages
= _InFig. 1132, the protocol does not formally define the
identifier and sequence number fields. Therefore the
sender can use them in an arbitrary manner.
1.13.2 Timestamp Request and Reply :
= This pair of messages can be used by the hosts and
routers to find out the round trip time that an IP
datagram needs to travel between them.
= Itcan also be used for synchronizing the clock signals
sed in the two machines (hosts or routers).
~ Fig. 1133 shows the format ofthese two messages.
|
(G-2116 Fig. 1.13.3 : Format of timestamp request and
timestamp reply messages
Network Layer & Protocols
= As shown in Fig. 1.133, there are three timestamp fields
‘and each field is 32-bit long. The number in each of
these fields represents time in milliseconds from the
‘midnight in Universal time
= Eventhough, the 32 bit field can represent a number
between 0 and 4,294,967,295 but @ timestamp in this
‘case can have the maximum value of 86,400,000
= 24 x 60 x 60 x 1000.
= The timestamp request message is created by the
source. It fills the original timestamp field at departure
time, and fills the other two timestamp fields will zeros.
— The timestamp reply message is created by the
destination host. The original timestamp value from the
timestamp request message is copied as itis into the
‘original timestamp field in the timestamp reply
message, by the destination.
= The destination then fills up the receive timestamp
field by the time at which the request was received.
— At the end the destination fils up the transmit
timestamp field with the departure time of the reply
message.
‘Computation of one way or round trip time (RTT) :
— We can use the pair of timestamp messages to
compute the one way or RTT i.e. the time required by
the datagram to travel from source to destination and
then come back to source again, as follows :
Sending time = receive timestamp - original timestamp.
Receiving time = retumed time - transmit timestamp.
Rount trip time = sending time + receiving time.
= If we want the calculations of the sending time and
receiving time to be accurate, then the two clocks in the
source and destination computers should be
synchronized.
= But the calculation of RTT will be correct even if the
locks at the source and destination machines are not
synchronized.
= We can calculate the one way time duration by dividing
the RTT by two.
1.13.3 Deprecated Messages :
IETF has declared the following three pairs of query
messages as obsolete :
1L.__ Information request and reply messages.
TecNetwork Layer & p,,
‘ACN (Comp. /Sem. SMSBTE) 138 ;
Obtain the checksum by complementing the.”
2. Address mask request and reply messages.
3. Router solicitation and advertisement.
1. The Information request and reply messages =
— These messages are not used now a days because
the Address Resolution Protocol (ARP) is doing
their duties.
2. Address mask request and reply :
- The IP address of a host contains a network
‘address, subnet address and host identifier.
- A host may know its full IP address but may not
know it is divided into three parts mentioned
above.
— Sot can send an address mask request message to
the router. The router then sends back the address
mask reply message.
— These messages are not being used today because
their duties are done by the Dynamic Host
Configuration Protocol (DHCP).
3. Router solicitation and advertisement :
‘A host that wants to send data to a host on
another network must know the address of routers
connected to its own network.
In such situations the router solicitation and
advertisement messages can help.
‘A host can broadcast or multicast a router
solicitation message. The routers receiving this
message can broadcast their routing information
using the router advertisement message.
‘These messages are not being used today because
their duties are done by the DHCP.
1.13.4 Checksum :
Earlier we have discussed the concept of checksum. In
ICMP, the entire message (including the header and
data) is considered for calculation of checksum.
Checksum calculation :
‘The checksum calculation is done at the sending end by
following the steps given below :
1. Set the checksum field to zero.
Calculate the sum of al the 16 bit words including
header and data.
2
calculated in step 2
‘4. Store the checksum in the checksum fil
Checksum testing =
the folowing steps are followed by the receiver yi,
{Vs complement arithmetic
the sum of all words (header and data
1. Calculate
2. Complem
3 Accept the message if the result obtained inst,
2 is 16 zeros. Otherwise the message is rejected,
1.14 Debugging Tools
In the Internet many tools can be used for debugging
ility of @ router or host. The
rent the sum calculated in step 1.
We can decide the feasi
route of a packet can be traced.
Following are the tools in which ICMP is used for
debugging :
1 Ping
2. Trace route or Tracert
1.14.1 Ping:
Ping program is used to search whether a host is
fing or alive. To the destination, the source host
respor
sends ICMP echo-request message if it is alive
destination responds with ICMP echo-reply messages.
Inthe echo-request and echo-reply messages the ping
program sets the identifier fields and it starts with the
sequence number 0. When a new message is sent, at
every time this number is incremented by 1.
= Ping can compute the round trip time. In the data
section of message it adds the sending time in it.
- After arriving the packet, the round trip time can be
\ calculated as follows :
Round trip time = Departure time of packet - Arrival
time of packet
- To understand the concept of ping, consider the
following example, which shows how we send a ping
‘message to particular sit.W ACN (Comp. Sem. SMSBTE)
Example
We will use ping to test the server xyz edu having IP
‘address 192,181.84 with 64 bytes of data.
$ Ping xyz-edu
ing xyz edu (192.181.8.4)-56 (84) bytes of data
a 62
6 62
a e
6 3 | 62|1.00ms
a 4 _|62|191ms
Cc 8 _| 62 | 200ms
“4 6 _|62| 201ms
~ x72: edu ping statistics is as follows :
7 packets are transmitted.
7 packets are received.
(0% packet loss.
Minimum rtt (round trip time) = 1.90 mS
Average rtt = 1.95 mS
awe ene
Maximum rtt = 2.04 mS
‘The ping starts sending messages from sequence
number 0 which gives us RTT time for each probe.
- In the IP datagram which encapsulates an ICMP
message has been set to 62 it means that the packet
can travel only upto 62 hops.
Ping defines 56 number of data bytes at the beginning
and 84 total number of bytes (56 + 8 bytes of ICMP
header + 20 bytes of IP header = 84 bytes).
The ping program continues message sending with 64
bytes in each probe (56 + 8 = 64 bytes).
With interrupt key (ctrl + C) we can stop ping program.
The statistics of probe is printed after interruption. The
statistics includes the number of sent and received
1-39
Network Layer & Protocols,
Packets, minimum, maximum and average round trip
time, packet loss etc.
1.14.2 Traceroute or Tracert :
— From a source to the destination to trace the path of a
packet in UNIX, the traceroute program and in
Windows, tracert program can be used.
= Traceroute / tracert can search the IP addresses of all
the routers which are visited in that path.
= Usually the program is set for checking of maximum
30 routers (hops) to be visited
= Inthe internet normally the number of hops is less than
this.
Traceroute :
= The ping and traceroute programs are different. To get
the help the ping program uses two query messages
whereas traceroute program uses two error reporting
messages namely time-exceeded and destination-
unreachable.
This is application layer program in which only the client
program is required. There is no server traceroute
program because in the destination host, client
program never reaches the application layer.
~ Ina UDP user datagram the traceroute program is
encapsulated. A port number which is not available at
‘the destination is intentionally used by traceroute
program.
= The traceroute sends (n + 1) messages if there are n
routers are present in the path.
Each router discards one message that means the first n
messages are discarded and the destination host
discards the last message.
~The (n + 1) ICMP error reporting messages received are
used by the tracceroute client program for searching
the path between the routers.
= Fig. 1:14. shows the use of ICMPv4 in traceroute
program in which the value of n is automatically found,
there is no need to the value of
TecknowtndstNetwork Layor 4
1-40 See,
ACN (Comp. /Sem. 5MSBTE) rs
ene message Wl EE 1 row gy
~ From the host A with TTL value 1 the first traceroute
message is sent at the first router (RI) this message is
discarded which sends ICMP time exceeded error
message from which the traceroute program will come
0 know the IP address of the fist router and the name
of router,
~ With TTL value 2, second traceroute message is sent
which will find the name and the IP address of second
router (RZ) Similarty the third and fourth message can
find information about R3 and Ré respectively.
‘The fifth message reaches the destination host is also
dropped but for some another reason. ie. the
Gestination host B cannot be able to find the port
‘number which is specified in the UDP datagram. Then
ICMP sends the destination-unreachable message with
‘ode 3 which shows that the port number isnot found.
= __The traceroute program after receiving destination-
destination is reached.
To find the name of the final destination ang tp Xe,
it uses the data in the received message, i,
fig, 1.14.1 value of nis 4.
To find the destination and the roundtrip time og,
router the traceroute program sets a timer.
To find better estimate for round trip time most,
traceroute programs sends three messages wit, .
same TTL value to each device.
Tracert :
In Windows, the tracert program is used which behay,
differently than ping and traceroute. In IP datagran
the tracert program is directly encapsulated.
= Similar to traceroute, the tracert sends echo reque;
‘messages to routers, when last echo request reacte
the destination an echo reply message is received,141
W A0N (comp. ‘Sem. SMSBTE) — ri Layer & Protects,
1.15 Mobile IP :
Mobile IP is the extension of IP protocol. It has been
developed for the mobile and personal computers such
as notebook.
= Mobile IP allows the mobile computers to get
connected to the Internet at any location.
1.15.1 Addressin
= Addressing is a very important problem in providing
mobile communication using IP protocol We will
discuss its solution in this section.
1.15.1.1 Addressing In Stationary Hosts :
~The original IP addressing was designed on the basis of
two assumptions
1. The host is stationary.
2. The host is connected to only one network.
= _AnIP datagram is routed by the routers on the basis of
the IP address.
As discussed earlier in this chapter, an IP address is
made of two parts: a prefix and a suffix.
= Abhost gets associated with a network due to the prefix
part ofits IP address. That means a host cannot carry its
IP address with itself from one place to the other.
~ That means with change in place, the network changes
and so does the IP address of the host.
= Routers use the fixed association between a host and its
‘network for routing the packets to the network to which
the host is attached.
1.15.1.2 Mobile Hosts :
~The IP addressing structure needs to be changed when
‘host moves from one network to the other. To achieve
this, various solutions have been suggested.
- Two of them are as follows :
|. Changing the address :
- One of the solutions is to allow the mobile host to
change its IP address as it changes the network.
= This can be achieved by using DHCP. The mobile
host can obtain a new IP address using DHCP and
{get associated with the new network
= But this technique has many drawbacks. Some of
them are as follows
Drawbacks
1. We need to change all the configuration files.
2. The mobile host would need rebooting, everytime it
‘moves from one network to the other.
3, It would be necessary to revise the DNS table everytime
so that all the other hosts on the Internet are aware of
this address change.
4, If the mobile host moves from one network to the other
when transmission is taking place, then the exchange of
data will be interrupted because during the
transmission, the client and server cannot change their
port and IP addresses.
2. Twoaddresses :
= Due to all the drawbacks of the first approach, the
second approach of using two IP addresses for a
mobile host is tried out and it is found to be a
more feasible approach.
= The two IP addresses assigned to a mobile host
are:
1L.Home address and 2. Temporary address
= The home address is the original IP address of the
mobile host, and the temporary address is called as
the care of address.
~The home address associated the host with its
home network (ie. the network which is permanent
home of the host and it is its permanent IP
address.
~ When the host moves to the other network, its
temporary (care-of) address changes. This care-of
address associates the host with the foreign
network.
1.15.2 Agents :
~ Alhome agent and a foreign agent are required for
‘making the change of address transparent to the rest of
Intemet.
TechKnowtedgs(G-2257) Fig. 1.15.1 : Home agent and foreign agent
In Fig. 1.15.1 the home and foreign agents have been
shown as routers. However actually they act as a router
as well as a host.
Home Agent :
- A home router is basically a router attached to the
home network of a mobile host.
When a remote host sends a packet to the mobile
host, the home agent acts on behalf of the mobile
host, receives the packet and sends it to the
foreign agent.
Foreign Agent :
A foreign agent is a router connected to the
foreign network.
The packets sent by the home agent are received
by the foreign agent and delivers them to the
mobile host.
Sometimes, a mobile host itself can act as foreign
‘agent. Then there is no need of using a separate
foreign agent.
~ For thi, the mobile host should have the ability to
receive a care-of address on its own. This can be
done using DHCP.
~ _In addition to this @ special software needs to be
installed at the mobile host to enable it to
communicate with the home agent and to have the
two addresses (home and temporary)
Network Layer & p
at keep the dual %
ACN (Comp. /Sem. 5/MSBTE) Lis necessary 10 ceep ua san
- I parent to the application programs,
trans
me
The position of home agent with respect to the ho
it to
‘network and that of the foreign agent with respect
the foreign network are shown in Fig. 1.15.1.
led as coll
‘The care-of-address is call located
- mobile host itself is acting.
address if 2 "9 as 5,
foreign agent.
The use of collocated care-of address ha,
advantage that the mobile host can move ig,
foreign network without even thinking about,
availability of the foreign agent.
However its disadvantage is that an extra softy,
needs to be installed with the mobile host.
1.15.3 Three Phases :
The communication of a mobile host with 2 remo,
host goes through the following three phases :
1
2
3
Agent discovery
Registration
Data transfer.
All these phases are shown in Fig. 1.15.2.
Phase-|: Agent Discovery (Steps 1 to 4) :
This is the first phase in mobile communication. t
Consists of the following two subphases :
1. Agent solicitation and
2. Agent advertisement.
‘A mobile host must leam the address of (discover)
its home agent before moving to any foreign
‘network (Steps 1 and 2). The mobile host must also
lear the address of (discover) the foreign agent
‘once it moves to a foreign network (Steps 3 and 4)
This process of address leaming includes leaming
Of both the care-of address and the foreign agents
address,
The agent discovery phase involves the discovery
of home and foreign agents, This Process requires
{he use of two messages namely :
1. Advertisement ‘Message and
2. Solicitation method.
CO143 Network Layer & Protocols,
ACN (Comp. Sem. SMSBTE).
cae The Tine
(¢-z2snFig. 1.15.2 : Communication between mobile host and remote host
2. Phased! : Regletration (Steps & to 8): 3. Phase-ll: Data Transfer :
~ _Thisis the second phase of mobile communication.
The mobile host frst moves to the foreign network
‘and discovers the foreign agent (Phase-D.
= This is the third phase in mobile communication
after the agent discovery and registration. In this
phase the mobile host can communicate with the
remote host as shown in Fig. 1.15.2.
1. From Remote Host to Home Agent :
~ Ifa packet is to be transferred from the remote
host to mobile host, then the remote host uses its
agent (Sep). address as the souree address and home address
2. Registration of mobile host with its home of mobile host as destination address.
agent. This is normally done by the foreign
‘agent on behalf of mobile host (Step 6).
After this it must undergo the registration phase,
which comesponds to steps 5 to 8 in Fig. 115.2.
= The four aspects of registration are as follows :
1. Registration of mobile host with the foreign
~ But practically the home agent is pretending as the
mobile. So it will intercept the packet with the help
3 The mobile host must renew its registration if of proxy ARP.
the registration has expired. ~ Thus the communication from remote host to
4, The mobile host is supposed to cancel its mobile host actually takes place between the
registration when it retums back to its home remote host and home agent as shown in
network. Fig. 1.15.2.
~The registration request and registration reply ~The mobile communication between the Remote
messages are used as shown in Fig. 1152 for Host and Home agent has been marked by @ thick
registration of mobile host with the home agent path marked by °1* in Fig. 125.2(a).
and foreign agent.4
Pesce
2. From Home to Foreign Agent :
3. From Foreign Agent to Moblie Host :
4. From Mobile Host to Remote Host :
destination address.
(G-2259)Fig. 1.15.2(a): Data transfer from remote host to home agent
~ AS the packet is received by the home agent it
sends the packet to the foreign agent using the
concept of tunneling.
‘The home agent encapsulates this received IP
Packet into a new IP packet by using its own
address as the source address and foreign agents
‘address as the destination address and sends this
new IP packet to the foreign agent as shown by the
thick path marked by °2" in Fig. 115.2(a,
From the IP packet received the foreign agent will
recover the original packet by decapsulation
Process,
However the recovered original packet has the
hhome address of mobile host as its destination
address.
The foreign agent will refer to a registry table and
finds the eare-of-address of the mobile host. The
Original packet is then sent to the care-of-address
35 shown by the thick path marked by °3* in
Fig. 1152).
If @ mobile host wants to send a packet to a
remote hes it does itn anormal way
To do this the mobile host creates a packet wih ts
home address (and not the Care-of-address) as
Source address and remote host's address ag the
= Its very important to note that eventhough ty
packet originates from the foreign network, ith,
the home address of the mobile host.
This communication has been shown by the thik
path “4” in Fig. 115.2(a).
1.15.4 Transparency :
In the entire data transfer Process, the remote host
absolutely does not know anything about the
Movement of the mobile host.
Because, the remote host uses the home address as the
destination address when sending a packet to the
mobile host.
‘Similarly the mobile host uses its home address as the
Source address while sending a packet to the remote
host,
mobile
host is totally transparent because the Fest of the
{ntemet has absolutely no idea about the Movement of
the mobile host,
1.15.5 Inefficiency in Mobile Ip ;
The communication done with the help of mobile IP can
be moderately to severly inefficient1
ACN (
‘Sem. 5MSBTE)
145
twork Layer & Protocols,
(G-2260)Fig. 1.15.3.
Double Crossing or 2X :
Now consider a situation in which a remote host
wants to communicate with a mobile host which
has moved to the same network as that of the
remote host as shown in Fig. 1.15.3.
This is called as a double crossing or 2X case ie.
the case of severe inefficiency.
‘As discussed earlier, a mobile host can send a
packet directly to the remote host. Therefore there
{sno loss of efficiency in this communication.
However if the remote host wants to send a packet
to the mobile host then it cannot do so directly (via
the dotted direct path in Fig. 125.3).
Instead the remote host has to send the packet
first home agent (path-1 in Fig. 1.15.3) and the
home agent will route the packet to the mobile
host (path-2 in Fig. 115.3).
In this the packet has to cross the Internet twice.
Thus the resources are used twice unnecessarily in
this communication which reduces the efficiency
severely.
Hence the double cross case is called as the case of
agent
Double crossing
(G-2260Fig. 1.15.4 : Triangle routing
= In this situation as well if a mobile host wants to
send a packet to @ remote host it can do so directly
without any loss of efficiency.
= But when a remote host wants to send a packet to
a mobile host the packet has to first travel to the
home agent and then to the mobile host as shown
in Fig. 1154,
~ Thus the packet has to travel along two sides of @
triangle instead of only one whichis the direct path
shown by a dotted line in Fig. 1.15.4
1.15.6 Remedy :
severe inefficiency.
Trlangle Routing or Dog Leg Routing :
‘triangle routing or dog leg routing is a case of
moderate inefficeny. It occurs when a remote host
wants to send a packet to the mobile host which is
Not attached to its own (remote) network.
This situation is illustrated in Fig. 1.15.4.
Binding the care-of-address to the home address of
‘mobile could be one of the solutions to the problem of
inefficiency.
That means when the home agent receives the first
packet from the remote host and sends it to the foreign
‘agent it should also send an update binding packet to
the remote host. By doing this itis ensured that all the
future packets to this mobile host can be sent to the
‘care-of-address rather than home address.
The remote host can save this information in a cache
However this remedy also has an inherent flaw. The
cache entry would become outdated as the mobile
host moves to a new network.\CN (Comp. /Sem. S/MSBTE)
To avoid this the home agent must send a warning
packet to the remote host to inform that the mobile
host has moved to a new network.
6 __Virtual Private Networking (VPN)
a3
a4
Due to Internet software, it appears that the Internet is
2 single, seamless system of communication to which
lots of networks containing a large number of
computers are connected.
The internal details of these real or actual networks get
hhidden when they become a part of the Internet. Every
computer connected to the Intemet has it own unique
address assigned to it.
The users of the Internet do not have to bother about
the internal structure of the physical networks and the
details related to them. Thus the user is a part of @
virtual network. Intemet is thus the best example of
virtual networks.
The concept of virtual networks states that in such types
of networks, different computer networks are not only
connected together but you feel that they are a part of
2 big single network. The concept of virtual networks is
illustrated in Fig, 1.16.1.
Explain the connection oriented and connectionless
services.
Why modem computer use dynamic routing ?
Explain with example how distance vector routing is
used to route the packet and why count-to-nfinty
problom arises and how does it get solved.
What is fragmentation ?
White short notes on : Hierarchical routing,
1-46.
as
a6
a7
a8
ag
a.10
an
a2
13
a4
15
a6
ai
0.18
a9
20
21
a2
23
24
27
Q.28
Q.29
routing.
port notes O° we ork layer,
waite s! nt protons ine nem
Name aire P.
‘of ARI
Explain ue es proadast but ARP 1g,
why is
unicast ?
wit ceo in IP.
mentation in IP.
Explain fragt packet in IP?
Whatis the name of &
Explain the IP header.
how is fragmentation related tj
write @ note on ICMP.
Name and describe three types of IPv6 addresses,
What is unicast routing ?
What is multicast routing ?
Write a note on mobile IP.
What is fragmentation ? Explain how is it suppor
in IPv4 and IPv6.
Explain the addressing scheme in IPv4 and IPt
When IPv6 protocol is introduced, does the ARF
protocol have to be changed ? Explain.
What is fragmentation ? Explain how it is supporte:
in IPv4 and IPv6.
Given an IP address, how will you extract its net «
and host id.
What is PING utility ? How many ways are there t
implement PING ? Explain steps.
What is subnetting in IP network, explain wit
suitable examples.
Why is an ARP Query sent within a broadcas
frame ? Why is an ARP response sent within ¢
{frame with a specific destination LAN address ?
‘A network on the intemet has a subnet mask o
(255.255.240.0. What is the maximum number ¢
hosts it can handle ?
‘An IP datagram using the strict source routing opi"
has to be fragmented. Do you think the option #
copied into each fragment, or is it sufficient 10
Put itis the fist fragment ? Explain your answer
aa
Wy eaten