You are on page 1of 31

lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
NETWORK LAYER UNIT - 3

Switching : Packet Switching – Internet protocol – IPV4 – IP Addressing – Sub netting – IPV6,
ARP, RARP, ICMP, DHCP

Packet Switching
Write short notes on packet switching.
 Packet switching is a method for sending data whereby the data is divided in packets.
 Each packet is given a header containing information of the destination.
 Each packet is forwarded through the network to the destination using this information.
 At the destination the data has to be reassembled from the received packages.
 There are two common packet switching methods in use:
 Datagram Approach: Connectionless Service
o Each packet is forwarded independently based on the destination address.
o Routing decisions are made dynamically, so each packet may follow a different route and
thus the packages may arrive out of order.

Figure: A connectionless packet-switched network


 Virtual-Circuit Approach: Connection-Oriented Service
o A route is set up prior to packets being sent.
o The packets will all follow this route.
o This makes the routing through the network very easy and the packages will be received in
the correct order.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: A virtual-circuit packet-switched network


 Each packet is forwarded based on the label in the packet.
 To create a connection-oriented service, a three-phase process is used: setup, data transfer, and
teardown.
 In the setup phase, the source and destination addresses of the sender and receiver are used to make
table entries for the connection-oriented service.
 In the teardown phase, the source and destination inform the router to delete the corresponding
entries. Data transfer occurs between these two phases.
Setup Phase
 In the setup phase, a router creates an entry for a virtual circuit.
 For example, suppose source A needs to create a virtual circuit to destination B.
 Two auxiliary packets need to be exchanged between the sender and the receiver: the request packet
and the acknowledgment packet.
Request Packet
 A request packet is sent from the source to the destination.
 This auxiliary packet carries the source and destination addresses.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: Sending request packet in a virtual-circuit network


1. Source A sends a request packet to router R1.
2. Router R1 receives the request packet. It knows that a packet going from A to B goes out through
port 3. How the router has obtained this information is a point covered later. For the moment, assume
that it knows the output port. The router creates an entry in its table for this virtual circuit, but it is
only able to fill three of the four columns. The router assigns the incoming port (1) and chooses an
available incoming label (14) and the outgoing port (3). It does not yet know the outgoing label,
which will be found during the acknowledgment step. The router then forwards the packet through
port 3 to router R3.
3. Router R3 receives the setup request packet. The same events happen here as at router R1; three
columns of the table are completed: in this case, incoming port (1), incoming label (66), and
outgoing port (3).
4. Router R4 receives the setup request packet. Again, three columns are completed: incoming port (1),
incoming label (22), and outgoing port (4).
5. Destination B receives the setup packet, and if it is ready to receive packets from A, it assigns a label
to the incoming packets that come from A, in this case 77. This label lets the destination know that
the packets come from A, and not from other sources.
Acknowledgment Packet
 A special packet, called the acknowledgment packet, completes the entries in the switching tables.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: Sending acknowledgments in a virtual-circuit network


1. The destination sends an acknowledgment to router R4. The acknowledgment carries the global
source and destination addresses so the router knows which entry in the table is to be completed. The
packet also carries label 77, chosen by the destination as the incoming label for packets from A.
Router R4 uses this label to complete the outgoing label column for this entry. Note that 77 is the
incoming label for destination B, but the outgoing label for router R4.
2. Router R4 sends an acknowledgment to router R3 that contains its incoming label in the table,
chosen in the setup phase. Router R3 uses this as the outgoing label in the table.
3. Router R3 sends an acknowledgment to router R1 that contains its incoming label in the table,
chosen in the setup phase. Router R1 uses this as the outgoing label in the table.
4. Finally router R1 sends an acknowledgment to source A that contains its incoming label in the table,
chosen in the setup phase.
5. The source uses this as the outgoing label for the data packets to be sent to destination B.
Data-Transfer Phase
 The second phase is called the data-transfer phase.
 After all routers have created their forwarding table for a specific virtual circuit, then the network-
layer packets belonging to one message can be sent one after another.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: Flow of one packet in an established virtual circuit


 In the above Figure, we show the flow of a single packet, but the process is the same for 1, 2, or 100
packets.
 The source computer uses the label 14, which it has received from router R1 in the setup phase.
 Router R1 forwards the packet to router R3, but changes the label to 66. Router R3 forwards the
packet to router R4, but changes the label to 22.
 Finally, router R4 delivers the packet to its final destination with the label 77.
 All the packets in the message follow the same sequence of labels, and the packets arrive in order at
the destination.
Teardown Phase
 In the teardown phase, source A, after sending all packets to B, sends a special packet called a
teardown packet.
 Destination B responds with a confirmation packet.
 All routers delete the corresponding entries from their tables.

Internet Protocol (IP)


With a neat sketch explain about IP service model, packet format, fragmentation and reassembly.
(Nov/Dec 2016) (Or) Explain the datagram forwarding in IP. (Nov/Dec 2017) (Or) Write algorithm for
datagram forwarding in IP. (April/May 2018)
 The Internet Protocol (IP) is the method or protocol to send data from one computer to another on
the Internet.
 It is used to build scalable, heterogeneous internetworks.
 It is an unreliable and connectionless datagram protocol.
 IP provides best-effort delivery of datagram (connectionless) packets between two hosts.
o IP tries but doesn’t guarantee that packets will arrive (best effort)

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
o Packets can be lost or duplicated (unreliable)
o Ordering of datagram is not guaranteed (connectionless)
 IP Service model has two parts. They are,
o Datagram (connectionless) model of data delivery
o Addressing scheme to identify all hosts uniquely in the internetwork.

Figure: A simple internetwork where H represents hosts and R represents routers


Datagram Delivery
 Best-effort, connectionless service is used by IP to deliver a datagram
 Packets can be lost or corrupted. It can also be delivered out of order.
 IP provides neither error control nor flow control. It is an unreliable service.
Datagram Format
 Packets used by the IP are called datagrams.
 A datagram is a variable-length packet consisting of two parts: header and payload (data).
 The header is 20 to 60 bytes in length and contains information essential to routing and delivery.
 Minimum packet length is 20 bytes and maximum 65,535 bytes.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

 Version― It specifies the current version of IP. (IPv4 Or IPv6)


 HLen (Header Length) ― Specifies the total length of the header in 4-byte words.
 Service Type (TOS - Type of Service) ― It defines how the datagram should be handled.
 Length― Specifies length of a packet including header.
 Ident (Identifier) ― a 16-bit identifier that uniquely identifies a datagram packet.
 Flags ― 3-bit field contains D (do not fragment) bit and M (more fragment) bit.
 Offset―shows relative position of the fragment in units of 8 bytes.
 TTL (Time to Live) ―defines lifetime of the datagram (default 64 hops).
 Protocol ― specifies upper layer protocol (e.g., 6 for TCP, 17 for UDP).
 Checksum ― 16-bit internet checksum for the packet header.
 Source Address / Destination Address ― 32-bit IP address to find source and destination host.
IP Fragmentation and Reassembly
 IP fragmentation is an internet protocol process that breaks datagram into smaller pieces (fragments),
so that packets may be formed that can pass through a link with a smaller maximum transfer unit
(MTU) than the original datagram size.
 Then the fragments are reassembled by the receiving host.
 The value of the MTU differs from one physical network protocol to another.
o For example, Ethernet (1500 bytes), FDDI (4500 bytes)

Figure: Maximum Transfer Unit (MTU)

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 Strategy
o Fragmentation occurs in a router when it receives a datagram that it wants to forward over a
network which has (MTU < datagram).
o Reassembly is done at the receiving host
o All the fragments carry the same identifier in the Ident field
o Fragments are self-contained datagram’s
o IP does not recover from missing fragments

Figure: Fragmentation and Reassembly


Fields Related to Fragmentation
 There are three fields in an IP datagram are related to fragmentation: identification, flags, and
fragmentation offset.
 The 16-bit identification field identifies a datagram originating from the source host.
 The 3-bit flags field defines three flags.
o The leftmost bit is reserved (not used).
o The second bit (D bit) is called the do not fragment bit.
 If its value is 1, the machine must not fragment the datagram.
 If its value is 0, the datagram can be fragmented if necessary.
o The third bit (M bit) is called the more fragment bit.
 If its value is 1, it means the datagram is not the last fragment; there are more
fragments after this one.
 If its value is 0, it means this is the last or only fragment.
 The 13-bit fragmentation offset field shows the relative position of this fragment with respect to the
whole datagram.

IP Fragmentation Example

Figure: Fragmentation of Datagram’s

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
Example
Consider sending a 3500 byte datagram that has arrived at a router R1 needs to be sent over a link that
has an MTU size of 1000 bytes to R2. Then it has to traverse a link with an MTU size of 600 bytes. Let the
identification of the original datagram be 465. How many fragments are delivered at the destination?
Show the parameters associated with each of these fragments. (April/May 2017)
Solution:
Assume that the DF flag was not set.
Assume that no optional fields of the IP header are in use (i.e. IP header is 20 bytes)
The original datagram was 3500 bytes, subtracting 20 bytes for header, that leaves 3480 bytes of
data.
Assume the ID of the original packet is 'x'.
With an MTU of 600 bytes, 600 - 20 = 580 bytes of data may be transmitted in each packet
Therefore, ceiling (3450 / 580) = 6 packets are needed to carry the data.

IPV4 Address
Briefly explain about IPv4 addresses.
 The identifier used in the IP layer of the TCP/IP protocol suite to identify the connection of each
device to the Internet is called the Internet address or IP address.
 An IPv4 address is a 32-bit address that uniquely and universally defines the connection of a host or
a router to the Internet. The IP address is the address of the connection, not the host or the router,
because if the device is moved to another network, the IP address may be changed.
Address Space
 An address space is the total number of addresses used by the protocol.
 If a protocol uses b bits to define an address, the address space is 2b because each bit can have two
different values (0 or 1).
 IPv4 uses 32-bit addresses, which means that the address space is 232 or 4,294,967,296 (more than
four billion).
 If there were no restrictions, more than 4 billion devices could be connected to the Internet.
Notation
 There are three common notations to show an IPv4 address: binary notation (base 2), dotted-decimal
notation (base 256), and hexadecimal notation (base 16).
 In binary notation, an IPv4 address is displayed as 32 bits.
 To make the address more readable, one or more spaces are usually inserted between each octet (8
bits).
 Each octet is often referred to as a byte.
 To make the IPv4 address more compact and easier to read, it is usually written in decimal form with
a decimal point (dot) separating the bytes.
 This format is referred to as dotted-decimal notation.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 Note that because each byte (octet) is only 8 bits, each number in the dotted-decimal notation is
between 0 and 255.

Figure: Three different notations in IPv4 addressing


Hierarchy in Addressing
 In any communication network that involves delivery, such as a telephone network or a postal
network, the addressing system is hierarchical.
 In a postal network, the postal address (mailing address) includes the country, state, city, street,
house number, and the name of the mail recipient.
 Similarly, a telephone number is divided into the country code, area code, local exchange, and the
connection.
 A 32-bit IPv4 address is also hierarchical, but divided only into two parts.
 The first part of the address, called the prefix, defines the network; the second part of the address,
called the suffix, defines the node (connection of a device to the Internet).
 Figure below shows the prefix and suffix of a 32-bit IPv4 address.
 The prefix length is n bits and the suffix length is (32 − n) bits.

 A prefix can be fixed length or variable length. The network identifier in the IPv4 was first designed
as a fixed-length prefix.
 This scheme, which is now obsolete, is referred to as classfull addressing.
 The new scheme, which is referred to as classless addressing, uses a variable-length network prefix.
Classfull Addressing
 An IPv4 address was designed with a fixed-length prefix, but to accommodate both small and large
networks, three fixed-length prefixes were designed instead of one (n = 8, n = 16, and n = 24).
 The whole address space was divided into five classes (class A, B, C, D, and E), as shown in the
Figure.
 This scheme is referred to as classfull addressing.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: Address Space in Classfull Addressing


 In class A, the network length is 8 bits, but since the first bit, which is 0, defines the class, we can
have only seven bits as the network identifier.
 In class B, the network length is 16 bits, but since the first two bits, which are (10)2, define the class,
we can have only 14 bits as the network identifier.
 All addresses that start with (110)2 belong to class C.
 Class D is not divided into prefix and suffix. It is used for multicast addresses.
 All addresses that start with 1111 in binary belong to class E.
 As in Class D, Class E is not divided into prefix and suffix and is used as reserve.
Address Depletion
 The reason that classfull addressing has become obsolete is address depletion.

IP ADDRESSING

Subnetting
 Subnetting is the technique of partitioning a large network into smaller networks.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
(Or)
 It is a technique of partitioning an individual physical network into several small-sized logical sub-
networks.
 These subnetworks are known as subnets.
 An IP address is made up of the combination of the network segment and a host segment.
 A subnet is constructed by accepting the bits from the IP address host portion which are then used to
assign a number of small-sized sub-networks in the original network.
 The Subnetting basically converts the host bits into the network bits.
 As mentioned above the subnetting strategy was initially devised for slowing down the depletion of
the IP addresses.
 The subnetting permits the administrator to partition a single class A, class B, class C network into
smaller parts.
 VLSM (Variable Length Subnet Mask) is a technique which partitions IP address space into
subnets of different sizes and prevent memory wastage.
 Furthermore, when the number of hosts is same in subnets, which is known as FLSM (Fixed Length
Subnet Mask).

Advantages of Subnetting
 Minimizes the network traffic through decreasing the volume of broadcasts.
 Increases addressing flexibility.
 Increases the number of allowed hosts in local area network.
 The network security can be readily employed between subnets rather than employing it in the whole
network.
 Subnets are easy to maintain and manage.
Disadvantages of Subnetting
 However, it is quite expensive.
 It requires trained administrator to perform subnetting.
Supernetting
 Supernetting is the method used for combining the smaller ranges of addresses into larger space.
 It was devised to make the routing process more convenient.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 Additionally, it reduces the size of routing table information so that it could consume less space in
the router’s memory.
(Or)
 It is inverse process of subnetting, in which several networks are merged into a single network.
 While performing supernetting, the mask bits are moved toward the left of the default mask.
 The supernetting is also known as router summarization and aggregation.
 It results in the creation of more host addresses at the expense of network addresses, where basically
the network bits are converted into host bits.
 The supernetting is performed by internet service provider rather than the normal users, to achieve
the most efficient IP address allocation.
 CIDR (Classless Inter-Domain Routing) is scheme used to route the network traffic across the
internet.
 CIDR is a supernetting technique where the several subnets are combined together for the network
routing.
 In simpler words, CIDR allows the IP addresses to be organized in the subnetworks independent of
the value of the addresses.

Advantages of Supernetting
 The size of the router memory table is minimized by summarizing several routing information entries
into a single entry.
 It also increases the speed of routing table lookup.
 Provision for the router to isolate the topology changes from the other routers.
 It also reduces the network traffic.
Disadvantages of Supernetting
 The combination of blocks should be made in power 2; alternatively, if the three blocks are required,
then there must be assigned four blocks.
 The whole network should exist in the same class.
 When merged, it lacks covering different areas.
Classless Addressing

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 Subnetting and supernetting in classfull addressing did not really solve the address depletion
problem.
 In classless addressing, variable-length blocks are used that belong to no classes.
 We can have a block of 1 address, 2 addresses, 4 addresses, 128 addresses, and so on.
 In classless addressing, the whole address space is divided into variable length blocks.
 The prefix in an address defines the block (network); the suffix defines the node (device).

Prefix Length: Slash Notation


 In this case, the prefix length, n, is added to the address, separated by a slash.
 The notation is informally referred to as slash notation and formally as classless interdomain
routing or CIDR (pronounced cider) strategy.

Figure: Slash Notation (CIDR)


Extracting Information from an Address
 Given any address in the block, we normally like to know three pieces of information about the block
to which the address belongs: the number of addresses, the first address in the block, and the last
address.
 Since the value of prefix length, n, is given, we can easily find these three pieces of information, as
shown in Figure.
o The number of addresses in the block is found as N = 232 - n.
o To find the first address, we keep the n leftmost bits and set the (32 - n) rightmost bits all to
0s.
o To find the last address, we keep the n leftmost bits and set the (32 - n) rightmost bits all to
1s.
Address Mask
 Another way to find the first and last addresses in the block is to use the address mask.
 The address mask is a 32-bit number in which the n leftmost bits are set to 1s and the rest of the bits
(32 - n) are set to 0s.
 A computer can easily find the address mask because it is the complement of (232-n - 1).
 The reason for defining a mask in this way is that it can be used by a computer program to extract the
information in a block, using the three bit-wise operations NOT, AND, and OR.
o The number of addresses in the block N = NOT (mask) + 1.
o The first address in the block = (Any address in the block) AND (mask).
o The last address in the block = (Any address in the block) OR [(NOT (mask)].
Network Address
Page 14 of 31

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 The first address, the network address, is particularly important because it is used in routing a
packet to its destination network.

Figure: Network Address


Block Allocation
 The next issue in classless addressing is block allocation.
 The ultimate responsibility of block allocation is given to a global authority called the Internet
Corporation for Assigned Names and Numbers (ICANN).
 It assigns a large block of addresses to an ISP (or a larger organization that is considered an ISP in
this case).
 For the proper operation of the CIDR, two restrictions need to be applied to the allocated block.
o The number of requested addresses, N, needs to be a power of 2. The reason is that N = 232 - n
or n = 32 - log2N. If N is not a power of 2, we cannot have an integer value for n.
o The requested block needs to be allocated where there are an adequate number of contiguous
addresses available in the address space. However, there is a restriction on choosing the first
address in the block. The first address needs to be divisible by the number of addresses in the
block. The reason is that the first address needs to be the prefix followed by (32 − n) number
of 0s. The decimal value of the first address is then,
first address = (prefix in decimal) x 232 - n = (prefix in decimal) x N.
Address Aggregation
 One of the advantages of the CIDR strategy is address aggregation (sometimes called address
summarization or route summarization).
 When blocks of addresses are combined to create a larger block, routing can be done based on the
prefix of the larger block.
 ICANN assigns a large block of addresses to an ISP.
 Each ISP in turn divides its assigned block into smaller subblocks and grants the subblocks to its
customers.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Special Addresses
 The five special addresses that are used for special purposes: this-host address, limited-broadcast
address, loopback address, private addresses, and multicast addresses.
This-host Address
 The only address in the block 0.0.0.0/32 is called the this-host address.
 It is used whenever a host needs to send an IP datagram but it does not know its own address to use
as the source address.
Limited-broadcast Address
 The only address in the block 255.255.255.255/32 is called the limited-broadcast address.
 It is used whenever a router or a host needs to send a datagram to all devices in a network.
 The routers in the network, however, block the packet having this address as the destination; the
packet cannot travel outside the network.
Loopback Address
 The block 127.0.0.0/8 is called the loopback address.
 A packet with one of the addresses in this block as the destination address never leaves the host; it
will remain in the host.
 Any address in the block is used to test a piece of software in the machine.
 For example, we can write a client and a server program in which one of the addresses in the block is
used as the server address. We can test the programs using the same host to see if they work before
running them on different computers.
Private Addresses
 Four blocks are assigned as private addresses: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, and
169.254.0.0/16.
Multicast Addresses
 The block 224.0.0.0/4 is reserved for multicast addresses.

Example (Nov/Dec 2019)


An organization is granted the block 125.238.0.0/16. The administrator wants to create 512 subnets:
i) Find the subnet mask required

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
ii) Find the number of addresses in each subnet.
iii) Find the first and last allocatable addresses in subnet 1.
iv) Find the first and last allocatable addresses in subnet 14.
Answer:
i) Find the subnet mask required
 This is a class A address range so that the default mask is /8.
 We need sufficient bits to produce 512 subnets so 2x = 512 where x is the number of bits required.
 Hence x = 9, thus we require the mask to be /8+9 = /17.
Or
 255.255.128.0 is also an acceptable answer.
ii) Find the number of addresses in each subnet
 There will be 15 bits remaining so the number of hosts per subnet is 32768 – 2 = 32766 since 2
addresses are not able to be used for hosts (they are reserved addresses).
iii) Find the first and last allocatable addresses in subnet 1
The first and last allocatable addresses in subnet 1 are:
 The first address for the block is found by ANDing the address 125.238.0.0 with the subnet mask /16
giving,
01111101 11101110 00000000 00000000 (125.238.0.0)
 But this is not an allocatable address, so the next one is,
01111101 11101110 00000000 00000001 (125.238.0.1)
 Finally, we note that the broadcast address is the last one of the 32768 addresses so the last
allocatable one is the one before that broadcast address so it must be,
01111101 11101110 00000000 00000000 (125.0.127.254)
iv) Find the first and last allocatable addresses in subnet 14
The first and last allocatable addresses in subnet 14 are:
 To find the 14th subnet we have to add 13 to the subnet number of the first subnet.
 We can add this amount to the first allocatable address of the first subnet as we know that the first
address in every block is not allocatable as it is a special address.
 The format is: 0nnnnnnn.ssssssss.shhhhhhh.hhhhhhhh
 1310 = 11112 added to bit positions 9 -17 inclusive,
10000010 00111000 00000000 00000001
+
00000000 00000111 10000000 00000000 10000010 00111111 10000000 00000001 (125.6.128.1)
 As there are 32768 addresses in the range with the first and last being reserved, the last allocatable
one must be 61 addresses after the above first allocatable address.
 Now 6110 = 1111012 is added to the first allocatable address to get:

10000010 00111000 00000111 11000001 (130.56.7.193)


+

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
00000000 00000000 00000000 00111101 (0.0.0.61)
10000010 00111000 00000111 11111110 (130.56.7.254)
 Thus the final allocatable address must be 130.56.7.254

Overview of IPv6 Addressing


Ipv6
Explain IPv6 in detail. (Or) Explain about IPv6? Compare IPv4 and IPv6. (May/June 2016) (Or) Draw
the IPv6 packet header. (April/May 2018)
 IPv6 stands for Internet Protocol version 6.
 The motivation for a new version of IP is simple: to deal with exhaustion of the IP address space.
 CIDR helped to contain the rate at which the Internet address space is being consumed and also
helped to control the growth of routing table information needed in the Internet’s routers.
 CIDR and subnetting could not solve address space exhaustion faced by IPv4.
 IPv6 was evolved to solve address space problem and offers rich set of services.
Historical Perspective
 The IETF began looking at the problem of expanding the IP address space in 1991, and several
alternatives were proposed.
 Since the IP address is carried in the header of every IP packet, increasing the size of the address
dictates a change in the packet header.
 The effort to define a new version of IP was known as IP Next Generation or IPng.
 An official IP version number was assigned, so IPng is now known as IPv6.
 The significance of changing to a new version of IP caused a snowball effect.
Features of IPv6
 In addition to the need to accommodate scalable routing and addressing, some of the other features
for IPng includes:
o Support for real-time services
o Security support
o Auto-configuration (i.e., the ability of hosts to automatically configure themselves with such
information as their own IP address and domain name)
o Enhanced routing functionality, including support for mobile hosts.
Addresses and Routing
• IPv6 provides 128 bit address space, instead of the 32 bit address of IPv4.
• IPv6 can potentially address 3.4 x 1028 nodes or approximately 1500 addresses per square foot of the
earth’s surface (which should be sufficient even when toasters on Venus have IP addresses!)
Address Space Allocation
 IPv6 addresses do not have classes, but the address space is still divided based on the leading bits.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

 IPv4's class A, B and C addresses start with 001 prefix.


 Multicast address serves the purpose of class D address.
 Large chunks (87%) of address space are left unassigned for future use.
 IPv6 defines two types of local addresses for private networks.
o Link-local addresses are to be used for addressing on a single link or subnetwork. They
cannot be integrated into the global addressing scheme.
o Site-local addresses are designed for local use but formatted in such a way that they can later
be integrated into the global address scheme.
 Reserved addresses start with prefix of eight 0s.
o Unspecified address is used when a host does not know its address
o Loopback address is used for testing purposes before connected to network
o Compatible address is used when IPv6 hosts communicate through IPv4 network
o Mapped address is used when a IPv6 host communicates with a IPv4 host.
 IPv6 defines anycast address, assigned to a set of interfaces. Packet with any cast address is
delivered to only one of the nearest interface.

Address Notation
 Standard representation of IPv6 address is x : x : x : x : x : x : x : x where x is a 16-bit hexadecimal
address separated by colon (:).
For example, 47CD : 1234 : 4422 : ACO2 : 0022 : 1234 : A456 : 0124
 IPv6 address with contiguous 0 bytes can be written compactly.
For example, 47CD : 0000 : 0000 : 0000 : 0000 : 0000 : A456 : 0124 47CD : : A456 : 0124
 IPv4 address is mapped to a IPv6 address by prefixing the 32-bit IPv4 address with 2 bytes of 1s and
then zero-extending the result to 128 bits.
For example, 128. 96.33.81 : : FFFF : 128.96.33.81
Address Aggregation
 IPv6 provides aggregation of routing information to reduce the burden on routers.
 Aggregation is done by assigning prefixes at continental level.
 For example, if all addresses in Europe have a common prefix, then routers in other continents would
need one routing table entry for all networks in Europe.
 Format for provider-based unicast address aggregation is:

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: An IPv6 provider-based unicast address


 RegistryID―identifies the continent (North America, Europe or Asia and Pacific)
 ProviderID―identifies the provider for Internet access, i.e., ISP.
 SubscriberID―specifies the subscriber identifier
 SubnetID―contains subnet of the subscriber.
 InterfaceID―contains link level or physical address.

IPv6 Packet Format

 Version — The 4-bit field defines the version number of the IP. i.e., 6.
 TrafficClass — The 8-bit field is used to distinguish different payloads with different delivery
requirements. It replaces the type-of-service field in IPv4.
 FlowLabel — The flow label is a 20-bit field that is designed to provide special handling for a
particular flow of data.
 PayloadLen — It is 2-byte field defines the length of the IP datagram excluding the header.
 NextHeader — It is an 8-bit field defining the type of the first extension header or the type of the
data that follows the base header in the datagram.
 HopLimit — It serves the same purpose as TTL field in IPv4.
 SourceAddress / DestinationAddress — 16-byte addresses of source and destination host
Extension Headers
 Extension header provides greater functionality to IPv6.
 Base header may be followed by six extension headers.
 Each extension header contains a NextHeader field to identify the header following it.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: Ipv6 Extension Headers


 Hop-by-Hop Option
o The hop-by-hop option is used when the source needs to pass information to all routers
visited by the datagram.
 Destination Option
o The destination option is used when the source needs to pass information to the destination
only.
 Source Routing
o The source routing extension header combines the concepts of the strict source route and the
loose source route options of IPv4.
 Fragmentation
o The concept of fragmentation in IPv6 is the same as that in IPv4. In IPv6, only the original
source can fragment.
 Authentication
o The authentication extension header has a dual purpose: it validates the message sender and
ensures the integrity of data.
 Encrypted Security Payload (ESP)
o The encrypted security payload (ESP) is an extension that provides confidentiality and
guards against eavesdropping.
Advanced Routing Capabilities
 Auto configuration—Auto or stateless configuration of IP address to hosts without the need for a
DHCP server, i.e., plug and play.
 Advanced Routing—Enhanced routing support for mobile hosts is provided.
 Additional Functions―Enhanced routing functionality with support for mobile hosts.
 Security―Encryption and authentication options provide confidentiality and integrity.
 Resource allocation―Flow label enables the source to request special handling of real-time audio
and video packets
Advantages of IPv6 over IPv4
 Address space―IPv6 uses 128-bit address whereas IPv4 uses 32-bit address. Hence IPv6 has huge
address space whereas IPv4 faces address shortage problem.
 Header format―Unlike IPv4, optional headers are separated from base header in IPv6. Each router
thus need not process unwanted addition information.
 Extensible―Unassigned IPv6 addresses can accommodate needs of future technologies.
Difference between IPv4 and IPv6.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
IPv4 IPv6
 IPv4 is a 32-Bit IP Address.  IPv6 is 128 Bit IP Address.
 IPv4 is a numeric address, and its binary  IPv6 is an alphanumeric address whose
bits are separated by a dot (.). binary bits are separated by a colon (:).
 IPv4 address uses the dot-decimal  IPv6 address is represented in
notation. hexadecimal, colon- separated notation.
 IPv4 support VLSM (Virtual Length  IPv6 does not offer support for VLSM.
Subnet Mask).  IPv6 support auto-configuration
 IPv4 does not support auto-configuration capabilities.
capabilities.

ARP
ARP stands for Address Resolution Protocol which is one of the most important protocols of the
Network layer in the OSI model. ARP finds the physical address, also known as Media Access Control
(MAC) address, of a host from its known IP address Figure.

ARP Mapping

ARP Operation
Following steps are involved in logical to physical address mapping:

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
The host or the router sends an ARP query packet. The ARP query packet includes the physical and IP
addresses of the sender and the IP address of the receiver. As the sender does not know the physical address
of the receiver, the ARP query is broadcast over the network.
a. Every host or router on the network receives and processes the ARP query packet, but only the
intended recipient recognizes its IP address and sends back an ARP response packet.
b. The ARP response packet contains the recipient's IP and physical addresses. The ARP response
packet is unicast directly to the inquirer (host/router) by using the physical address received in
the query packet.
Let us consider an example In Figure, the system on the left (A) has a packet that needs to be
delivered to another system (B) with IP address 141.23.56.23. System A needs to pass the packet to its
data link layer for the actual delivery, but it does not know the physical address of the recipient. It uses
the services of ARP by asking the ARP protocol to send a broadcast ARP request packet to ask for the
physical address of a system with an IP address of 141.23.56.23.This packet is received by every
system on the physical network, but only system B will answer it, as shown in Figure 21.3b. System B
sends an ARP reply packet that includes its physical address. Now system A can send all the packets it
has for this destination by using the physical address it received.

Cache Memory
Using ARP is inefficient if system A needs to broadcast an ARP request for each IP packet
it needs to send to system B. ARP can be useful if the ARP reply is cached (kept in cache memoryfor
a while) because a system normally sends several packets to the same destination. A system that
receives an ARP reply stores the mapping in the cache memory and keeps it for 20 to 30 minutes unless
the space in the cache is exhausted. Before sending an ARP request, the system first checks its cache to
see if it can find the mapping.

ARP Packet Format

ARP packet
The fields are as follows:
a. Hardware type. This is a 16-bit field defining the type of the network on which ARP is running.
Each LAN has been assigned an integer based on its type. For example, Ethernet is given type

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
1. ARP can be used on any physical network.
b. Protocol type. This is a 16-bit field defining the protocol. For example, the value of this field for
the IPv4 protocol is 080016, ARP can be used with any higher-level protocol.
c. Hardware length. This is an 8-bit field defining the length of the physical address in bytes.
For example, for Ethernet the value is 6.
d. Protocol length. This is an 8-bit field defining the length of the logical address in bytes. For
example, for the IPv4 protocol the value is 4.
e. Operation. This is a 16-bit field defining the type of packet. Two packet types are defined:
ARP request (1) and ARP reply (2).
f. Sender hardware address. This is a variable-length field defining the physical address of the
sender. For example, for Ethernet this field is 6 bytes long.
g. Sender protocol address. This is a variable-length field defining the logical (for example, IP)
address of the sender. For the IP protocol, this field is 4 bytes long.
h. Target hardware address. This is a variable-length field defining the physical address of the
target. For example, for Ethernet this field is 6 bytes long. For an ARP request message, this
field is alI 0s because the sender does not know the physical address of the target.
i. Target protocol address. This is a variable-length field defining the logical (for example, IP)
address of the target. For the IPv4 protocol, this field is 4 bytes long.

Encapsulation
An ARP packet is encapsulated directly into a data link frame. For example, in Figure 21.5 an ARP
packet is encapsulated in an Ethernet frame. Note that the type field indicates that the data carried by
the frame are an ARP packet.

Encapsulation of ARP packet


ARP Operation
ARP functions on a typical internet. These are the steps involved in an ARP process:

1. The sender knows the IP address of the target. We will see how the sender obtains thisshortly.
2. IP asks ARP to create an ARP request message, filling in the sender physical address, the
sender IP address, and the target IP address. The target physical address field is filled with 0s.
3. The message is passed to the data link layer where it is encapsulated in a frame by using the physical
address of the sender as the source address and the physical broadcast address as the destination
address.
4. Every host or router receives the frame. Because the frame contains a broadcast destination address,
all stations remove the message and pass it to ARP. All machines except the one targeted drop the
packet. The target machine recognizes its IP address.
5. The target machine replies with an ARP reply message that contains its physical address. The
message is unicast.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
6. The sender receives the reply message. It now knows the physical address of the target machine.
7. The IP datagram, which carries data for the target machine, is now encapsulated in a frameand is
unicast to the destination.

Four Different Cases of ARP Operation


The following are four different cases in which the services of ARP can be used

Case 1: The sender is a host and wants to send a packet to another host on the same network. In this
case, the logical address that must be mapped to a physical address is the destination IP address in the
datagram header.

Case 2: The sender is a host and wants to send a packet to another host on another network.

In this case, the host looks at its routing table and finds the IP address of the next hop (router) for this
destination. If it does not have a routing table, it looks for the IP address of the default router. The IP
address of the router becomes the logical address that must be mapped to a physical address.

Case 3: The sender is a router that has received a datagram destined for a host on another network. It
checks its routing table and finds the IP address of the next router. The IP address of the next router
becomes the logical address that must be mapped to a physical address.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Case 4: The sender is a router that has received a datagram destined for a host on the same network.
The destination IP address of the datagram becomes the logical address that must be mapped to a
physical address.

RARP
RARP Reverse Address Resolution Protocol (RARP) finds the logical address for a machine that
knows only its physical address. To create an IP datagram, a host or a router needs to know its own IP
address or addresses. The IP address of a machine is usually read from its configuration file stored on a disk
file. However, a diskless machine is usually booted from ROM, which has minimum booting information.
The ROM is installed by the manufacturer.
It cannot include the IP address because the IP addresses on a network are assigned by the network
administrator. The machine can get its physical address (by reading its NIC, for example), which is unique
locally. It can then use the physical address to get the logical address by using the RARP protocol.
RARP Operation
RARP operation is displayed in Figure.
a. A RARP request is created and broadcast on the local network.
b. Another machine on the local network that knows all the IP addresses will respond with a RARP reply.
c. The requesting machine must be running a RARP client program; the responding machine must be
running a RARP server program. Figure RARP Operation
RARP Packet Format & Encapsulation
The format of the RARP packet is the same as the ARP packet format as displayed in Figure,
except that the Operation field. It’s value is 3 for RARP request message and 4 for RARP reply message.
An RARP packet is also encapsulated directly into a data link frame just like ARP packet

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
as displayed in Figure. Limitations of RARP: As broadcasting is done at the data link layer. The physical
broadcast address, all 1’s in the case of Ethernet, does not pass the boundaries of a network. This means that
if an administrator has several networks or several subnets, it needs to assign a RARP server for each
network or subnet. This is the reason that RARP is almost obsolete. Two protocols, BOOTP and DHCP,
are replacing RARP.
ICMP
Explain in detail about ICMP. (Nov/Dec 2015) (Or) Write short notes on ICMP. (May/June 2016) (Or)
Explain the error reporting using ICMP protocol. How does traceroute program makes use of ICMP to
determine the name and address of the routers between source and destination. (Nov/Dec 2018)
 ICMP stands for Internet Control Message Protocol (ICMP).
 It is a supporting protocol in the Internet protocol suite.
 It is used to report error messages to source host and diagnose network problems.
 ICMP message is encapsulated within an IP packet.
 ICMP messages are not passed directly to the data-link layer.
 Instead, the messages are first encapsulated inside IP datagram’s before going to the lower layer.
 When an IP datagram encapsulates an ICMP message, the value of the protocol field in the IP
datagram is set to 1 to indicate that the IP payroll is an ICMP message.
 It also provides the basis for two widely used debugging tools, ping and traceroute.
o ping uses ICMP echo messages to determine if a node is reachable and alive.
o traceroute uses a slightly non-intuitive technique to determine the set of routers along the path
to a destination.
ICMP Encapsulation

ICMP Messages
 ICMP messages are divided into two broad categories: error-reporting messages and query
messages.
 The error-reporting messages report problems that a router or a host (destination) may encounter
when it processes an IP packet.
 The query messages, which occur in pairs, help a host or a network manager get specific information
from a router or another host.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE

Figure: General Format of ICMP Messages


 Type - defines the type of the message.
 Code - specifies the reason for the particular message type.
 Checksum – Common field used to detect errors in the message.
 The rest of the header is specific for each message type.
 The data section in error messages carries information for finding the original packet that had the
error.
 In query messages, the data section carries extra information based on the type of query.
Error Reporting Messages
 It is used to report problems that a router or a host (destination) may encounter when it processes an
IP packet.

 Destination Unreachable―When a router cannot route a datagram, the datagram is discarded and
sends a destination unreachable message to source host.
 This message uses different codes (0 to 15) to define the type of error message and the reason why a
datagram has not reached its final destination.
 Destination-unreachable messages include four basic types: They are,
o Network Unreachable
o Host Unreachable
o Protocol Unreachable
o Port Unreachable
Network-Unreachable
 It indicates that the router cannot find the destination network (does not exist or has failed) or
has no route to this network.
Host-Unreachable
 It alerts the sending host that the destination host requested cannot be found.
Protocol-Unreachable

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
 It indicates that the Transport layer protocol (UDP or TCP) is not available.
Port-Unreachable
 It indicates that the process or application in the source host is attempting to establish a
connection which is not active on the destination host.
 Source Quench ― It informs the sender that the network has encountered congestion and the
datagram has been dropped; the source needs to slow down sending more datagrams.
 Time Exceeded ― Router discards a datagram when TTL field becomes 0 and a time exceeded
message is sent to the source host.
 Parameter Problem ― If a router discovers ambiguous or missing value in any field of the
datagram, it discards the datagram and sends parameter problem message to source.
 Redirection ― is used when the source uses a wrong router to send out its message. The router
redirects the message to the appropriate router, but informs the source that it needs to change its
default router in the future. The IP address of the default router is sent in the message.
Query Messages
 Query messages are used to diagnose some network problems.

 Echo Request & Reply ― The echo request (type 8) and the echo reply (type 0) pair of messages is
used by a host or a router to test the liveliness of another host or router.
 Timestamp Request & Reply ― The timestamp request (type 13) and the timestamp reply (type 14)
pair of messages is used to find the round-trip time between two devices or to check whether the
clocks in two devices are synchronized.
Deprecated Messages
Three pairs of messages are declared obsolete by IETF:
 Information Request and Reply
o The Information Request/Reply (type 15 and 16) pair was intended to support self-
configuring systems, to allow them to discover their IP network prefixes at boot time.
 Address Mask Request & Reply
o If the host knows the address of the router; it sends the request directly to the router.
o If it does not know, it broadcasts the message.
o The router receiving the address mask request message responds with an address mask reply
message, providing the necessary mask for the host.
 Router Advertisement & Solicitation

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
o A host that wants to send data to a host on another network needs to know the address of
routers connected to its own network.
A host broadcasts a router solicitation message to know about the router.
DHCP
The Dynamic Host Configuration Protocol (DHCP) has been devised to provide static and dynamic
address allocation that can be manual or automatic as required.

 Static Address Allocation In this capacity DHCP acts as BOOTP does. It is backward
compatible with BOOTP, which means a host running the BOOTP client can request a static
address from a DHCP server. A DHCP server has a database that statically binds physical
addresses to IP addresses.
 Dynamic Address Allocation DHCP has a second database with a pool of available IP
addresses. This second database makes DHCP dynamic. When a DHCP client requests a
temporary IP address, the DHCP server goes to the pool of available (unused) IP
addresses and assigns an IP address for a negotiable period of time.

• When a DHCP client sends a DHCP request to a DHCP server, the server first checks its static
database. If an entry with the requested physical address exists in the static database, the
permanent IP address of the client is returned.
• On the other hand, if the entry does not exist in the static database, the server selects an IP
address from the available pool, assigns the address to the client, and adds the entry to the
dynamic database.
• The dynamic aspect of DHCP is needed when a host moves from network to network or
is connected and disconnected from a network (as is a subscriber to a s rvice provider).
• DHCP provides temporary IP addresses for a limited time. The addresses assigned fromthe
pool are temporary addresses.
• The DHCP server issues a lease for a specific time. When the lease expires, the client must
either stop using the IP address or renew the lease.
• The server has the option to agree or disagree with the renewal. If the server disagrees, the
client stops using the address.

DHCP Operation
DHCP provides an automated way to distribute and update IP addresses and other configuration
information on a network. A DHCP server provides this information to a DHCP client through the
exchange of a series of messages, known as the DHCP conversation or the DHCP transaction displayed
in Figure.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering


lOMoAR cPSD| 5159590

CS3591– Computer Networks (Regulation 2021)


III Year / V Semester - CSE
Figure 21.13: DHCP Operation

DHCP client goes through the four step


o process:

1. A DHCP client sends a broadcast packet (DHCP Discover) to discover DHCP servers on the
LAN segment.

2. The DHCP servers receive the DHCP Discover packet and respond with DHCP
Offer packets, offering IP addressing information.

3. If the client receives the DHCP Offer packets from multiple DHCP servers, the first DHCP
Offer packet is accepted. The client responds by broadcasting a DHCP Request packet, requesting
network parameters from a single server.

4. The DHCP server approves the lease with a DHCP Acknowledgement (DHCP Ack) packet. The
packet includes the lease duration and other configuration information.

Prepared By Mr.A.T.Barani Vijaya Kumar AP/CSE - Saranathan College of Engineering

You might also like