Unit-3 CN Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

more for a

aPPIIcatioN gateways specific application.


5.19. INTRODUCTION TO VARIous NETWORK LAYER PROTOcOLS (Very Important)
We have discussed the TCP/IP model in
chapter
1. In the Internet model, or the IGMP ICMP
TCP/IP suite, there
are five main network
layer protocols: ARP, RARP,
IPICMP and IGMP as shown in figure 5.37.
IP
The main protocol in this layer is IP. It is
responsible for host to host delivery of datagrams Network
from a source to destination. But, IP layer
services of other protocols. IP needs a
requires |ARP RARP
protocol
called ARP in order to find the MAC Fig. 5.37. Protocols at network layer
(physical)
address of the next hop. IP needs the services of
to handle unusual situations such as
JCMP during the delivery of the datagram packets
occurrence of an error. P is
delivery. But the multimedia and some new applications in the Internet basically designed for unicast
need multicast delivery. So
for multicasting, P has to use the services of another
version of IP whereas IPv6 is the latest version of IP.
protocol called IGMP. IPv4 is the current

5.20. ARP (ADDRESS RESOLUTION PROTOCOL)* (U.P. Tech. Sem. Exam, 2007-08)(05 marks)
An Internet consists of various types of networks and the
- - - - - - - - - .
connecting devices like routers. A packets
Explain how do ARP and RARP map IP addresses onto data link layer such as Ethernet ?
(ULP. Tech, Sem. Exam; 2007-08) (10 marks)
Network Layer 281
from the source host, passes
rts
At the network level, the through many
hosts and routersphysical networks and finally reaches the
1.1PAddress
are
recognised by their IP addresses. desU
An IP address is an
lnternetwork address. It is a
involved in
Internetworking requires IP addresses. universally unique address, Fvery pro col
2. MAC Address
The packets trom source to
destination hosts pass through
level, the 1P address is not usetul but the
hosts and routers are
physical networks. At the physical
AMAC address is a local address. It is unique recognized by their MAC addresses.
MAC address are two ditterent identifiers and both locally but it is not unique
universally. The IP and
of them are needed, because a
can have two ditterent protocols at the
network layer at the same time. physical network
through different physical networks. Similarly, packet may pass
a

Therefore, to deliver a packet to a host or a router, we


addressing and MAC addressing. Most importantly, we should two levels of addressing nameiy
require be able to map the IP address intoi a
corresponding MAC address.

5.20.1. Mapping of IP Address into a MAC Address


We have seen the need of mapping an IP address into a MAC address. Such a mapping can be of
following two types:
() Static mapping DO YOU KNOW?
(i) Dynamic mappin8 The address resolution protocol
1. Static mapping (ARP) associates an IP address
In static mapping, a table is created and stored in each with the physical address. On a
machine. This table associates an IP address with a MAC typical physical network, such as
address. Ifamachine knows the IP address ofanother machine a LAN, each device on a link is
then it can search for the corresponding MAC address in its identified by a physical or station
MAC address
table. The limitation of static mapping is that the address usually imprinted on the
can change. To implement static mapping, the static mapping network interface card (NIC).
table needs to be updated periodically.
2. Dynamic mapping
protocola is used for finding the other address one tvpe of
In dynamic mapping technique, to pertorm the dynamic mapping. They are as
designed
address is known. There are two protocols
under:
Protocol (ARP).
)AddressResolution Protocol (RARP).
Resolution
(7) Reverse Address address whereas the
KARl' nmaps a MAC address to an
to a MAP
The ARP maps an IP address
IP address.
DO YOU KNOW?
5.20.2. ARP Operation ARP is used to find the physical
find the physical
association an
IP address to its
MAC
is used to
node when its
is used for address of the node
o r stationaddress
ARP device has its
o w n physical
Fora LAN, each o n the Internet address is known
known.
a uress. This address is imprinted | internet
identification.
Nress as its
VIC (Network Interface Card).
the sequence
How to Find the MAC Address?
MAC address of
M A C address host or network,
of another ho
to find the
a route o r a host needs
When router
ofevena
vents taking place is
as follows
282 Computer Networks
The router or host A who wants to find the MAC address of some other router, sends as ARD
request packet. This packets consists of IP and MAC addresses of the sender A and the IP address of
the receiver (B). This request packet is broadcasted over the network as shown in figure 5.38.

A Sender Receiver
ARP request packet

ARP request packet


is broadcasted over the
network

Fig. 5.38 ARP request is broadcasted

Every host and router on the network receives and processes the ARP request packet. But only
the intended receiver (B) recognizes its IP address in the request packet and sends back an ARP
response packet. The ARP response packet contains the IP and physical addresses of the receiver
(B). This packet is delivered only to A (unicast) using A's physical address in the ARP request packet.
This has been shown in figure 5.39.

A
Sender B Receiver
ARP response packet

Fig. 5.39 ARP response unicast


5.20.3. ARP Packet Format
The ARP packet format is as shownin figure 5.41. The various fields in it are as under:
1. HTYPE (Hardware type)
This 16 bit field defines the type of network on which is ARP is being run. ARP can run on any
physical network.
2. PTYPE (Protocol type)
This 16 bit field is used to define the protocol using ARP. Note that ARP can be used with any
higher-level protocol such as IPv4.
3. HLEN DO YOU KNOW?
(Hardware length)
It is an 8 bit field which is used for defining the length of The reverse address resolution
the physical address in bytes. For protocol (RARP) allows a host to
example, this value is 6 for
Ethernet. discover its internet address when
4. PLEN
it knows only its physial address.
(Protocol length)
This field is 8 bit long and it defines the length of the IP address in bytes. For IPv4, this value is 4.
5. OPER (Operation)
It is a 16 bit field which defines the type of packet. The two possible types of packets are: ARP
request (1) and ARP reply (2).
Network Layer 283
Hardware Type (16 bits)
Protocol type (16 bits)
Hardware length
Protocol length Operation request 1,
Sender hardware address
Reply
Sender protocol address
Target hardware address
Target protocol address
Fig. 5.40 ARP frame format
6. SHA (Sender Hardware Address)
The field 1s used for
defining the physical address of the sender. The length of this field is variable.
7. SPA (Sender Protocol
Address)
This field defines the
logical address of the sender. The length of this field is variable.
8. THA (Target Hardware
It defines the
Length)
physical address of the target. It is a variable length field. For the ARP
packet, the field contains all zeros because the sender does not know the receivers
request
9. TPA
physical address.
(Target Protocol Address)
This field defines the logical address of the
target. It is a variable length field.
5.20.4. Encapsulation The type field indicates that
the data carried by the frame
An ARP packet (request or reply) is is.
ARP packet
encapsulated directly intothe data link frame.
Figure 5.41 shows an ARP packet being Preamble Destination Source Type Data CRC
and SDF address address
encapsulated in an Ethernet frame. The type
8 bytes 6 bytes 6 bytes 2 bytes
field indicates that the data carried by the
Data field containss
frame is an ARP request or reply packet. the ARP request or reply
packet
5.20.5. Operation of ARP on Internet
Fig. 5.41 Encapsulation of ARP packet
The services of ARP can be used under the
Internet.
tollowing working conditions when it is being operated to another host on
on

host and wants to send a packet the same net.


() The sender is a
(i) The sender is a host and wants to send a packet to another host on another network.
(7) The sender is a router which has received
a
destined a hoston another network.
datagramdestined
for

datagram for a host in the same network,


router that has received
a
(i) The sender is a
the Internet.
Now, let us see how ARP works on

Operation knows the lP address


of
the target. IP orders ARP to create an ARP
The sender (host or router)
senaers paysical
consIsts or and iPaddresses plus the IP address
uest message. The request packet it is encapsulated in a
is sent to the data ink layer. Here,
the target. This ARP request packet All the machines except the
Decause is broadcast.
it
frame
radme. Every router o r host receives this ARP reply packet which contains
machine replies back with an
get drop this packet. The target I n e s e n d e r receives the reply packet. Itnow
This reply 1s unucast.
carrying data for the targetmachine
target's physical address. is
of the target. 1ne aatagram
the physical address the destination.
is unicast to
S

frame
cap ulated in a frame and the
284 Computer Networks
5.21. REVERSE ADDRESS RESOLUTION PROTOcOL (RARP)

(u.P. Tech. Sem. Exam, 2007-08)(05 marks)


BARP(ReverseAddress Resolution Protocol) is part of the TCP/1P protocol suite. Itallowsa comp
particularly a diskless workstation, to obtain an IP address from a server. When a diskless TCP/IP
workstation is booted on a network, it broadcasts a RARP request packet on the local network. This
address packet is broadcast on the network for all to receive because the workstation does not know
the lP address of the server that can supply it with an address. It includes its own physical network
address (the MAC address) in the request so the server will know where to return a reply. The server
that receives the request looks in a table and matches the MACaddress with an IP address, and then
returns the IP address to the diskless
workstation.
5.22. INTERNET PROTOCOL (IP Important)
This is the host to host network layer delivery protocol designed for the Internet. IP 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 DO YOU KNOW?
be made more reliable, then it must be paired with a reliable The Internet group message
protocol such as TCP at the transport layer. Each IP datagram protocol (IGMP) has been
is handled independently and each one can follow a different designed to help a multicast
route to the destination. Therefore, there is a responsibility of router identify the hosts in a LAN
receiving out of order packets at the destination. Some packets that are members of a multicast
may even be lost or corrupted. IP relies on a higher level
group. It is a companion to the IP
protocol to take care of all these problems.
protocol.
5.22.1. Datagram
Packets in IP layer are called datagrams. Figure 5.42 shows the Header Data
IP datagram format. A datagram is a variable length with two parts
namely the header and data. The header is 20 to 60 bytes in length. 20-60
bytes
It contains the information essential for routing and delivery. The
other part of the datagram is the data field which is of variable length. 20 to 65536 bytes
Fig.5.42. IP datagram format
5.22.2. Structure of IP Frame Header
The IPframe header contains routing information associated with datagram delivery. The header
structure is as shown in figure 5.43.
8 16 32 bits
VER HLEN D.S. type of service Total length 16 bits

ldentification 16 bits Flags 3 bits Fragmentation


offset (13 bits)

Time to live Protocol Header checksum (16 bits)


Source IP address
Destination IP address

Option+ Padding
Fig. 5.43 IP header structure

Sketch the IP header neatly and explain the function of each field. List major differences between lv4
and IPv6. (u.P. Tech, Sem. Exam; 2007-08) (05 marks)
Various fields in the IP header are as under:

1. VER (Version)
This field defines the version of IP. Current version of IP is IPv4 and the latest version of i 1s
four bit long field.
IPv6. It is a

2. HLEN (Header length)


This tield detines the length of the datagram header in 4-byte word. Its value must be
multiplicated by 4 to give the length in bytes.

3. Differential Service (DS)


This field defines the class of the datagram for quality of service purpose. Networks may offer
service precedence, meaning that they accept traffic only above certain precedence at times of high
load. There is a three way trade off between low delay, high reliability and throughput.

4. Total length
The field defines the total length of the IP datagram. The total length includes the length ot
header as well as the data field. The field length of this fields is 16 bits so the total length of the IP
is restricted to (216 1) =
20 to 60 bytes are the header and the
65535 bytes of which
datagram such
remaining are data. This field allows the length of a datagram to be upto 65,535bebytes, although
long datagrams are impractical for most hosts and networks. All
hosts must prepared to accept
arrive whole or in fragments. It is
datagramn of upto 576 bytes, regardless of whether they the destination is prepared to
recommended that hosts and datagram larger than 576 bytes only if
accept larger datagram.
5. Identification, Flag and Offset
() Identification
from the source host. When a datagram is

This field identifies the datagram originating into all identification


identification field is copied fragments. The number

fragmented, the value in the the fragments of the datagram.


helps the destination in reassembling
3 bit Mag fieid
() Flags
3 bits
This is a three bit field. The as more
This is called Bit 1s reserved
are as shown in figure 5.44. fragmentation bit
it should
bit is reserved, and This is do not fragment Dt
First Do Not
be 0. The second bit is called Fig. 5.44 Flag bits
is 1 then
tragment bit. If this bit the
should not fragment tragment the datagram it oniv it
nachine of this bit is 0
then the hlactine should
datagram. But if the value lt is I it that means the datagram i s n o t t h
called as More rugnient bit. it or the only
necessary, The third bit is that this is the
last tragment
is 0 it shows
dst fragment but if its value

(ii) Fragmentation offset of this tragulent w ith res


shows the r e l a t i v e position
This is a 13 bit field
which
data i n the original
atagram measured in units of 8 bytes. To
date

offset of
the I ' packet (datagram) ontains 400 byt
im. It is the
figure 45. The original
5.4
ted into three tragnents.
consider
understand this let u s
is fragmenteo
3999. It from O to 1399 The
otos

numbered from 0 to
1400 bytes
numbered

fragment
contains * - 1 7 5 and 2800 - 350 respectively
ihe first 1
are
two f r a g m e n t s

offsets fortheother
imilarly, the
286 Computer Networks
of the offset
units of 8 bytes. Because the length
as shown in figure 5.45. The offset is measured in such that first byte number is divisible by 8.
ield is 13 bits. So, the fragments should be of size

Offset =0/8 0

1399

Big original packet


Offset 1400/8 175

1400 2799
Byte 0 Byte
3999

Offset 2800/8 = 350


2800 3999

Three fragments
Fig.5.45 Example of fragmentation
6. Time to Live
This is an 8 bit long field which controls the maximum number of routers visited by the datagram
7. Protocol
This field defines the higher-level protocol which uses the services of the IP Layer. An Pdatagram
can encapsulate data from various higher level protocols such as TCP, UDP, ICMP and IGMP. The
protocol field specifies the final destination protocol to which the IP datagram should be delivered.
Since IPmultiplexes and demultiplexes data from different higher level protocols, the value of protocol
field helps in demultiplexing at the final destination.
8. 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.
9. Source Address
This field is used for defining the IP address of the source.
10. Destination Address
This field is used for defining the IP address of the destination.
11. Options
Options are not required for every datagram. They are used for network testing and debugging
IPprovides several optional features, allowinga packet's sender to set requirements on the path it
takes through the network (source routing), trace the route a packet takes (record route), and label
packets with security features.

5.22.3. Services Provided


IP provides following services:
1. Addressing
IP headers contain 32-bit addresses
which identify the sending and receiving hosts. These
addresses are used by intermediate
routers to select a path through the network for the packet.
2. Fragmentation
P packets may be split, or
fragmented, into smaller packets. This permits a large packet to
Network Layer 287
travel across a network which can
transparently. only handle smaller packets. IP
fragments and reasonable packets
3. Packet Timeout
Each 1P packet
contains a Time To Live
handles the packet. If TTL (TTL) field, which is decremented every time a router
reaches zero, the packet is
circles
forever and discarded, preventing packets from running in
flooding a network.
4.Types of Service
Psupports traffic prioritization by allowing
packets to be labeled with an abstract type of service.
5.22.4. IP Addresses 7bits 24 bits
As already stated
every host and router on
has a unique IP address. All the IP addressestheareinternet Network Host
32 bit
long and they used in the source address
are
and Fig. 5.46 (a) ClassA IP address formats
destination address fields of the IP header. The
formats
used for IP address are as shown in
figure 5.46. The IP address for class A networks is shown in
figure 5.46(a).
The lIP numbers
(addresses) for the hosts are assigned by the network administrator. For a public
network on the Internet, we have to obtain a
network number assigned by the network information
center. An IP address consists of two
parts. The first part of the address, called the network
identifies a network on the Internet, the number,
remainder, called the host ID, identifies an individual
on that network. host

1. Class A address
The network field is 7 bit long as shown in
figure 5.46 (a) and the host field is of 24 bit length. So
the network field can have numbers between1 to 126. But the host numbers will
range from 0.0.0.0
to 127.255.255.255. Thus, in class A, there can be 126 types of networks and 17 million hosts. The 0 in
the first field identifies that it is a class A network address.
2. Class B format
The class B address format is shown in figure 5.46 (b). The first two fields
identify the network,
and the number in the first field must be in the range 128-191
Class B networks are large. Host numbers 0.0 and 255.255 are reserved, so, there can be upto
5,534 (216 -2) hosts in a class B network. Most of the16,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.0.0 to 191.255.255.255.
128.89.0.26, for host 0.26 on net 128.89.
Example:
14 bits 16 bits 21 bits bits

10 Network Host 110 Network Host

Fig. 5.46 (b) Class Bformat Fig.5.46 (c) Class C Format


.Class C Format
The class Caddress format is
shown in figure 5.46 (c).
The first block in class C covers addresses from 192.0.0.0 to 192.0.0.255 and the last block covers
223.255.255.255.
ddresses from 223.255.255.0 to
1110 Multicast address
. Class D Format Fig.5.46 (d) Class D format
he class D address format is shown in figure 5.46 (d).
288 Computer Networks
The class format allow for upto 2 million networks with upto 254 hosts each and class D format
allows the multicast in which a datagram is directed to multiple hosts.
5. Class E Address Format 11110 Reserved for future use
Figure 5.47, shows the address format for a class
Fig. 5.47 IP address for class E network
E address. This address begins with 11110 which shows
that it is reserved for the future use.
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. Therefore, the lowest IIP address is
0.0.0.0 i.. all the 32 bits are zero and the highest IP address is 255.255.255.255.

5.22.5. Network Address


The network address is an address that defines the network itself. It cannot be assigned to a
host. Figure 5.48 shows the examples of network address for different classes.
Net ID Host ID

Specific All Os

115.50.15.90 115.63.7.30
L ****
Note that 115 is common
in the address of all machines
in class A network
115.90.121.4

115.0.0.0

Network address
(a) Class A network address

151.15.0.0 151.15.67.63

Note that 151.15 is common


151.15.90.91 in the address of all machines
in class B network
151.15.0.0

Network address
(b) Class B network address

223.21.70.4 223.21.70.58

Note that 223.21.70 is common


in the address of all machines
223.21.70.126 in class C network
223.21.70.0

Network address
(c) Class C network address

Fig. 5.48.
5.22.7. Address Masks (Default Masks) (U.P. Tech, Sem. Exam; 2005-06)(05 marks)
An address mask determines which portion of an IP address identifies the network and which
portion identifies the host. Like the IPaddress, the mask is represented by four octets. (An octet is an
8-bit binary number equivalent to a decimal number in the range 0-255). If a given bit of the mask
is 1, the corresponding bit of the IP address is in the network portion of the address, and if a given
bit of the mask is 0, the corresponding bit of the IP address is in the Network Host
host portion. As an example, let us consider a class C address
192.15.28.16. This is shown in figure 5.53. Here, it may be noted that 192. 15.28 16

192.15.28 corresponds to the network part and 16 corresponds to Fig.5.53.


the host part.
Hence, to differentiate the network and host parts, we have to use a mask 255.255.255.0. Table
5.2, shows the mask 255.255.255.0 in both decimal and binary form, aligned with the class Caddress
192.15.28.16, also in both decimal and binary formn:
Table 5.2. IP address (In decimal and binary form)

Network Host
Element
255 255 .255 0
Mask
11111111 11111111 00000000
11111111
.15 28 16
AddresS 192
11000000 00001111 00011100 000100000.
the network number, the corresponding
If afield of the network address is entirely used for
and if an address field is entirely used
field of the mask has the decimal value 255 (binary 11111111),
the mask has the decimal value 0.
for the host ID, the corresponding field of
Table 5.3.

in Fild Function
Decimal Value in BinaryoValue
f Mask T
Field of Mask
Identify network number
255 11111111
Identify host ID
O000000
0
291
Network Layer
shoWLn
Accordingly, the address masks for the three network classes described above are as
table 5.4. These masks are also called as default masks.

Table 5.4.
Address Class Address Mask
A 255.0.0.0
B 255.255.0.0

C 255.255.255.0

Which IP Protocol Version is Being Used Currently ?


first introduced in 1970's. After
The network protocol in the Internet is currently IPv4, It was IPv4 is a well
Even though
that the world of data communication has grown beyond imaginations.

designed protocol, it has some limitations.


5.22.8. Limitations of IPv4
network layer addresses to
obvious limitation of IPv4 is its address field. IP relies on
The most
address. IPv4 uses a
networks, and each networked device has a unique IP
identify end-points on
addresses. With the proliferation
of
32-bit addressing scheme, which gives it 4 billion possible are becoming
networked devices including PCs, cell phones, wireless devices,
etc., unique P addresses
run out of IP addresses.
If a network has slightly m o r e
scarce, and the world could theoretically of that class or the next
number of hosts than a particular class, then
it needs either two IP addresses
either a
let us say a network has
300 hosts, this network needs
class of P address. For example, is allocated to this network, as
class CIP addresses. If class B address
single class BIP address or two
be defined in a class B network is (2a 16 -2), a large
number of host IP
the number of hosts that can
addresses are allocated, as the number
of networks that can
wasted. If two class C IP
addresses are
of available class C networks will
class C address is only (2 a 21), the number
be defined using a
a lot of IP addresses are
wasted and also the
exhaust. Because of the above two reasons,
quickly identified limitations of the IPv4 protocol are:
is rapidly reduced. Other
available IP address space in re-numbering
configuration,
router addressing, difficulty
non-hierarchical
Complex host and QoS (Quality of
tables, non-trivial implementations providing security,
in
addresses, large routing the Internet
and multi-homing, multicasting etc. To overcome these problems,
Service),mobility protocol, next generation (IPng)
internet was
version 6 (IPv6) which is also known as
protocol was extensively modified for accommodating
the unforeseen
proposed. In IPv6, the Internet protocol
lP addresses has been changed and the packet
The format and length of the
growth of the Internet.
format also is changed.
(u.P. Tech, Sem. Exam; 2005-06) (05 marks)
5.22.9. Subnetting in IP
must have the same network number. But, this property of
IP addressing
All the hosts in a network
as the network size
increases. For example a company initially may have only
can be problematic
LANs each one having its own router
time passes by it might end up with many
the LAN but as the With increase in the number of distinct local
own class C network number.
and each one with its
becomes aproblem. Everytime a new network gets installed, the system
networks, their management number is to be
contact NIC to get a new network number and then this
administrator has to
Anotherproblem is that if a machine is to be moved from one LAN to the
announced worldwide.
needs to be changed. This will require modification in its configurational
other, then its IP address is
and its modified IP number needs to be announced to the world. The solution to this problem
files network to
into several smaller networks internally but it acts like a single
that the network is split us continue with
smaler parts of a network are called as subnets. Now, let
the outside world. The
292
Computer Networks
the same
example taken at the beginning of this subsection. DOYOUKNOW?
The
growing company should start up with class B address
a from
instead of class C address and if it can number the hosts
1 to 254. When a second LAN is to
Subnetting
Subnetting allows
allows an additional
additional an

be installed it can split the level of hierarchy in IP'addressing.


16 bit host number into a 6-bit subnet
number and 10 bit host
number as shown in
figure 5.54. 6 bits 10 bits
Due to this split, it is
(0 and
possible to connect 62 LANs
1 are reserved) and each
one can contain Subnet 10 Network Subnet Host
upto 1022 hosts. Outside the network, the subnetting Mask 1 111111111111111 111111
is not visible. Hence, even if a new subnet is created, 0000000000
32 bits
it is not essential to contact NIC or
database.
change any Fig. 5.54 One of the ways to subnet a
class B network
5.22.10. Subnet Mask
The number of 1's in the subnet mask is more
than the number of 1s in the corresponding default
mask. In subnet mask we
change some of the left most 0s in the default mask to make a subnet mask.
Figure 5.55 shows the difference between a class B default mask and subnet mask for the same block.
255 255.0.0
Default mask 11111111 11111111 0000000 00000000
16bits 16 bits

Subnet mask 11111111 11111111 111


00000 00000000
16 bits 13 bits
Three extra 1s
Fig. 5.55 Subnet mask
Number of subnets
This number of subnet is determined
by the number of extra 1s For 3 extra 1s, the number of
subnets will be 2 8. For n extra 1s, the number of
=

subnets is 21,
EXAMPLE 5.4. A number 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 1s and following bits are 0s), find
the subnet address.
olution: To find the subnet address, AND the
in figure 5.56.
destination address with the subnet mask as shown

191 - 13 Os

Subnet mask 11111111.11111111 111 000000 0000000

Address 11111111.11111111 111


00010.01011111
190 240 34 95
ANDING
Subnet address 11000000. 11110000 001 00000 00000000

190 240 32 0
Fig.5.56.
Therefore, the subnet address is 190.240.32.0.
5.22.11. Supernetting Network Layer 293
ne classA and class B
But, addresses are almost depleted.
the S1ze of class C address Important)
with maximunm But, class Caddresses are
still
requirement of an organization. More a
number of 256 addresses does not available.
Superneting. supernetting,
In addresses will be reauired. The
solution to this satisty theis
range or combines several class C blocks to problem
an
adaresses i.e. organization
several networks are
organization can apply for a set of combined to create a
supernetwork. By
create a large
Class C blocks instead of doing
this, he
Example of supernetting just one.
t an organization needs 1000
block addresses, thev can be obtained by
corresponds to 256 addresses).
supernetwork. The organization can then using four C blocks (one C
use these addresses in one

5.23. IPv6
(u.P. Tech., Sem. Exam; 2006-07)(05
Pv6 is the next marks)Expected)
generation Internet Protocol designed as a
designed to enable high-performance, scalable successor to the IP version 4. Pv6 was
the weaknesses of IPv4 Internet. This was achieved by
protocol and by adding several new features. overcoming many of
Advantages of IPv6
1. Larger address
space
IPv6 has 128-bit address
space, which is 4 times wider in bits in
space. So, there is huge increase in the compared to IPv4's 32-bit address
address space.
2. Buffer Header Format
IPv6 has a better header format. In its header
header. The options are inserted when needed, between
format, the options are separated from the base
helps in speeding up the routing process.
the base header and upper layer data. This
3. New Options
New options have been added in IPv6 to increase the functionality.
4. Possibility of Extension
Py6 has been designed in sucha way that there is a
pOssibility of extension of protocol if required.
5. More Security
IPv6 includes security in the basic specitication. It
includes encryption of
packets (ESP: Encapsulated
Security Payload) and authentitication of the sender of
packets (AH
Authentication Header).
6. Support to Resource Allocation
To implement better support for real time tratfic (such as video
label in the specification. With flow label mechanism, routers can
conference), IPv6 includes flow
flow the packets belongs.
recognize to which end-to-end

7. Plug and Play


IPv6 includes plug and play in the standard specification. It therefore must be easier for novice
users to connect their machines to the network, it will be done
automatically.
8. Clearer Specification and Optimization
IPv6 follows good practices of Pv4, and rejects minor flaws/obsolete items of IPv4.
294 Computer Networks
(U.P. Tech, Sem. Exam; 2005-06) (05 marks)
5.23.1. IPv6 Addresses
bits long as shown in figure 5.57.
An IPv6 address consists of 16 bytes (octets) i.e. it is 128
-128 bits = 16 bytes 32 Hex digits
Hexadecimal Colon Notation
v 6 usesa special notation called hexadecimal
colon notation. In this, the 128 bits are divided into
8 sections, each one is 2 bytes long. 2 bytes
2 8
1
correspond to 16 bits. So, in hexadecimal notation,
we will require four hexadecimal digits. Hence, the FDEE AC92 221A:FFFF
IPv6 address consists of 32 hex digits and every
16 bits 16 bits i t
16 bits 16 bits
colon shown
group of 4 digits is separated by or 2 bytes or 2 bytes
a as

in figure 5.57. IPv6 uses 128-bit addresses. Only 5.57 IPv6 address
Fig.
about 15% of the address space is initially allocated, remainder may be used in the future for
theremaining 85% being reserved for future use. This for
expanding the address spaces of existing address types or totally new uses.
5.23.2. Abbreviation
The IPv6 address, even in hexadecimal format is very long. But in this address, there are many

of the zero digits in it. In such a case, we can leading zeros of a section
abbreviate the address. The

(four digits between two colons) can be omitted. Note that only the leading zeros can be dropped
in figure 5.58.
but the trailing zeros can not be dropped. This has been illustrated

Unabbreviated AC81:9840 :10086 :3210:b00} A: BBFF:0000): FFFF|


address
Drop Drop Drop

Abbreviated FFFF
address AC81 9840 86:3210:A: BBFF:0:
Fig. 5.58 Abbreviated address

Further Abbreviation
Further abbreviation are possible if there are consecutive sections consisting of only zeros. We
5.59.
can remove the zeros completely and replace them with double semicolon as shown in figure
Abbreviated address AC81:0:0:0:0 BBFF :0:FFFF
Replace by double semicolons

Further abbreviated AC81: BBFF : 0: FFFF

Fig. 5.59 Further abbreviation


It is important to note that abbreviation is allowed only once per address. Also note that it there

are two runs of zero sections, then only one of them can be abbreviated.

5.23.3. CIDR Notation


define a
Pv6 protocol allows classless addressing and CIDR notation. Figure 5.60 shows how to
refix of 60 bits using CIDR.
FDEC:0:0:0:0:BBFF:0: FFFF/60

Fig. 5.60 CIDR address


5.23.4. Categories of Network Layer 295
IPv6 Address
defines three
different types of
addresses.
IPv6 addresses

Unicast Multicast
1. Unicast address address
Anycast
address
A
unicast address
that specific computer. defines a
single computer. A packet sent toa
unicast address is aenvereu
2. Anycast
ns a
same
s type of address which defines a group of
prefix. packet sent to an
A computers with addresses which have the
the anycast address
group which is the closest of the most must be delivered to exactly one of the member of
3. Multicast Addresses easily accessible.
A
multicast address defines a
and may or group of computers which may or may not share the same
may not be connected to the same
physical prefix
network. A packet sent to a multicast address
must be delivered to
each member of the set. There are no
multicast addresses can broadcast addresses in Pv6, because
perform the same function. The
bits. Multicast addresses all start with of
type address is determined by the leading
FF (1111 1111) and all other addresses
are unicast
Anycast addresses are assigned from the unicast address space and
they do not differ
addresses.
from unicast addresses. Anycast syntactically
addressing is a rather new concept and there is little experience
with the widespread use of
anycast addresses. Therefore, some restrictiorns apply to
addressing in IPv6 until
experience is gained. An
more anycast
Source Address of an IPv6 packet and anycast addresses analystbe
address may not be used as the
may not assigned to hosts but to routers
only.
5.23.5. IPv6 Packet Format
The IPy6 packet is shown in figure 5.61. Each packet consists of a base Important)
header which is mandatory
followed by the payload. The payload is made up of two parts.
(i) Optional extension headers and VER PRI
(i) Data from an upper layer. Flow label
The base header is 40 byte length Payload length Next header
Base Hop limit
whereas the extension header and the data header
from upper layer contain upto 65,535 bytes Source address
of information.
Destination address
5.23.5.1. Base Header
shows the base header. It Payload
Figure 5.61 Extension header
has eight fields. These fields are as follows: +
Data packet from the upper layer
1. Version (VER)
Fig. 5.61. Format of an IPv6
It is a 4 bit field which
defines the version datagram
of IP such as IPv4 or IPv6. For IPv6, the value of this field is 6.

2. Priority
Tt ic ad hit field which defines the priority of the packet which is important in connection with
the traffic congestion.
296 Computer Networks
3. Flow Label
It is a 24 bit (3 byte) field which is designed for providing special handling for a particular flow
of data.
4. Payload Length
This is a 2 byte length field which is used to define the total length of the IP datagram excluding
the base header.
5. Next Header
It is an 8 bit field which defines the header which follows the base header in the
datagram.
6. Hop Limit
This is arn 8 bit field which has the same purpose as TTL (time to live) in IPv4.
7. Source Address
It is a 16 byte (128 bit) Internet address which identifies the original source of datagram.
8. Destination Address
This is a 16 byte (128 bit) Internet address which identifies the final destination of datagram. But
this field will contain the address of the next router if source routing is being used.

5.24. EXTENSION HEADERS

The lengthof the base header is fixed at 40 bytes. But in IPv6, the base header can be followed
by upto
six extension headers. This is to give more functionality to the IP datagram. Many of the extension
headers are options in IPv4. The Pv4 header has space for some optional fields
requiring a particular
processing of packets. These optional fields are not used often, and they can deteriorate router
performance remarkably because their presence must be checked for each packet. IPv6 replaces
optional fields by extension headers. In IPv6, optional Internet-layer information is encoded in separate
headers that may be placed between the IPv6 header and the upper-layer header in a
packet (see
figure 5.62). There are a small number of such extension headers, each identified by a distinct Next
Header value. An IPv6 packet may carry zero, one or more extension headers, each identified by the
Next Header field of the preceding header. There are seven kinds of
extension header.
IPv6 Header
TCP
NH TCP

IPv6 Header Routing Header


TCP
NH Routing NH TCP

IPv6 Header Routing Header Fragment Hdr


NH Routing TCP
NH Frag. Hdr NH TCP

Fig. 5.62 Examples of headers çh


5.24.4. Performance Comparison Between IPv4 and IPv6 (Very Important)
(u.P. Tech. Sem. Exam, 2007-08)(05 marks)
S.No IPv4 IPv6
1. In IPv4, there are only 23 possible
ways In IPv6, there are 212" possible ways (about
how to represent the address (about 4 3, 4*103 possible addresses).
billion possible addresses).
2. The IPv4 address is written by dotted- IPv6 is written in hexadecimal and consists
decimal notation, e.g. 121.2.8.12. of 8 groups, containing 4 hexadecimal digits
or 8 groups of 16 bits each e.g., FABC:
AC77:7834:2222:FACB:
AB98:5432:4567.

3. The basic length of the IPv4 header The IPv6 header is a static header of 40 bytes
comprises a minimum of 20 bytes (without in length, and has only 8 fields. Option

option fields). The maximum total length information is carried by the extension
of the IPv4 header is 60 bytes (with option header, which is placed after the IPv6
fields), and it uses 13 fields to identify header.
various control settings.
4 IPv4 header has a checksum, which must IPv6 has no header checksum because
be computed by each router. checksum are, for example, abovethe TCP/
IP protocol suite, and above the Token Ring,
Ethernet, etc.
298 Computer Networks
5. IPv4 contains an 8-bit field called Service The IPv6 header contains an 8-bit field
Type. The Service Type field is composed called the Traffic Class Field. This field
of a TOS (Type of Service) field and a allows the traffic source to identify the
desired delivery priority of its packets.
procedure field.
6. The IPv4 node has only Stateful auto- The IPv6 node has both a stateful and a
stateless address autoconfiguration
configuration. mechanism.
IPv6 has been designed to satisfy the growing
7. Security in IPv4 networks is limited to
and expanded need for network security.
tunneling between two networks. addresses are 128
32 Source and destination
8. Source and destination addresses are
bits (16 bytes) in length.
bits (4 bytes) in length.
P'sec support is required.
9. Psec support is optional.
for QoS handling
for Qos Packet flow identification
10. No identification of packetflow routers is included
in the IPv6 header
handling by routers is present within the by
Label field.
IPv4 header. using the Flow
are replaced
with
ARP Request frames
Address Resolution Protocol (ARP)
uses
11. Solicitation messages.
resolve multicast Neighbour
to
broadcast ARP Request framesaddress.
a n IPv4 address to a
link layer or
manua configuration
Does not require
12. Must be configured either manually or

DHCP
through DHCP.
with
ICMP Router Discovery is replaced
is used to deter- Solicitation and Router
13. ICMP Router Discovery ICMPv6 Router
mine the IPv4 address
of the best default is required.
Advertisement messages and
gateway and is optional. moved to IPv6 extension
All optional data is
14.
Header includes options. headers.

MESSAGE PROTOCOL (ICMP)


5.25. INTERNET CONTROL
to make
designed this way
datagram delivery. It
was
connectionless from
unreliable and service that delivers a datagram
The IP provides r e s o u r c e s . IP is
a best-effort delivery e r r o r control
and
network deficiencies: 1lack of
efficient u s e of it has two
destination. However,
to its final
its original s o u r c e ICMP
mechanisms.
assistance message
lack of Protocol (ICMP) reports
Internet Control Message
The o n behalf
of IP. ICMP IP IP
sends control messages
header data
e r r o r s and
reliable protocol.
It simply
to make IP a Trailer
does not attempt feedback o n specific Frame
and provide Frame data (if any)
attempts to report e r r o r s carried as IP packets and header
are
m e c h a n i s m for host
conditions. ICMP messages
unreliable. IP also lacks a needs to Fig. 5.63
ICMP encapsulation
are
therefore sometimes
host
queries. A a network
Protocol
and management And sometimes Control Message
host is alive. The Internet
d e t e r m i n e if a
router router. to the lP
another host o r d e f i c i e n c i e s . It is a
companion
information from two to the data
needs for the above directly
manager to compensate are not passed
been designed However, its m e s s a g e s inside IP datagrams
(ICMP) has n e t w o r k layer protocol. first encapsulated indicate
ICMP itself is
a the m e s s a g e s
a r e is 1 to
Instead, IP datagram
would be expected. field in the
link layer a s value of the protocol 5.63.
lower layer. (The shown in figure
before going to the This has been
are an
ICMP message.)
that the IP data
attached to the LAN. The router then locates
the host by b r o a d c a s u l
router
Ethernet
its own address. The
the Ethernet address. The home agent answers
this question by giving
to the care-of-address ht
router then sends the packet to the home agent.
It then sends the packet
The foreign agent
of P packet addressed to the foreign agent.
encapsulating in the payload field an
home agent gives
the data link address of the mobile host. Ihe
decapsulates and delivers them to
tunnelled directly to the foreign agent. This
the care of address to the sender so future packets can be
earlier.
solution satisfies all the requirements (goals) mentioned
for the following:
EXAMPLE 5.5. Pínd the sub-network address and the host id

IP Address MASK
S. No.
255.255.128.0
(a) 120.14.22.16
(b) 140.11.36.22 255.255.255.0

(c) 141.181.14.16 255.255.224.0


(d) 200.34.22.156 255.255.255.240

Solution: Step 1: To Find the Subnet Address


Inorder to find the subnet address, we have to AND the IP address and the mask as under:
120 14 22 16

01111000.00001110. 00010110. 00010000 IPaddress


255 255 128

|11111111.11111111.10000000.00000000 MASK
ANDing
120 14 0
0 1111000.00001110.00000000.00000000 Subnet address

Fig.5.68.
Therefore, the subnet address is 120.14.0.0. Similarly, we can find the other
subnet addresses.
Step 2:Hostid
Let us examine the first byte of the subnet address. 120 14 0
It is 120 which is between 0 and 127. Hence, this is a
class A netywork. So only the first byte corresponds to
the net id and the remaining three bytes Net id Host id
correspond
to
Fig. 5.69.
the hostíd as shown in figure 5.69.
Therefore, the host id is 140.0. Similarly, we can find the other host id
303
Network Layer
Four networks are

LE S.6. The IP address of host class C network is 198.123.46.237.


E a on
allowed for this network. What will be the
subnet mask ?
Solution: The default mask for a class C network is
255.255.255.0
mask and subnet
In order to have four networks, we must have two extra 1s. Hence the default
mask are shown in figure 5.69 (a).
255. 255. 255 .0

Default 11111111 11111111 . 11111111 000000000


mask

255 255.255. 192

Subnet mask 11111111 11 000000


11111111 . 11111111

L2 extra 1s
Fig. 5.69. (a)
Thus, the required subnet mask is 255.255.255.192.

EXAMPLE 5.7. What will be the subnet address if the destination address is 200.45.34.56 and
subnet mask is 255.255.240.0.
Solution: To find the subnet address, we have to AND the IP address and the subnet mask as shown
in figure 5.70.
200.45.34.56
Destination 11001000. O0101101. 00100010. 00111000
adddress

255.255.240.0
Subnet 11111111 .11111111.11110000.00000000
mask
ANDING

200.45.32.0
Subnet
address
11001000.00101101.00100000.00000000
Fig. 5.70.
Thus, the required subnet address is
200.45.32.0.

EXAMPLE 5.8. A company is granted a site address 201.70.64.0. The company needs six subnets.
Design the subnets.
Solution: This is a class C network. Therefore, the default mask is
255.255.255.0
As we need 6 subnets, we need three extra 1s. Hence, the subnet mask is
255.255.255.200
In the binary form the subnet mask is as shown in figure 5.71

| 11111111. 11111111.1111111.111 00000

3 extra 1s
Fig.5.71.
I n order to have six subnets, wecan have 6 different combinations of the 3-extra 1s as shown in
Table 5.5.

Combination Subnet Number


000 Subnet 1
001 Subnet 2
010 Subnet 3
011 Subnet 4
100 Subnet 5
101 Subnet 6
Therefore, the various addresses of 6 subnets are as shown in table 5.6.

Table 5.6.
Subnet number Addresses
201.70.64.0 to 201.70.64.31
2 201.70.64.32 to 201.70.64.63
3 201.70.64.64 to 201.70.64.95
201.70.64.96 to 201.70.64.127
201.70.64.128 to 201.70.64.1559
6 201.70.64.160 to 201.70.64.191

EXAMPLE 5.9. Show by calculations how


many network each IP address class can have with
one example.
Solution: Number of Networks in Different IP Address
Class A Address
The format of class A address is shown in
and there bits define the host ID.
figure 5.72 (a). Here, one byte defines the network ID
1 byte H2 bytes- 2 bytes-
Net ID Host ID
10 14 bits Host ID
3 bytes
-Net ID
Fig. 5.72. (a) Class A address
Fig. 5.72. (b) Class B address
The MSB in the network field is reserved. So,
actually there are only 7 bits in the network fields.
Hence, the number of networks in Class A address will be 128.
Class B Address
The format of class B addres is shown in
figure 5.72 (b). Here 2 bytes are reserved for network
field and remaining two bytes are for the host field. Out of 16
bits in the network field the first two
bits (MSBs) are reserved. Hence, actually 14 bits are available in
the network field.
Hence, the number of networks in Class B address is 24 16, 368.
=

Class C Address
The format of class C is shown in figure 5.72 (c). Here 3 bytes are reserved for network ield and
only one byte for the host field. Out of 24 bits in the network field, 3 bits are again reserved. Hence,
actually only 21 bits are available.
3 bits
21 bits-
Host
110 Network
address
Fig. 5.72 (c) Class C
is 2,097, 152.
Hence, the number of networks in class C address
exist, show with
each IP address class
can
EXAMPLE 5.10. How many host per network in
example.
Solution: Number of Hosts in Different IP Addresses
Class A Class A address will be
number of hosts in
There are 3-bytes (24 bits) in the host field. Hence, the
214 16,7772,16.
Class B address will be
of hosts in Class B
There are 2-bytes (16 bits) in the host field. So, the number
65536 i.e. 20 per network.
Class C 2" 256
in Class C address will be
=

There is 1-byte (8 bits) in the host field. So, number of hosts


per network.
c22F15B2 to dotted
IP address whose hexadecimal representation is
EXAMPLE 5.11. Covert the (05 marks)
(u.P. Tech, Sem. Exam; 2004-05)
decimal rotation.
Solution:

Given hex number C22F 15 B2

Binary 1100 0010 0010 1111 0001 0101 1011 0010

Decimal 194 79
21 22
Fig. 5.73.
dotted decimal notation will be as under
Therefore, the lP address in the Ans.
194.79.21.226

What will be
network on Internet has a subnet mask of 255.255.240.0.
EXAMPLE 5.12. A Class B (u.P. Tech, Sem. Exa; 2004-05) (05 marks)
the maximum number
of hosts per subnet ?
Class B address is as shown in figure 5.74 (a).
Solution: The structure of
255 255 240

-16 bits
|11111111 11111111 1111 0000 0000 0000|
14 bits
Net ID Host ID 4 bits for 12 bits for
10 subnet host ID

Fig. 5.74 (b) Subnet mask


Fig. 5.74 (a) Class B
address

The given mask is 255.255.2400. Hence, it is as shown in figure 5.74 (b).


will be 16 subnets and eachh
Thusthere are 4 extra 1s as shown in figure 5.74 (6). Hence, there
subnet can have 212 =
4096 hosts.

You might also like