3rd - Unit - CN (1) - Master - Copy - 240412 - 140654

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

KCS603: Computer Networks

Unit-03
Network Layer
Syllabus: Point to point networks, logical addressing,
basic internetworking (IP, CIDR, ARP, RARP, DHCP,
ICMP), Routing, forwarding and delivery, static and
dynamic routing, routing algorithms and protocols,
congestion control algorithm, ipv6.

Functions of L3 (Network layer)


1. host-to-host connectivity
2. Logical addressing
3. Switching
4. Routing
5. Fragmentation
6. Congestion control
Note— In TCP/IP network, we have congestion control at
transport layer unlike ATM network (which has congestion
control at L3); therefore, it will be discussed in the fourth unit.

Point to point networks

Point-to-point networks are a type of computer network in which two or more


devices are connected directly to each other through a dedicated
communication link. This means that there is a direct connection between the
source and the destination devices, without any intermediate devices or nodes.

In a point-to-point network, data can be transmitted bidirectionally between the


two connected devices. This type of network is commonly used in
telecommunications and computer networking, particularly in situations where
a high-speed, reliable connection is required between two endpoints.

Examples of point-to-point networks include leased lines, which are dedicated


communication links between two points, and wireless point-to-point networks,
which use directional antennas to establish a direct wireless connection
between two devices.

Point-to-point networks can be contrasted with other types of computer


networks, such as local area networks (LANs) and wide area networks (WANs),
which typically involve multiple devices connected through intermediate nodes,
such as switches and routers.
Logical addressing
Communication at the network layer is host-to-host. A host ( computer)
somewhere in the world needs to communicate with another host
somewhere else in the world. The packet transmitted by the sending host
may pass through several LANs or WANs before reaching the destination
host. For this level of communication, we need a global addressing
mechanism i.e. logical addressing. The term IP address is used to mean a
logical address in the network layer of the TCP/IP protocol suite.

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

 IPv4 addresses are unique. They are unique in the sense that each address
defines one, and only one, connection to the Internet. Two devices on the
Internet can never have the same address at the same time. But by using
some strategies, an address may be assigned to a device for a time period
and then taken away and assigned to another device.

 On the other hand, if a device operating at the network layer has m


connections to the Internet, it needs to have m addresses. A router is such
a device which needs as many IP addresses as the number of ports
(interfaces) are there in it.

Address Space
A protocol such as IPv4 that defines addresses has an address space.

 An address space is the total number of addresses used by the protocol. If


a protocol uses N bits to define an address, the address space is 2N because
each bit can have two different values (0 or 1) and N bits can have 2N values.

 IPv4 uses 32-bit addresses, which means that the address space is 232 or
4,294,967,296 (more than 4 billion).
IPv4 Address Notations

There are two notations to show an IPv4 address:

a. Binary notation and


b. Dotted decimal notation.

a. Binary Notation
In binary notation, the IPv4 address is displayed as 32 bits. Each octet is
often referred to as a byte. So, it is common to hear an IPv4 address
referred to as a 32-bit address or a 4-byte address. The following is an
example of an IPv4 address in binary notation:

01110101 10010101 00011101 00000010

b. Dotted-Decimal Notation
To make the IPv4 address more compact and easier to read, Internet
addresses are usually written in decimal form with a decimal point (dot)
separating the bytes. The following is the dotted decimal notation of the
above address:

117.149.29.2
Example 1

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


notation.

a. 10000001 00001011 00001011 11101111


b. 11000001 10000011 00011011 11111111
Solution

We replace each group of 8 bits with its equivalent decimal number and add
dots for separation.
a. 129.11.11.239
b. 193.131.27.255

Example 2

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

a. 111.56.45.78
b. 221.34.7.82

Solution

We replace each decimal number with its binary equivalent.


a. 01101111 00111000 00101101 01001110
b. 11011101 00100010 00000111 01010010

Types of IPv4 Addressing Schemes


There are two types of IPv4 addressing schemes:

 Classful Addressing

 Classless Addressing

Classful Addressing
IPv4 addressing, at its inception, used the concept of classes. This architecture
is called classful addressing. A few important points about classful addressing
are given below:

 In classful addressing, the address space is divided into five classes: A, B, C, D,


and E.

 Each class occupies some part of the address space.


 We can find the class of an address when given the address in binary notation
or dotted-decimal notation.

 If the address is given in binary notation, the first few bits can immediately tell
us the class of the address.

 If the address is given in decimal-dotted notation, the first byte defines the
class.

Both methods are shown below:

Example 3

Find the class of the following IP addresses:


1. 00000001 00001011 00001011 11101111
2. 11000001 10000011 00011011 11111111
3. 14.23.120.8
4. 252.5.15.111
5. 238.34.2.1
6. 114.34.2.8
7. 208.34.54.12
8. 11110111 11110011 10000111 11011101
9. 10101111 11000000 11110000 00011101

Solution

a. The first bit is 0. This is a class A address.


b. The first 2 bits are 1; the third bit is 0. This is a class C address.
c. The first byte is 14 (between 0 and 127); the class is A.
d. The first byte is 252 (between 240 and 255); the class is E.
e. The first byte is 238 (between 224 and 239); the class is D
f. The first byte is 114 (between 192 and 223); the class is C
g. The first octet is 208 (between 192 and 223); the class is C.
h. The first 4 bits are 1111 ; the class is E.
i. The first bit is 1; the second bit is 0. This is class B.

Classes and Blocks


One problem with classful addressing is that each class is divided into a fixed
number of blocks (networks) with each block having a fixed size (addresses) as
shown below in the fig 1.1.

Fig 1.1 Shows number of blocks and block size for each class

 Class A addresses were designed for large organizations with a large number
of attached hosts or routers. 

 Class B addresses were designed for midsize organizations with tens of


thousands of attached hosts or routers.

 Class C addresses were designed for small organizations with a small number
of attached hosts or routers.
Limitations of Classful Addressing
Ablock in class A address is too large for almost any organization. This means
most of the addresses in class A were wasted and were not used. 

 A block in class B is also very large, probably too large for many of the
organizations that received a class B block.

 A block in class C is probably too small for many organizations.

 Class D addresses were designed for multicasting. Each address in this class is
used to define one group of hosts on the Internet. The Internet authorities
wrongly predicted a need for 268,435,456 groups. This never happened and
many addresses were wasted here too.

 And lastly, the class E addresses were reserved for future use; only a few were
used, resulting in another waste of addresses.

Netid and Hostid


 In classful addressing, an IP address in class A, B, or C is divided into netid and
hosted.

 These parts are of varying lengths, depending on the class of the address.
Below figure shows some netid and hostid bytes.

 The netid is in color, the hostid is in white. Note that the concept does not
apply to classes D and E.

 In class A, one byte defines the netid and three bytes define the hostid.

 In class B, two bytes define the netid and two bytes define the hostid.

 In class C, three bytes define the netid and one byte defines the hostid.
Mask
A mask (also called the subnet mask) is a 32-bit number made of contiguous 1s
followed by contiguous 0s. The masks for classes A, B, and C are shown in the
above table. This concept does not apply to classes D and E.

 The mask can help us to find the netid and the hostid. For example, the mask
(default subnet mask) for a class A address has eight 1s, which means the first 8
bits of any address in class A define the netid; the next 24 bits define the hostid.

 The last column of the above table shows the mask in the form /n where n
can be 8, 16, or 24 in classful addressing.

 This notation is also called slash notation or Classless Interdomain Routing


(CIDR) notation.

Address Depletion Problem


The fast growth of the Internet led to the near depletion of the available
addresses in classful addressing scheme. Yet the number of devices on the
Internet is less than the 232 address space. We have run out of class A and B
addresses, and a class C block is too small for most midsize organizations.

 One solution that has alleviated the problem is the idea of classless addressing.

 Classful addressing, which is almost obsolete, is replaced with classless


addressing.

Classless Addressing
To overcome address depletion (exhaustion) and give more organizations access
to the Internet, classless addressing was designed and implemented. In this
scheme, there are no classes, but the addresses are still granted in blocks.
Address Blocks

 In classless addressing, when an entity, small or large, needs to be connected


to the Internet, it is granted a block (range) of addresses.

 The size of the block (the number of addresses) varies based on the nature and
size of the entity. For example, a household may be given only two usable
addresses; a large organization may be given thousands of addresses. An ISP, as
the Internet service provider, may be given thousands or hundreds of thousands
based on the number of customers it may serve.

 The Internet authorities impose three restrictions on classless address


blocks:

1. The addresses in a block must be contiguous, one after another.


2. The number of addresses in a block must be a power of 2 (1, 2, 4, 8, ...).
3. The first address must be evenly divisible by the number of addresses.

Example 4

Figure shows a block of addresses, in both binary and dotted-decimal notation,


granted to a small business that needs 16 addresses. We can see that the
restrictions are applied to this block. The addresses are contiguous. The number
of addresses is a power of 2 (16 = 2^4 and the first address is divisible by 16. The
first address, when converted to a decimal number, is 3,440,387,360, which
when divided by 16 results in 215,024,210.
Mask
A better way to define a block of addresses is to select any address in the block
and the mask. As discussed before, a mask is a 32-bit number in which the n
leftmost bits are 1s and the 32 - n rightmost bits are 0s.

 However, in classless addressing the mask for a block can take any value from
0 to 32. It is very convenient to give just the value of n preceded by a slash (CIDR
notation).

 In 1Pv4 addressing, a block of addresses can be defined as x.y.z.t/n in which


x.y.z.t defines one of the addresses and the /n defines the mask.

 The address and the /n notation completely define the whole block (the first
address, the last address, and the number of addresses).

First Address: The first address in the block can be found by setting the 32 - n
rightmost bits in the binary notation of the address to 0s.

Last Address: The last address in the block can be found by setting the 32 - n
rightmost bits in the binary notation of the address to 1s.

Number of Addresses: The number of addresses in the block is the difference


between the last and first address. It can easily be found using the formula 232-n

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

Solution: As we have 28 mask bits (232-28), we have 16 addresses for hosts.

The binary representation of the given address is 11001101 00010000 00100101 00100111.

First Address: The first address in the block can be found by setting the 32 - n
rightmost bits in the binary notation of the address to 0s.
11001101.00010000.00100101. 00100000

205.16.37.32 [ first IP in the block]

Last Address: The last address in the block can be found by setting the 32 - n
rightmost bits in the binary notation of the address to 1s.
11001101.00010000.00100101. 00101111

205.16.37.47 [ last IP in the block]

Question. Explain IPv4 classful scheme in detail, including default


subnet mask for each class.

IPv4 classful addressing scheme is a system of dividing IP addresses


into five different classes, based on the size of the network they are
assigned to. Each class is defined by the first bits of the IP address,
which is also called the address class. The five classes are Class A, Class
B, Class C, Class D, and Class E.

Class A addresses:

The first bit of a Class A address is always 0, and the next 7 bits
represent the network ID. The remaining 24 bits are used for the host
ID. This means that Class A addresses can support up to 126 different
networks and 16,777,214 hosts per network. The default subnet mask
for Class A networks is 255.0.0.0.

Class B addresses:

The first two bits of a Class B address are always 10, and the next 14
bits represent the network ID. The remaining 16 bits are used for the
host ID. This means that Class B addresses can support up to 16,384
different networks and 65,534 hosts per network. The default subnet
mask for Class B networks is 255.255.0.0.
Class C addresses:

The first three bits of a Class C address are always 110, and the next
21 bits represent the network ID. The remaining 8 bits are used for the
host ID. This means that Class C addresses can support up to 2,097,152
different networks and 254 hosts per network. The default subnet
mask for Class C networks is 255.255.255.0.

Class D addresses:

Class D addresses are used for multicast addresses, which means they
are used to send a message to multiple devices on a network. The first
four bits of a Class D address are always 1110.

Class E addresses:

Class E addresses are reserved for future use and are not currently
used for public networks. The first four bits of a Class E address are
always 1111.

Network Addresses
A very important concept in IP addressing is the network address. When an
organization is given a block of addresses, the organization is free to allocate the
addresses to the devices that need to be connected to the Internet.

 The first address in the class, however, is normally (not always) treated as a
special address. The first address is called the network address and defines the
organization network.
 It defines the organization itself to the rest of the world. Usually the first
address is the one that is used by routers to direct the message sent to the
organization from the outside.

Internetworking
Introduction
Computer networks refer to interconnected computing devices that
can exchange data with each other. The practice of creating,
maintaining, securing, and troubleshooting the network is called
computer networking. The compound word internetworking is made
of two different words, inter and networking, which implies
networking between two or more different networks. We need
routers or gateways to connect two different networks. The IPv4 is the
delivery mechanism used by the TCP/IP protocols. It is an unreliable
(no acknowledgement after delivering the packet.) and
connectionless (because IPv4 uses datagram approach of packet-
switching network, which does not reserve resources at routers)
datagram protocol. If reliability is important, IPv4 must be paired with
a reliable protocol such as TCP. Packets in the IPv4 layer (L3 of OSI
model) are called datagram, which contains information essential to
routing and delivery.
IPv4 Datagram Header Format

From top

1. First row: 4+4+8+16 bits = 32 bits (4 bytes)


2. Second row : 16 +3+13 = 32 bits (4 bytes)
3. Third row: 8+8+16 = 32 bits(4 bytes)
4. Fourth row: 32 bits (4 bytes)
5. Fifth row: 32 bits (4 bytes)
6. Sixth row: 0 to 40 bytes

It means that minimum size of the IPv4 Datagram header is 20 bytes,


and maximum is 60 bytes. Every packet at network layer must contain
at least 20 bytes of header.
A brief description of each field (original IPv4 header specification-
RFC: 791) is given below:

First row:

1. VER (4 bits)
It defines the version of IP. Currently the version is 4 (IPv4).
4 in binary = 0100 [ The first 4 bits of all IPv4 packet must contain
0100.]
2. HLEN(4 bits)
It defines the total length of header. Using 4 bits, we can manage
any size of the header ranging from 20 to 60 bytes.

Note— The minimum size of the IPv4 header is 20 bytes, so HLEN


filed, which is just 4 bits, is scaled up to accommodate all sizes of
header ranging from 20 bytes to 60 bytes in HLEL field.

Scaling factor = 60/15 = 4 [ max size of the header =60 bytes /


max size by 4 bits of HLEN (1111) is 15]

In case, receiver receives a packet with HLEN field = 5, it will


multiply it with 4 to get 20 bytes of the header size.

Example 6

An IPv4 packet has arrived with the first 8 bits as shown:


01000010
The receiver discards the packet, why?
Solution
There is an error in this packet. The 4 leftmost bits (0100) show
the version (IPv4), which is correct. The next 4 bits (HLEN-0010)
show an invalid header length (2*4 = 8). Minimum number of
bytes in the header must be 20.

3. Service type (8 bits) [ The name of this field has been renamed
by IETF. Now, it’s called Differentiated Services Code Point
(DSCP) and has different interpretation.]

The first 3 bits are called precedence bits used to define priority
of the datagram in issues such as congestion. This field has never
been used.

Precedence (8 different precedence)

111 - Network Control

110 - Internetwork Control

101 - CRITIC/ECP

100 - Flash Override

011 - Flash

010 - Immediate
001 - Priority

000 - Routine
The next 3 bits are type of service (TOS):

Bit 3: 0 = Normal Delaly, 1 = Low Delay

Bits 4: 0 = Normal Throughput, 1 = High Throughput

Bits 5: 0 = Normal Reliability, 1 = High Reliability

Bit 6-7: Reserved for Future Use.

Note— The renaming of the IPv4 type of service field (8 bits) to


the Differentiated Services Code Point (DSCP) is described in
RFC 2474, titled "Definition of the Differentiated Services Field
(DS Field) in the IPv4 and IPv6 Headers.

4. Total length (16 bits)


It defines the total length of the datagram (header + data) in
bytes.
It means the length of IPv4 datagram is limited to 216-1 = 65,535
bytes [ since 1111111111111111 = 216-1].

Example 7
In an IPv4 packet, the value of HLEN is 5, and the value of the
total length field is 0x0028. How many bytes of data are being
carried by this packet?

Solution
The HLEN value is 5, which means the total number of bytes in
the header is 5 x 4 = 20 bytes. The total length is 40 bytes (
decima equivalent of 0x0028) , which means the packet is
carrying 20 bytes of data (40-20).
Second row [This row is used for fragmentation only.]:

1. Identification (16 bits): An identifying value assigned by the


sender to aid in assembling the fragments of a datagram at
the receiver end.
2. Flags (3 bits):
Flags: 3 bits

Bit 0: reserved, must be zero


Bit 1: (DF) 0 = May Fragment, 1 = Don't Fragment.

Bit 2: (MF) 0 = Last Fragment, 1 = More Fragments.

3. Fragmentation offset (13 bits): This field indicates where in


the datagram this fragment belongs.

Third row:

1. TTL ( 8 bits)
This field is used to control the maximum number of hops(routers)
visited by the datagram. Each router that processes the datagram,
decrements this number by 1. It means TTL field limits the lifetime
of a datagram.
2. Protocols (8 bits)
Used to define the higher-level protocols such as TCP,UDP, ICMP,
and IGMP.
3. Header checksum (16 bits)
Used to detect error.

Example 8
An IPv4 packet has arrived with the first few hexadecimal digits as
shown:
0x45000028000100000102…

How many hops can this packet travel before being dropped?

Solution:
0x = hexadecimal
To find the TTL filed, we skip 8 bytes ( 4 bytes of the first row + 4
bytes of the second row) because it is the first field in the third
row of the IP datagram. The TTL is the ninth byte, which is 01( hex
to binary[ (01)16= (00000001)2] = 1 in decimal). This means that the
packet can travel only one hope.

Note: (45)16 = (01000101)2 = (69)10

Fourth row and fifth row: Used to define source and destination IP
addresses.

Sixth row:

1. Options ( 0 to 40 bytes)
Options for diagnostic and testing purposes, such as providing a
way to measure packet delivery time or to trace the path of a
packet through the network.
Fragmentation
(Done at Routers)

Fragmentation is the process of dividing a datagram into small pieces


called fragments at the network layer when the size of the datagram
exceeds the maximum size of data that can be held in a frame at the
data link layer.

If the application layer gives more than 65,495 bytes of data to the
transport layer, it’s the responsibility of the transport layer to divide it
into segments in such a way that one segment (65,515 bytes [
20(header)+ 65, 495]) should sit in at Network layer. But the problem
is that the data link layer can’t hold more than 1500 bytes of data in
the frame if underlying LAN is standard ethernet.

Sometimes, underlying LAN at data link layer is able to hold more than
what it gets from network layer if standard ethernet is not used.
Therefore, segmentation at transport layer is done very cleverly in
such a way that one segment should sit in at data link layer frame
without being fragmented at network layer in a LAN. It means that
fragmentation is not required in a LAN.

However, if we have two different networks having two different LAN


technologies such as one is token ring and other is ethernet, then
fragmentation is required at network layer as both LANs have
different MTU (maximum transmission unit) at the data link layer.
Message Application layer

Segment Transport layer H= 20 Bytes 65,495 bytes

Datagram Network layer H= 20 Bytes 65,515 bytes

MTU = 1500 bytes


Frame Data Link layer H [ 802.3 ] T

bits Physical layer


Limited broadcast vs Directed broadcast

Limited broadcast: If a host sends a packet to all hosts in the


same network, it’s called limited broadcast. For example,

Network address = 20.0.0.0 [Each class A network has 224 host


addresses]
Host-Dell’s IP address = 20.0.0.5 [ One of the hosts in the LAN]

Limited broadcast address= 255.255.255.255

Directed broadcast: If a host sends a packet to all hosts in the other


network, it’s called directed broadcast. For example,

1st network having network address = 20.0.0.0

And 2nd network having network address = 40.0.0.0

If a host in the first network wants to send a packet to all hosts present
in the second network having network address 40.0.0.0, then directed
broadcast address is 40. 255.255.255 [ network id part will be as it is +
all 1’s].

Q. Identify the type of address in the following IPv4 addresses and


specify where they are used:

a. 255.255.255.255

b. 127.0.0.1
Solution:

a. IPv4 Address "255.255.255.255": This is a limited broadcast address,


typically used to send data packets to all devices within the same
network.

b. IPv4 Address "127.0.0.1": This is the loopback address, commonly


used to test network connectivity within the local device itself. It
refers to the local host, allowing a device to communicate with itself.

Subnetting
Dividing a big network into two or more subnetworks is called
subnetting.
subnetting benefits:

1. Improved network performance and speed


2. Reduced network congestion
3. Boost network security
4. Controlled network growth
5. Ease of administration

Subnetting in Classful Addressing


Approaches:
1. Fixed length subnet mask (FLSM)[ all subnets have the same
subnet mask, i.e. number of hosts in all subnets are the same.]
2. Variable length subnet mask (VLSM) ( all subnets do not have
the same mask.)

Example-9 (Fixed length)

Divide 200.1.2.0 network into two subnets.

Solution:
Note: Only hostid is used for subnetting.

We know that this is a class C IP address, and each class C IP address


has:

netid= 24 bits

hostid = 8 bits (256 IP addresses are possible in a class C network.)

If we borrow one bit ( 21 = 2 addresses 0 and 1) of the hostid for


subnetting, we can divide 256 addresses into two parts having 128
addresses each.

Subnet 1:
Note: Netid (24 bits) is constant.

0 0000000 = 0 [Decimal equivalent]


0000001 = 1

0000010 =2

0000011 =3

.......

.......

0 1 1 1 1 1 1 1 =127

Firs IP = 200.1.2.0 [ used as a network ID for the subnet-1]

Last IP = 200.1.2.127 [ used as a directed broadcast address]

Number of hosts = 126 ( 128-2)

Subnet 2:

1 0000000 = 128 [Decimal equivalent]


0000001 = 129

0000010 =130

0000011 =131

.......

.......

1 1 1 1 1 1 1 1 =255

First IP = 200. 1. 2. 128


Last IP = 200.1.2. 255

Number of hosts = 126 (128-2)

Example-10 (variable length)

Divide 200.1.2.0 network into 3 subnets having 128, 64 and 64 IP


addresses.

Solution

As all subnets do not have the same number of addresses (128,64,


and 64), it is a variable length subnetting.

Steps:

1. Borrow one bit from hostid to divide 256 addresses into two
parts.
2. Now divide the second part into two again using single bit

0 0000000 = 0 [Decimal equivalent]

0000001 = 1

0000010 =2

0000011 =3

.......

.......

0 1 1 1 1 1 1 1 =127
Firs IP = 200.1.2.0 [ used as a network ID for the subnet-1]

Last IP = 200.1.2.127 [ used as a directed broadcast address]

Number of hosts = 126 ( 128-2)

Second subnet having 64 IPs:


10000000 = 128 [Decimal equivalent]

0000001 = 129

0000010 =130

0000011 =131

.......

.......

10 1 1 1 1 1 1 =191

First IP = 200.1.2.128 ( network address for subnet-2)

Last IP = 200.1.2.191 (Directed broadcast address)

Number of hosts = 62 ( 64-2)

Third subnet having 64 IPs:


11000000 = 192 [Decimal equivalent]

0000001 = 193

0000010 =194

0000011 =195

.......

.......

11 1 1 1 1 1 1 =255

First IP = 200.1.2.192 ( network address for subnet-2)

Last IP = 200.1.2.255 (Directed broadcast address)

Number of hosts = 62 ( 64-2)

Subnetting in classless addressing


a. b. c. d / n

n = mask (netid)

hostid = 32 – n

Number of addresses = 232-n

Example -11( FLSM-fixed length subnet mask)

The CIDR block is 20.30.40.10 /25, divide it into two subnets.

Solution:
We can use 7 bits (32-25) for subnetting. It means, we cannot change
even first bit from the last octet as that’s a part of network bits (25
bits, including first bit of the last octet).

As we have 7 bits in the hostid part, we can have 128 (27 ) addresses.
We need to divide it into two subnets having 64 addresses each.

Subnet -1

00 000000 = 0 [Decimal equivalent]

000001 = 1

000010 = 2

000011 = 3

......

......

00 1 1 1 1 1 1 =63

Firs IP = 20.30.40. 0 [ used as a network ID for the subnet-1]

Last IP = 20.30.40.63 [ used as a directed broadcast address]

Number of hosts = 62 ( 128-2)


Subnet -2

01 000000 = 64 [Decimal equivalent]

000001 = 65

000010 = 66

000011 = 67

......

......

01 1 1 1 1 1 1 =127

Firs IP = 20.30.40. 64 [ used as a network ID for the subnet-1]

Last IP = 20.30.40.127 [ used as a directed broadcast address]

Number of hosts = 62 (128-2)

Example-12 ( VLSM)

A company has been allocated the CIDR block 20.30.40.10/25. The


company wants to create three subnets with the following number
of hosts: 62, 30, and 30. What are the first and last addresses in each
of the three subnets?

Solution
Subnet-1

00 000000 = 0 [Decimal equivalent]

000001 = 1

000010 = 2

000011 = 3

......

......

00 1 1 1 1 1 1 =63

Firs IP = 20.30.40. 0 [ used as a block/ network ID for the subnet-1]

Last IP = 20.30.40.63 [ used as a directed broadcast address]

Number of hosts = 62 (64-2)

Subnet-02

010 00000 = 64 [Decimal equivalent]

00001 = 65

00010 = 66

00011 = 67

.....

.....

010 1 1 1 1 1 = 95

Firs IP = 20.30.40. 64 [ used as a network ID for the subnet-1]


Last IP = 20.30.40.95 [ used as a directed broadcast address]

Number of hosts = 30 (32-2)

Subnet-03

011 00000 = 96 [Decimal equivalent]

00001 = 97

00010 = 98

00011 = 99

.....

.....

011 1 1 1 1 1 = 127

Firs IP = 20.30.40. 96 [ used as a network ID for the subnet-1]

Last IP = 20.30.40.127 [ used as a directed broadcast address]

Number of hosts = 30 (32-2)

Example 13:

An ISP is granted a block of addresses starting with 90.100.0.0/16

(65,536 addresses). The ISP needs to distribute these groups of


customers as follows:

1. The first group has 64 customers; each of them needs 256


addresses.
2. The second group has 128 customers; each of them needs 128
addresses.
3. The third group has 128 customers; each of them needs 64
addresses.

Design the subblock and give the slash notation for each
subblock.

Find out how many addresses are still available after these
allocations.

Solution:
The ISP has the first address 190. 100.0.0/16

Since, n= 16

Mask = 16 = prefix length= netid

Since, hostid= 32-n

Hostid= 32-16
Number of addresses = 232-16 = 65,536
[ In detail …]
First group
For this group, each customer needs 256 addresses. This means
that 8 bits are hostid (28 =256 addresses) and 24 bits are netid.
[The prefix length (netid)= 32 – 8 = 24]

Slash notation ( or CIDR notation) for this group is /24. [ 16+ 8 bits
from hostid part]

The addresses are:

1st customer : 190. 100.0.0/24 to 190.100.0.255 /24 =256


add.
2nd customer : 190.100.1.0/24 to 190.100.1.255/24 = 256
add.

…………..

64th customer : 190.100.63.0/24 to 190.100.63.255/24 =256


add.

Total addresses for the first group: 64* 256 = 16,384


Second group
For this group, each customer needs 128 addresses. This means
that 7 bits are hostid(27 =128).

The prefix length(netid/mask) = 25 (32-7)

Slash notation for this group is /25 [ 32- 7]

The addresses are:

1st customer: 190.100.64.0/25 to 190.100.64.127/25


2nd customer: 190.100.64.128/25 to 190.100.64. 255/25

..………

128th customer: 190.100.127.128/25 to 190.100.127. 255/25

Total addresses for the second group= 128*128= 16,384

Third group
For this group, each customer needs 64 addresses. This means
that 6 bits are hostid(26 =64).
The prefix length(netid/mask) = 26 (32-6)

Slash notation for this group is /26 [32-6]

The addresses are:

1st customer: 190.100.128.0/26 to 190.100.128.63/26


2nd customer:190.100.128.64/26 to 190.100.128. 127/26

……

128th customer: 190.100.159.192/26 to 190.100.159.255/26


Total addresses for the third group= 128*64= 8192

Number of granted addresses to the ISP: 65,536


Number of allocated addresses by the ISP: 40,960 [
16,384+16,384+8192]
Number of available addresses: 24,576 [65,536-40,960]

Example 14

Given a class B network having a subnet mask of 255.255.248.0.


What is the maximum number of hosts per subnet?
Solution

Note— Subnet mask ( 32 bits; all 1s followed by all 0s) = “1s” at the
place of Netid + subnetid and 0s at the place of hostid.

For a class B network, the default subnet mask is 255.255.0.0


(11111111.11111111.00000000.00000000). However, in this case,
the subnet mask provided is 255.255.248.0
(11111111.11111111.11111000.00000000).

To determine the number of hosts per subnet, we need to first


determine the number of bits used for the host portion of the
address. The subnet mask 255.255.248.0 has 21 bits for the network
portion of the address (the first 21 bits) and 11 bits for the host
portion of the address (the last 11 bits).

Since we have 11 bits for the host portion of the address, we can
calculate the number of hosts per subnet as follows:

2^11 - 2 = 2046

The "- 2" is because the first and last addresses in the subnet are
reserved for the network address and the directed broadcast
address respectively.

Therefore, the maximum number of hosts per subnet for this class B
network with a subnet mask of 255.255.248.0 is 2046.

Example 15. Given the IP address 180.25.21.172 and the subnet


mask 255.255.192.0, What is the subnet address?
Solution

To find the subnet address, we need to perform a bitwise "AND"


operation between the IP address and the subnet mask after
converting them into binary.

Here are the IP address and subnet mask converted to binary:

IP address: 10110100.00011001.00010101.10101100

Subnet mask: 11111111.11111111.11000000.00000000

Performing the bitwise "AND" operation between the two gives us:

10110100.00011001.00000000.00000000

Converting this back to decimal gives us the subnet address:

180.25.0.0

Therefore, the subnet address for the given IP address and subnet
mask is 180.25.0.0.
Example 16. An organization is granted the block 16.0.0.0/8. The
administrator wants to create 500 fixed-length subnets.
i. Find the subnet mask.
ii. Find the number of addresses in each subnet.
iii. Find the first and last addresses in subnet 1.
iv. Find the first and last addresses in subnet 500.

Solution
netid ( or blockid) = 8 bits

hostid = 24 bits ( Only hostid part is used for subnetting.)

To create 500 fixed-length subnets, we need to borrow 9 bits ( 2^9 =


512) from the hostid part of the block address given in the question.
The 9 bits borrowed from the Hostid part is called subnetid part.

i. Find the subnet mask.

Subnet mask = netid (put all 1s here) + subnetid ( put all 1s here)
+ hostid ( put all 0s here)

Subnet mask = 11111111. 11111111. 10000000. 00000000


In decimal 255.255.128.0
ii. Find the number of addresses in each subnet.

After borrowing 9 bits from the hostid part as subnetid, we are


left with only 15 bits in the hostid part; it means each subnet will
have 2^15 addresses (32,768).

iii. Find the first and last addresses in subnet 1.

For the first subnet, we put 9 zeros at the subnetid part.

00010000. 00000000. 0 - - - - - - -. - - - - - - - -
0000000. 00000000 [ starting from 0s ]
.
.
.
0 1111111. 11111111

First address = 16.0.0.0/17 [ also called block address/ subnet add.]

Last address = 16.0.127.255 [ also called directed broadcast add.

iv. Find the first and last addresses in subnet 500.

As we have used all zeros at the place of subnetid part for the first
subnet, then for the second subnet it would be as follows:
0 0 0 0 0 0 0 0. 1

.
.
.

For the 499 subnet 11111001.1 [ its decimal equivalent is 499]

00010000. 11111001.1 - - - - - - -. - - - - - - - -

0000000. 00000000

……

1111111. 11111111

First address = 16. 249. 128. 0 /17

Last address = 16. 249. 255.255

Q. You are given a subnet mask 255.255.0.0, find the following:

i. Number of hosts.
ii. Number of subnets in class A.
iii. Number of subnets in class B.
iv. Number of subnets in class C.

SOLUTION— We need to covert the given subnet mask into binary


to solve it.
11111111 11111111 00000000 00000000

Netid Hostid
i. We know that all 1’s (contiguous) represents subnet mask,
and all 0’s (contiguous) represents host part.
Therefore, the number of hosts is 216 – 2.
ii. We know that the default subnet mask for the class A is
255.0.0.0, but in the given question 8 bits from the hostid
part is used for the subnetting. Therefore, the number of
subnets in the class A is 28.
iii. We know that the default subnet mask for the class B is
255.255.0.0, and the same is given in the question.
Therefore, only one subnet is possible which is by default.
iv. We know that the default subnet mask for the class C is
255.255.255.0, and given mask is 255.255.0.0. Therefore,
no subnet is possible.
Q. Mention valid IP addresses required in the below network.
Supernetting
Supernetting is a technique to combine several contiguous subnets
into one network. Supernetting reduces the number of entries in
routing tables, thereby improving routing efficiency and reducing the
size of routing tables in routers.

Rules for supernetting:

1. All networks must be contiguous.


2. The size of all networks should be the same and a power of 2.
3. The first network ID should be divisible by the total size of all
networks combined.

Q. You have been provided with four subnets:

Subnet 1: 223.1.0.0/24

Subnet 2: 223.1.1.0/24

Subnet 3: 223.1.2.0/24

Subnet 4: 223.1.3.0/24

Using supernetting, how would you efficiently aggregate these four


subnets into one?
Q. Consider an enterprise network with two Ethernet segments (LAN
segments), a web server and a firewall, connected via three routers as shown
below.

What is the number of subnets inside the enterprise network?


Q. An ISP has the following chunk of CIDR-based IP addresses
available: 245.248.128.0/20. The ISP intends to allocate half of this
address range to MIET and a quarter to MIT, while retaining the
remaining portion for itself. What is a valid allocation of addresses
to MIET and MIT?
ARP and RARP
ARP( Address resolution protocol)
[IPMAC]

Position of ARP and RARP in TCP/IP protocol suite


ARP operation

1. To find the MAC address of another host (for example, host B in


the above diagram.) or router on its network:
i. ARP request is made from source host (System A)

2. ARP request message:


i. IP and MAC of sender (System A)
ii. IP and MAC (all 0’s since MAC is not known yet) of
receiver(System B)

3. Then ARP request message is broadcast:


i. For example, in Ethernet LAN, MAC’s header destination
address is all 1’s (broadcast address).
ii. Received by every station on the physical network.

4. The intended recipient sends back an ARP reply message:


i. ARP reply is unicast
There are 4 cases to use ARP:

Case 1. Host-A ( wants the MAC of another host ) – host B

Case 2. Host- A ( wants the MAC of router ).

Case 3. One router wants MAC of another router.

Case 4. One router wants MAC of a host.

RARP (Reverse ARP) [ MACIP]

A diskless machine is usually booted from ROM. It can’t include IP


address. IP addresses are assigned by the network administrator. A
host obtains its IP by the physical address using the RARP. The RARP
request packets are broadcast; and the RARP reply is unicast.
BOOTP (Bootstrap Protocol) VS DHCP (Dynamic Host
Configuration Protocol)
Both are application layer protocols used for assigning IP addresses to
devices on a network. While they serve similar purposes, they have
differences in functionality and features:

BOOTP (Bootstrap Protocol):

BOOTP is an older protocol primarily used for booting diskless


workstations or network devices. It provides a means for a client
machine to discover its own IP address, subnet mask, default gateway,
and other network configuration parameters during the boot process.

It relies on statically configured mappings between MAC addresses


and IP addresses, typically managed by a BOOTP server. It does not
support automatic IP address allocation or configuration updates after
the initial boot.

DHCP (Dynamic Host Configuration Protocol):

DHCP is an evolution of BOOTP and is widely used in modern networks


for dynamic IP address allocation and configuration. It offers dynamic
IP address assignment, where IP addresses are leased to clients for a
specific period. After the lease expires, the IP address can be
reassigned to another client. It allows for automatic configuration of
various network parameters such as IP addresses, subnet masks,
default gateways, DNS servers, and other settings. It supports a more
flexible and scalable approach to IP address management compared
to BOOTP. It can dynamically allocate IP addresses from a pool,
reducing the need for manual configuration.
ICMP (Internet control message protocol)
It is a network layer protocol used to serve mainly two purposes:

1. Error handling / feedback messaging


2. Request and reply

1. Error handling— ICMP is instrumental in conveying error and control


messages between network devices. For instance, when a router or
receiver encounters a problem while handling an IP packet (mostly due
to congestion), it sends an ICMP message back to the source IP address
to report the issue. ICMP includes several error messages that are sent
by network devices to communicate issues encountered during packet
processing.

Common ICMP error messages sent to the source include:


a. Destination unreachable
b. Time exceeded
c. Parameter problem
d. Redirect message
e. Source quench

a. Destination unreachable— It Indicates that the destination host or


network is unreachable.
b. Time exceeded— It indicates that the time-to-live (TTL) value of a packet
has expired, typically used in traceroute applications.
c. Parameter problem— It indicates that there is a problem with the IP
header or the data portion of a packet, such as an incorrect header
checksum or an unrecognized option.
d. Redirect message— It indicates that a better route to the destination is
available through a different router.
e. Source quench – When a router or network device receives data packets
at a rate it cannot handle, it may send a Source Quench message to the
sender, requesting it to reduce the rate of packet transmission.
2. Request and Reply – It facilitates communication between network
devices by allowing them to send requests and receive replies. This
functionality is widely used for diagnostic purposes such as checking
network connectivity and measuring round-trip times (RTT). The
"Ping" command, for example, utilizes ICMP Echo Request and Echo
Reply messages to test reachability and measure latency. There are
several types of request and reply messages used for communication
and network diagnostics.

Four commonly used ones:


a. Echo Request and Echo Reply – Used for testing the reachability of
a remote host and measuring round-trip time (RTT).
b. Timestamp Request and Timestamp Reply— Used to synchronize
the clocks between network devices by requesting and exchanging
timestamps.
c. Address Mask Request and Address Mask Reply— Used for
discovering the subnet mask of a remote host, typically in older IPv4
implementations.
d. Information Request and Information Reply— Used for retrieving
information about a remote host, such as its identity or operating
system.
Note— Every ICMP message is encapsulated within an IP packet. The ICMP
message serves as the payload of the IP packet, containing the necessary
information to convey specific message types or details.

IGMP (Internet Group Management Protocol)

It is the 3rd layer protocol used by IPv4 devices within a local network to manage
membership in multicast groups. The primary purpose of IGMP is to allow hosts
to communicate their interest in receiving multicast traffic to nearby routers,
which can then forward multicast packets only to those segments of the
network where interested receivers reside.

It plays a crucial role in facilitating efficient multicast communication within IPv4


networks by enabling hosts to join and leave multicast groups dynamically and
ensuring that multicast traffic is delivered only to interested recipients.

Question—Classful addressing, which is obsolete, is replaced with


classless addressing. Justify it.

Classful addressing was a system of IP address allocation that divided


IP addresses into five classes (A, B, C, D, and E) based on the size of
the network they were assigned to. This system was designed when
the internet was in its early stages, and the number of computers
connected to it was relatively small. However, as the internet grew, it
became apparent that the classful addressing system had some
significant limitations and was not capable of meeting the needs of
the modern internet.

One of the main limitations of classful addressing is that it did not


allow for efficient use of IP address space. Under this system, IP
addresses were allocated based on the size of the network, and the
entire block of addresses was assigned to a single organization, even
if they didn't need all of the addresses. This led to significant wastage
of IP addresses, which became a problem as the demand for IP
addresses grew.

Classless addressing, on the other hand, is a more flexible system that


allows IP addresses to be allocated in smaller blocks. This makes it
possible to allocate IP addresses more efficiently, reducing wastage
and making it possible to accommodate more devices on the network.
With classless addressing, the size of the network is determined by the
number of bits used to identify the network portion of the address,
rather than being determined by the class of the address.

Question—What is the purpose of using private IP addresses? With


a diagram, explain the process of translating a private IP address to
a public IP address using NAT?

The purpose of using private IP addresses is to conserve the limited


supply of public IP addresses. Private IP addresses are used for internal
communication within a local network such as a home, school, or
office, while public IP addresses are used to communicate with
devices on the internet. Private IP addresses are not routable over the
internet and cannot be accessed directly from outside the local
network.

Private IP addresses are defined in RFC 1918 and include the following
address ranges:

10.0.0.0 to 10.255.255.255 /8

172.16.0.0 to 172.31.255.255 /12

192.168.0.0 to 192.168.255.255 /16

To communicate with devices on the internet, a private IP address


must be translated to a public IP address using Network Address
Translation (NAT). NAT is a technique used by routers to map a private
IP address to a public IP address and vice versa.

NAT (Network address translation)

NAT stands for network address translation. It’s a way to map multiple
local private addresses to a public IP address before transferring the
information. Organizations that want multiple devices to employ a
single public IP address use NAT, as do most home routers.
Fig. shows how NAT is used to map a private IP to public one

Routing, Forwarding and Delivery

Delivery: It refers to the way a packet is handled by the underlying


networks under the control of the network layer.

Forwarding: It refers to the way a packet is delivered to the next


station.

Routing: It refers to the way routing tables are created to help in


forwarding.

……………………………………………………………………………………
Delivery
The delivery of a packet to its destination is accomplished by using two
different methods of delivery, direct and indirect.
Direct delivery

It occurs when the source and destination of the packet are located
on the same network.

Indirect delivery

It occurs when the source and destination of the packet are located
on the different network.

Forwarding
Forwarding means to place the packet in its route to its destination. It
requires a host or a router to have a routing table. When a host has a
packet to send or when a router receives a packet to be forwarded, it
looks at this table (routing table) to find the route to the final
destination.
Forwarding techniques

 Next-hop method vs Route method


In the next-hop method, the routing table holds only the address
of the next hop instead of information about the complete
route( route method).

Fig: Route method vs next-hop method

 Network-specific method vs host-specific method


In network-specific method, instead of having an entry for every
destination host connected to the same physical network (host-
specific method), we have only one entry that defines the
address of the destination network itself.
Fig. Host-specific vs network-specific method
 Default method
Another technique to simplify routing is called default method.
In figure3, host A is connected to a network with two routers.
Router R1 routes the packets to hosts connected to network N2.
However, for the rest of the Internet, router R2 is used. So
instead of listing all networks in the entire Internet, host A can
just have one entry called default(0.0.0.0).

Fig3. Default method


Unicast routing and unicast routing protocols
Routing is the process of creating routing tables, and if the routing table is
created to handle unicast packets, then it’s called unicast routing. In unicast
routing, a packet needs to go from a single source to a single destination.

Unicast transmission, in which a packet is sent from a single source to a specified


destination, is still the predominant form of transmission in LANs and within the
Internet.

It is the simplest form of routing because the destination is already known.


Hence, the router just has to look up the routing table and forward the packet
to next hop.

There are three major protocols for unicast routing:

1. RIP
2. OSPF
3. BGP

Routing Algorithms

Algorithms used to create the routing table are called routing


algorithms. There are mainly two types of routing algorithms:

1. Static (nonadaptive)
Static routing algorithm is a form of routing which occurs when a
router uses a manual configuration routing entry rather than dynamic
entry. Static algorithms cannot be used in the Internet having n
numbers of routers.

2. Dynamic (adaptive)
Dynamic algorithms, in contrast, change their routing decisions to
reflect changes in the topology, and usually the traffic as well. In the
Internet ( network of networks) , these algorithms are used by routing
protocols (RIP, OSPF, and BJP).

Types of dynamic routing algorithms:


1. DVR (distance vector routing)
2. LSR (link state routing)
3. PVR (path vector routing)

Note—Routing information protocol (RIP) is an implementation of DVR. Open


shortest path first (OSPF) is an implementation of LSR, and border gateway
protocol (BGP) is an implementation of PVR.

Distance vector routing [DVR]


In DVR, the least-cost route between any two nodes is the route with
minimum distance.

Three steps are needed in DVR:

1. Initialization: Each node can only know the distance between


itself and its immediate neighbors, those directly connected to
it.

2. Sharing : Every node shares its distance vector with its


immediate neighbors periodically, and when there is a change.

3. Updating : Each node updates routing table parallelly after


getting new distance vectors from its immediate neighbors.

Example to illustrate DVR algorithm

Step 1: Initialization [ each node can only know the distance


between itself and its immediate neighbors. ]
We have four routers (A,B,C and D) with a local routing table at each
router. Every routing table will contain destination, distance and next
hop.
D 11 C

1 7 3

A 2 B

Note: Use infinitive distance if we don’t have a direct edge.

Local routing table at router A

Destination Distance Next hop


A 0 ( A to A) A
B 2 B
C Infinitive (not known) ---
D 1 D

Local routing table at router B

Destination Distance Next hop


A 2 A
B 0 B
C 3 C
D 7 D
Local routing table at router C

Destination Distance Next hop


A Infinitive ---
B 3 B
C 0 C
D 11 D

Local routing table at router D

Destination Distance Next hop


A 1 A
B 7 B
C 11 C
D 0 D

Step 2: Every node (router) shares its distance vector with its
immediate neighbors parallelly.

Note: Distance vector (array) is the column named distance in the


routing table.

Router A will receive distance vectors from routers B and D.

Router B will receive distance vectors from routers A, C and D.


Router C will receive distance vectors from routers B and D.

Router D will receive distance vectors from routers A, B and C.

Step 3: Each node updates routing table parallelly after getting new
distance vectors from its immediate neighbors.

Router A will update its routing table as follows:

At router A, distance vectors are received from routers B and D are:

From B From D

2 1
0
7
3 11
7
0

A to B [ A has two options to reach B as it has two


distance vectors, but only minimum will be taken.]

A to C [ A , having two distance vectors, has two


options to reach C , but only minimum will be taken.]
A to D [ A, having two distance vectors, has two
options to reach D, but only minimum will be taken.]

New routing table of the router A


Destination Distance Next-hop
A 0 A
B 2 B
C 5 B
D 1 D

Note :  direct edge and - - -> path

At B, C , and D routers, routing tables will be updated


in the same way.
Note—It will be done three times to get the final
updated routing tables at each router as we have four
routers in the diagram.

Count-to-Infinity Problem in DVR


The Count-to-Infinity problem occurs when a router receives incorrect or
inconsistent distance information from its neighbors. If a node receives a higher
distance to a particular node than it previously had, it will increase the distance
in its table and forward that new distance to its neighbors. This process
continues, and the distance value keeps increasing until it reaches infinity, or
until the network becomes congested and stops functioning.

The Count-to-Infinity problem can occur in scenarios such as when a link


between two routers fails, and they start sending incorrect distance information
to each other. To prevent this problem, various techniques can be used in DVR,
such as the Split Horizon and Poison Reverse techniques, which limit the spread
of incorrect distance information.

IPv6 (IPng)
IPv6 addresses are 128-bit identifiers used to uniquely identify
interfaces and sets of interfaces on a network.

Three are three types of IPv6 addresses:

1. Unicast Address: An IPv6 address identifying a single interface.

2. Multicast Address: An IPv6 address identifying multiple interfaces,


typically for one-to-many communication.
3. Anycast Address: An IPv6 address identifying multiple interfaces,
but the communication is routed to the nearest interface in the
group.

Note— There are no broadcast addresses in IPv6, their function being


superseded by multicast addresses.

Need for IPv6


IPv6 (Internet Protocol version 6) was introduced in 1998 as a
successor to IPv4 (Internet Protocol version 4). It was developed to
address several limitations and challenges presented by IPv4. Some of
the key needs for IPv6 include:

 IPv4 address depletion


 Real time audio/video transmissions
 Encryption
 Authentication
 Fast processing
 Additional functionalities
Representation of IPv6 Addresses

There are three conventional forms for representing IPv6 addresses:

1. The most preferred form is x:x:x:x:x:x:x:x (Colon-Hexadecimal


Notation), where the 'x's are one to four hexadecimal digits of the
eight 16-bit pieces of the address.

Examples:

ABCD: EF01:2345:6789: ABCD: EF01:2345:6789

2001:DB8:0:0: 8:800:200C:417A

2. It is common for addresses to contain long strings of zero bits. In order


to make writing addresses containing zero bits easier, a special syntax
is available to compress the zeros. The use of "::" indicates one or
more groups of 16 bits of zeros. The "::" can only appear once in an
address. The "::" can also be used to compress leading or trailing zeros
in an address.

Note— In IPv6, only leading zeros within each segment can be


omitted, and only consecutive segments of zeros can be replaced by a
double colon (: :) once in an address.

For example, the following addresses


2001:DB8:0:0: 8:800:200C:417A a unicast address

FF01:0:0: 0:0:0: 0:101 a multicast address

0:0:0: 0:0:0: 0:1 the loopback address

0:0:0: 0:0:0: 0:0 the unspecified address

may be represented as
2001:DB8::8:800:200C:417A a unicast address

FF01::101 a multicast address

::1 the loopback address

:: the unspecified address

3. An alternative form that is sometimes more convenient when dealing


with a mixed environment of IPv4 and IPv6 nodes is x:x:x:x:x:x: d.d.d.d,
where the 'x's are the hexadecimal values of the six high-order 16-bit
pieces of the address, and the 'd's are the decimal values of the four
low-order 8-bit pieces of the address (standard IPv4 representation).

Examples:

0:0:0: 0:0:0:13.1.68.3

0:0:0: 0:0: FFFF:129.144.52.38

or in compressed form:

::13.1.68.3

::FFFF:129.144.52.38

Q. Write down the compressed forms for the following IPv6


addresses:
a. 0000: FFFF: FFFF: 0000:0000:0000: 0000:0000
b. 1234:2346:3456: 0000:0000:0000:0000: FFFF
c. 0000:0001:0000: 0000:00000: FFFF: 1200:1000
d. 0000:0000:0000:0000: FFFF: FFFF:24.123.12.6
e. FF01:0000:0000: 0000:0000:0000: 0000:0101
f. 2001:0DB8:0000:0000: 0008:0800:200C:417A
Solution

To compress IPv6 addresses, we apply the following rules:

1. Omit leading zeros within each 16-bit block.

2. Replace consecutive blocks of zeros with double colons (::) once


within an address (but only once for each IPv6 address).
a. 0: FFFF: FFFF: :
b. 1234: 2346: 3456 :: FFFF
c. 0: 1:: FFFF:1200:1000
d. ::FFFF:FFFF:24.123.12.6
e. FF01::101
f. 2001:DB8::8.800: 200C:417A

Representation of Address Prefixes

The representation of IPv6 address prefixes is similar to the way IPv4


address prefixes are written in Classless Inter-Domain Routing (CIDR)
notation [CIDR].

Note— The prefix length like IPv4 CIDR notation indicates the number
of bits in the address that are fixed and identifies the network portion
of the address.

An IPv6 address prefix is represented by the notation:

ipv6-address/prefix-length

For example, the following are legal representations of the 60-bit


prefix 20010DB80000CD3 (hexadecimal):

2001:0DB8:0000:CD30:0000:0000: 0000:0000/60

2001:0DB8:CD30: 0:0:0:0/60

2001:0DB8:0:CD30: :/60
The following are NOT legal representations of the above prefix:

2001:0DB8:0:CD3/60

Explanation: We may drop leading zeros only, but not trailing zeros,
within any 16-bit chunk of the address

2001:0DB8::CD30/60

Explanation: address to left of "/" expands to 2001:0DB8:0000:0000:


0000:0000:0000:CD30

2001:0DB8::CD3/60 Explanation: address to left of "/" expands to


2001:0DB8:0000:0000: 0000:0000:0000:0CD3

Note— Like IPv4 CIDR prefix, when writing both a node (host) address
and a prefix of that node address (e.g., the node's subnet prefix), the
two can be combined as follows:

If the node (host) address is 2001:0DB8:0:CD30:123:4567:89AB: CDEF

and its subnet number (prefix) 2001:0DB8:0:CD30: :/60

can be abbreviated as 2001:0DB8:0:CD30:123:4567:89AB: CDEF/60


Address Type Identification

The type of an IPv6 address is identified by the high-order bits of the


address, as follows:

Address type Binary prefix IPv6 notation

Unspecified 00...0 (128 bits) ::/128


Loopback 00...1 (128 bits) ::1/128
Multicast 11111111 FF00: :/8

Link-Local unicast 1111111010 FE80: :/10

Global Unicast 001 2000: :/3

Unique Local Unicast 1111110 FC00: :/7

Special Addresses 0000 0000 0000: :/8

Note— Anycast addresses are taken from the unicast address spaces
(of any scope) and are not syntactically distinguishable from unicast
addresses. For example, if you are configuring a DNS server and you
want to use anycast for redundancy and load balancing, you would
assign the same anycast address to multiple DNS servers. When clients
send DNS queries to the anycast address, the queries will be
automatically routed to the closest DNS server, improving
performance and resilience.
Global Unicast Addresses
The block in the address space that is used for unicast (one-to-one)
communication between two hosts in the Internet (like public IP
addresses in IPv4) is called the global unicast address block. CIDR for
the block is 2000: :/3, which means that the three leftmost bits are the
same for all addresses in this block (001). The size of this block is 2125
bits, which is more than enough for Internet expansion for many years
to come. An address in this block is divided into three parts:

1. Global routing prefix


2. Subnet ID
3. Interface ID

3 bits 45 bits 16 bits 64 bits


001 Global routing prefix Subnet ID Interface ID

Fig: The general format for IPv6 Global Unicast addresses

1. Global Routing Prefix— It is used to route the packet through the Internet to
the organization site, such as the ISP that owns the block. Since the first three
bits in this part are fixed (001), the rest of the 45 bits can be defined for up to
245 sites (a private organization or an ISP). The global routers in the Internet
route a packet to its destination site based on the value of global routing prefix.

Note— The Global Routing Prefix in IPv6 serves a similar purpose to the network
ID (netid) in IPv4. Both are used to identify the network portion of an IP address
and are used for routing purposes.

2. Subnet ID— It defines a subnet in an organization. It means that an


organization can have up to 216 subnets, which is more than enough.

3. Interface ID— It is similar to hostid in IPv4 addressing.


IPv6 Datagram Header
IPv6 headers have one Fixed Header and zero or more Optional (Extension)
Headers. All the necessary information that is essential for a router is kept in the
Fixed Header. The Extension Header contains optional information that helps
routers to understand how to handle a packet/flow.

Fig. Fixed length IPV6 datagram header

Base header = 40 bytes ( fixed )


Version— The 4-bit version field defines the version number of the IP. For IPv6,
the value is 0110.

Traffic class— The 8-bit traffic class field is used to distinguish different payloads
with different delivery requirements. It replaces the type-of-service field in IPv4.

Flow label— The flow label is a 20-bit field that is designed to provide special
handling for a particular flow of data.

Payload length—The 2-byte payload length field defines the length of the IP
datagram excluding the header.

Next header— The next header is an 8-bit field defining the type of the first
external header (if present) or the type of the data that follows the base header
in the datagram. This field is similar to the protocol field in IPv4.

Hope limit—The 8-bit hop limit field serves the same purpose as the TTL field in
IPv4.

Source and destination addresses—These two fields are source IP and


destination IP addresses.
IPv4 vs IPv6

Q. What do you understand by DNS overhead?


It refers to the additional computational resources, network bandwidth, and
processing time required to perform DNS (Domain Name System) operations
within a network.
Q. When you perform a bit-wise AND operation between a
subnet mask and an IP address, you obtain the subnet address
to which the IP belongs. Justify it with a suitable example.

Ans— Suppose we have the following information:


IP: 128.7.7.1 and subnet mask: 255.0.0.0

10000000 00000111 00000111 00000001

11111111 00000000 00000000 00000000

10000000 00000000 00000000 00000000 = 128.0.0.0 (subnet address);


therefore, the given IP belongs the network: 128.0.0.1.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy