Lecture #4 Thr

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 80

Computer

Networks
Instructor: Fatima Shahzadi
F.shahzadi@uet.edu.pk

Lecture #
04
Agenda

Network Layer
Layer-3
Functionalities
Devices which work on Network Layer mainly focus on routing. Routing may
include various tasks aimed to achieve a single goal. These can be:

• Addressing devices and networks.

• Populating routing tables or static routes.

• Queuing incoming and outgoing data and then forwarding them according
to quality of service constraints set for those packets.

• Internetworking between two different subnets.

• Delivering packets to destination with best efforts.

• Provides connection oriented and connection less mechanism.


Network Layer Features
With its standard functionalities, Layer 3 can provide various features as:

• Quality of service management

• Load balancing and link management

• Security

• Interrelation of different protocols and subnets with different schema.

• Different logical network design over the physical network design.

• L3 VPN and tunnels can be used to provide end to end dedicated connectivity.

Internet protocol is widely respected and deployed Network Layer protocol which helps
to communicate end to end devices over the internet. It comes in two flavors. IPv4
which has ruled the world for decades but now is running out of address space. IPv6 is
created to replace IPv4 and hopefully mitigates limitations of IPv4 too
Network Addressing
Layer 3 network addressing is one of the major tasks of Network Layer. Network Addresses
are always logical i.e. these are software based addresses which can be changed by
appropriate configurations.

A network address always points to host / node / server or it can represent a whole network.
Network address is always configured on network interface card and is generally mapped by
system with the MAC address (hardware address or layer-2 address) of the machine for
Layer-2 communication.

There are different kinds of network


addresses in existence:

1. IP

2. IPX

3. AppleTalk

We are discussing IP here as it is


the only one we use in practice
these days.
Network Addressing
IP addressing provides mechanism to differentiate between hosts and network. Because IP
addresses are assigned in hierarchical manner, a host always resides under a specific
network.The host which needs to communicate outside its subnet, needs to know destination
network address, where the packet/data is to be sent.

Hosts in different subnet need a mechanism to locate each other. This task can be done by
DNS. DNS is a server which provides Layer-3 address of remote host mapped with its domain
name or FQDN (fully qualified domain name). When a host acquires the Layer-3 Address (IP
Address) of the remote host, it forwards all its packet to its gateway. A gateway is a router
equipped with all the information which leads to route packets to the destination host.

Routers take help of routing tables, which has the following information:

Method to reach the network

Routers upon receiving a forwarding request, forwards packet to its next hop (adjacent router)
towards the destination.
Internet Protocol Version 4
(IPv4)
IPv4 is 32-bit addressing scheme used as TCP/IP host addressing mechanism. IP addressing
enables every host on the TCP/IP network to be uniquely identifiable.

IPv4 provides hierarchical addressing scheme which enables it to divide the network into
sub-networks, each with well-defined number of hosts. IP addresses are divided into many
categories:

Class A - it uses first octet for network addresses and last three octets for host addressing

Class B - it uses first two octets for network addresses and last two for host addressing

Class C - it uses first three octets for network addresses and last one for host addressing

Class D - it provides flat IP addressing scheme in contrast to hierarchical structure for above
three.

Class E - It is used as experimental.

IPv4 also has well-defined address spaces to be used as private addresses (not routable on
internet), and public addresses (provided by ISPs and are routable on internet).

Though IP is not reliable one; it provides ‘Best-Effort-Delivery’ mechanism.


IPv4:
IPv4 is a connectionless protocol used for packet switched networks. It operates on a best
effort delivery model, in which neither delivery is guaranteed, nor proper sequencing or
avoidance of duplicate delivery is assured. Internet Protocol Version 4 (IPv4) is the fourth
revision of the Internet Protocol and a widely used protocol in data communication over
different kinds of networks. IPv4 is a connectionless protocol used in packet-switched layer
networks, such as Ethernet. It provides a logical connection between network devices by
providing identification for each device. There are many ways to configure IPv4 with all kinds
of devices – including manual and automatic configurations – depending on the network
type.

IPv4 is defined and specified in IETF publication RFC 791.


IPv4 uses 32-bit addresses for Ethernet communication in five classes: A, B, C, D and E.
Classes A, B and C have a different bit length for addressing the network host. Class D
addresses are reserved for military purposes, while class E addresses are reserved for future
use.
IPv4 uses 32-bit (4 byte) addressing, which gives 232 addresses. IPv4 addresses are written in
the dot-decimal notation, which comprises of four octets of the address expressed
individually in decimal and separated by periods, for instance, 192.168.1.5.
IPv4 Datagram Header
IPv4 Datagram Header
VERSION: Version of the IP protocol (4 bits), which is 4 for IPv4

HLEN: IP header length (4 bits), which is the number of 32 bit


words in the header. The minimum value for this field is 5
and the maximum is 15

Type of service: Low Delay, High Throughput, Reliability (8 bits)

Total Length: Length of header + Data (16 bits), which has a


minimum value 20 bytes and the maximum is 65,535 bytes

Identification: Unique Packet Id for identifying the group of


fragments of a single IP datagram (16 bits)

Flags: 3 flags of 1 bit each : reserved bit (must be zero),


do not fragment flag, more fragments flag (same order)

Fragment Offset: Represents the number of Data Bytes ahead of the particular fragment in the
particular Datagram. Specified in terms of number of 8 bytes, which has the maximum value of
65,528 bytes

Time to live: Datagram’s lifetime (8 bits), It prevents the datagram to loop through the network
by restricting the number of Hops taken by a Packet before delivering to the Destination.
IPv4 Datagram Header
Protocol: Name of the protocol to which the data is to be passed
(8 bits)
Header Checksum: 16 bits header checksum for checking errors in the
datagram header
Source IP address: 32 bits IP address of the sender
Destination IP address: 32 bits IP address of the receiver
Option: Optional information such as source route, record route. Used by
the Network administrator to check whether a path is working or not.
Due to the presence of options, the size of the datagram header
can be of variable length (20 bytes to 60 bytes).
Classful Addressing
IP address is an address having information about how to reach a specific host, especially
outside the LAN. An IP address is a 32 bit unique address having an address space of 2 32.
Generally, there are two notations in which IP address is written, dotted decimal notation
and hexadecimal notation.
• Dotted Decimal Notation
• Hexadecimal Notation

Some points to be noted about


dotted decimal notation :
1. The value of any segment (byte) is
between 0 and 255 (both included).
2. There are no zeroes preceding the
value in any segment (054 is wrong,
54 is correct).
Classful Addressing
The 32 bit IP address is divided into five sub-classes. These are:

Class A
Class B
Class C
Class D
Class E
Each of these classes has a valid range of IP addresses. Classes D and E are reserved for
multicast and experimental purposes respectively. The order of bits in the first octet
determine the classes of IP address.
IPv4 address is divided into two parts:

• Network ID
• Host ID
The class of IP address is used to determine the bits used for network ID and host ID and the
number of total networks and hosts possible in that particular class. Each ISP or network
administrator assigns IP address to each device that is connected to its network.
Classful Addressing

Note: IP addresses are globally managed by Internet Assigned Numbers Authority(IANA) and
regional Internet registries(RIR).
Note: While finding the total number of host IP addresses, 2 IP addresses are not counted
and are therefore, decreased from the total count because the first IP address of any
network is the network number and whereas the last IP address is reserved for broadcast IP.
Class A:
IP address belonging to class A are assigned to the networks that contain a large number of
hosts.
The network ID is 8 bits long.
The host ID is 24 bits long.
The higher order bit of the first octet in class A is always set to 0. The remaining 7 bits in first
octet are used to determine network ID. The 24 bits of host ID are used to determine the
host in any network. The default subnet mask for class A is 255.x.x.x. Therefore, class A has a
total of:

2^7-2= 126 network ID(Here 2 address is subracted because 0.0.0.0 and 127.x.y.z are special
address. )
2^24 – 2 = 16,777,214 host ID
IP addresses belonging to class A ranges from 1.x.x.x – 126.x.x.x
Class B:
IP address belonging to class B are assigned to the networks that ranges from medium-sized
to large-sized networks.

The network ID is 16 bits long.


The host ID is 16 bits long.
The higher order bits of the first octet of IP addresses of class B are always set to 10. The
remaining 14 bits are used to determine network ID. The 16 bits of host ID is used to
determine the host in any network. The default sub-net mask for class B is 255.255.x.x. Class
B has a total of:

2^14 = 16384 network address


2^16 – 2 = 65534 host address
IP addresses belonging to class B ranges from 128.0.x.x – 191.255.x.x.
Class C:
IP address belonging to class C are assigned to small-sized networks.
The network ID is 24 bits long.
The host ID is 8 bits long.
The higher order bits of the first octet of IP addresses of class C are always set to 110. The
remaining 21 bits are used to determine network ID. The 8 bits of host ID is used to
determine the host in any network. The default sub-net mask for class C is 255.255.255.x.
Class C has a total of:
2^21 = 2097152 network address
2^8 – 2 = 254 host address
IP addresses belonging to class C ranges from 192.0.0.x – 223.255.255.x.
Class D:
IP address belonging to class D are reserved for multi-casting. The higher order bits of the
first octet of IP addresses belonging to class D are always set to 1110. The remaining bits are
for the address that interested hosts recognize.
Class D does not posses any sub-net mask. IP addresses belonging to class D ranges from
224.0.0.0 – 239.255.255.255.
Class E:
Range of special IP addresses:

169.254.0.0 – 169.254.0.16 : Link local addresses


127.0.0.0 – 127.0.0.8 : Loop-back addresses
0.0.0.0 – 0.0.0.8 : used to communicate within the current network.

Rules for assigning Host ID:

Host ID’s are used to identify a host within a network. The host ID are assigned based on the
following rules:

Within any network, the host ID must be unique to that network.


Host ID in which all bits are set to 0 cannot be assigned because this host ID is used to
represent the network ID of the IP address.
Host ID in which all bits are set to 1 cannot be assigned because this host ID is reserved as a
broadcast address to send packets to all the hosts present on that particular network.
Class E:
Rules for assigning Network ID:

Hosts that are located on the same physical network are identified by the network ID, as all
host on the same physical network is assigned the same network ID. The network ID is
assigned based on the following rules:

The network ID cannot start with 127 because 127 belongs to class A address and is reserved
for internal loop-back functions.
All bits of network ID set to 1 are reserved for use as an IP broadcast address and therefore,
cannot be used.
All bits of network ID set to 0 are used to denote a specific host on the local network and are
not routed and therefore, aren’t used.
Summary of Classfull Addressing
Problems with Classful
Addressing:
The problem with this classful addressing method is that millions of class A address are
wasted, many of the class B address are wasted, whereas, number of addresses available in
class C is so small that it cannot cater the needs of organizations. Class D addresses are used
for multicast routing and are therefore available as a single block only. Class E addresses are
reserved.
Since there are these problems, Classful networking was replaced by Classless Inter-Domain
Routing (CIDR) in 1993.
Classless Addressing
Network Address and Mask
Network address – It identifies a network on internet. Using this, we can find range of
addresses in the network and total possible number of hosts in the network.
Mask – It is a 32-bit binary number that gives the network address in the address block when
AND operation is bitwise applied on the mask and any IP address of the block.

The default mask in different classes are :


Class A – 255.0.0.0
Class B – 255.255.0.0
Class C – 255.255.255.0
Example : Given IP address 132.6.17.85 and default class B mask, find the beginning address
(network address).
Solution : The default mask is 255.255.0.0, which means that the only the first 2 bytes are
preserved and the other 2 bytes are set to 0. Therefore, the network address is 132.6.0.0.
Subnetting:

Dividing a large block of addresses into several contiguous sub-blocks and assigning these
sub-blocks to different smaller networks is called subnetting. It is a practice that is widely
used when classless addressing is done.

Classless Addressing

To reduce the wastage of IP addresses in a block, we use sub-netting. What we do is that we


use host id bits as net id bits of a classful IP address. We give the IP address and define the
number of bits for mask along with it (usually followed by a ‘/’ symbol), like, 192.168.1.1/28.
Here, subnet mask is found by putting the given number of bits out of 32 as 1, like, in the
given address, we need to put 28 out of 32 bits as 1 and the rest as 0, and so, the subnet
mask would be 255.255.255.240.
Subnetting
Some values calculated in subnetting :

1. Number of subnets : Given bits for mask – No. of bits in default mask

2. Subnet address : AND result of subnet mask and the given IP address

3. Broadcast address : By putting the host bits as 1 and retaining the network bits as in the IP
address

4. Number of hosts per subnet : 2(32 – Given bits for mask) – 2

5. First Host ID : Subnet address + 1 (adding one to the binary representation of the subnet
address)

6. Last Host ID : Subnet address + Number of Hosts


Subnetting

Example : Given IP Address – 172.16.0.0/25, find the number of subnets and the number of
hosts per subnet. Also, for the first subnet block, find the subnet address, first host ID, last host
ID and broadcast address.

Solution : This is a class B address. So, no. of subnets = 2 raise to power (25-16) = 29 = 512.

No. of hosts per subnet = 2 raise to power(32-25) – 2 = 2 raise to power 7 – 2 = 128 – 2 = 126

For the first subnet block, we have


subnet address = 0.0,
first host id = 0.1,
last host id = 0.126 and
broadcast address = 0.127
IPv4 classless Subnet
equation
Problem
How to calculate IP address subnet information (Network, Broadcast, First IP, Last IP)?
It’s too simple equation to calculate IPv4 Subnet Network ID.
*Used and Tested with Class C Subnets.
First Of All, Keep this Subnet Hosts Map in mind (Number of Hosts per Prefix):

Network Prefix: Number of


IPs
24 : 256 IPs
25 : 128 IPs
26 : 64 IPs
27 : 32 IPs
28 : 16 IPs
29 : 8 IPs
30 : 4 IPs
Using Equation:

Network ID: floor(Host Address/Subnet Number of Hosts) * Subnet Number of Hosts


Broadcast ID: (Host ID + (Subnet Number of Hosts-1))
First Host: Network ID + 1
Last Host: Broadcast ID – 1

Ex1: 192.168.1.65/28:

65/16 = 4.0625
Network ID: 4*16 = 64 (192.168.1.64)
Broadcast ID: 64+(16-1) = 79 (192.168.1.79)
First Host ID: 64 + 1 = 65 (192.168.1.65)
Last Host ID: 79 - 1 = 78 (192.168.1.78)
Ex2: 192.168.20.166/25
166/128 = 1.296875
Network ID: 1*128 = 128 (192.168.20.128)
Broadcast ID: 128+(128-1) = 255 (192.168.20.255)
First Host ID: 128 + 1 = 129 (192.168.20.129)
Last Host ID: 255 - 1 = 254 (192.168.20.254)

Ex3: 192.168.30.14/29:

14/8 = 1.75
Network ID: 1*8 = 8 (192.168.30.8)
Broadcast ID: 8+(8-1) = 15 (192.168.30.15)
First Host ID: 8 + 1 = 9 (192.168.30.9)
Last Host ID: 15 - 1 = 14 (192.168.30.14)

Ex4: 192.168.20.86/30:

86/4 = 21.5
Network ID: 21*4 = 84 (192.168.20.84)
Broadcast ID: 84+(4-1) = 87
(192.168.20.87) First Host ID: 84 + 1 = 85
(192.168.20.85) Last Host ID: 87 - 1 = 86
(192.168.20.86)
IPv4 Classful subnetting
Supernetting
Supernetting is the opposite of Subnetting. In subnetting, a single big network is divided into
multiple smaller subnetworks. In Supernetting, multiple networks are combined into a bigger
network termed as a Supernetwork or Supernet.

Supernetting is mainly used in Route Summarization, where routes to multiple networks with
similar network prefixes are combined into a single routing entry, with the routing entry
pointing to a Super network, encompassing all the networks. This in turn significantly
reduces the size of routing tables and also the size of routing updates exchanged by routing
protocols.

When multiple networks are combined to form a bigger network, it is termed as super-
netting
Super netting is used in route aggregation to reduce the size of routing tables and routing
table updates
There are some points which should be kept in mind while supernetting:

1. All the IP address should be contiguous.


2. Size of all the small networks should be equal and must be in form of 2n.
3. First IP address should be exactly divisible by whole size of supernet.
Example – Suppose 4 small 200.1.0.0,
networks of class C: 200.1.1.0,
200.1.2.0,
Build a bigger network which 200.1.3.0
have a single Network Id.
Network Id Subnet Mask Interface
Explanation – Before
Supernetting routing table will be 255.255.255.
200.1.0.0 A
look like as: 0
255.255.255.
200.1.1.0 B
0
255.255.255.
200.1.2.0 C
0
255.255.255.
200.1.3.0 D
0
First, lets check whether three condition are satisfied or not:

Contiguous: You can easily see that all network are contiguous all having size 256 hosts.
Range of first Network from 200.1.0.0 to 200.1.0.255. If you add 1 in last IP address of first
network that is 200.1.0.255 + 0.0.0.1, you will get the next network id that is 200.1.1.0.
Similarly, check that all network are contiguous.
Equal size of all network: As all networks are of class C, so all of the have a size of 256
which in turn equal to 2 raise to power 8.
First IP address exactly divisible by total size: When a binary number is divided by 2n then
last n bits are the remainder. Hence in order to prove that first IP address is exactly divisible
by while size of Supernet Network. You can check that if last n bits are 0 or not.
In given example first IP is 200.1.0.0 and whole size of supernet is (22 x 28=>22+8=>210).
If last 10 bits of first IP address are zero then IP will be divisible.

1. Last 10 bits of first IP address are zero (highlighted by green color). So 3rd condition is
also satisfied.
Therefore, you can join all these 4 networks and can make a Supernet. New Supernet Id will
be 200.1.0.0.
Supernetting
Advantages of Supernetting
1. Control and reduce network traffic
2. Helpful to solve the problem of lacking IP addresses
3. Minimizes the routing table
Disadvantages of Supernetting –
1. It cannot cover different area of network when
combined
2. All the networks should be in same class and all
IP should be contiguous
IPv4 Datagram Fragmentation and
Delays
Why IPv4 Datagram Fragmentation required?
Different Networks may have different maximum transmission unit (MTU), for example due
to differences in LAN technology. When one network wants to transmit datagrams to a
network with a smaller MTU, the routers on path may fragment and reassemble datagrams.
How is Fragmentation done?
When a packet is received at the router, destination address is examined and MTU is
determined. If size of the packet is bigger than the MTU, and the ‘Do not Fragment (DF)’ bit
is set to 0 in header, then the packet is fragmented into parts and sent one by one. The
maximum size of each fragment is the MTU minus the IP header size (Minimum 20 bytes and
Maximum 60 bytes).

Each fragment is converted to a packet and the following changes happen in the datagram
header:
The total length field is changed to the size of the fragment.
The More Fragment bit (MF bit) is set for all the fragment packets except the last one.
The fragment offset field is set, based on the number of fragment that is being set and the
MTU.
Header Checksum is re-calculated.
Example:
For a data packet of 4000 bytes and MTU of 1500 bytes, we have actual data of 3980 bytes
that is to be transmitted and 1480 bytes is the maximum data size that is permissible to be
sent. So, there would be 3 fragments:
For the first fragment, data size = 1480 bytes, offset = 0 and MF flag = 1
For the second fragment, data size = 1480 bytes, offset = 1480 and MF flag = 1
For the third fragment, data size = 1020 bytes, offset = 2960 and MF flag = 0
An important point to be noted here is that all fragments would be having same
identification number, thus indicating that all the fragments belong to the same parent data
packet.
Delays
Processing delay: Time taken by the routers to process the data packet header.
Queuing delay: Time taken by the data packet in routing queues.

Transmission delay: Time taken to load a data packet onto the transmission
channel
Dt = N/R,
N: Number of bits to be transmitted
R: Rate or transmission speed of the channel

Propagation delay – Time taken by the data packet to reach from source to
destination

Dp = D/S,
D: Distance between the source and the destination
S: is the speed of propagation
Fragmentation at Network Layer
Fragmentation is done by the network layer when the maximum size of datagram is greater
than maximum size of data that can be held a frame i.e., its Maximum Transmission Unit
(MTU). The network layer divides the datagram received from transport layer into fragments
so that data flow is not disrupted.
Since there are 16 bits for total length in IP header so,
maximum size of IP datagram = 216 – 1 = 65, 535 bytes.
Fragmentation at Network Layer
• It is done by network layer at the destination side and is usually done at routers.
• Source side does not require fragmentation due to wise (good) segmentation by transport
layer i.e. instead of doing segmentation at transport layer and fragmentation at network
layer, the transport layer looks at datagram data limit and frame data limit and does
segmentation in such a way that resulting data can easily fit in a frame without the need
of fragmentation.
• Receiver identifies the frame with the identification (16 bits) field in IP header. Each
fragment of a frame has same identification number.
• Receiver identifies sequence of frames using the fragment offset(13 bits) field in IP header
• An overhead at network layer is present due to extra header introduced due to
fragmentation.
• Fields in IP header for fragmentation –

Identification (16 bits) – use to identify fragments of same frame.


Fragment offset (13 bits) – use to identify sequence of fragments in the frame. It generally
indicates number of data bytes preceeding or ahead of the fragment.
Maximum fragment offset possible = (65535 – 20) – 1 = 65514
{where 65535 is maximum size of datagram and 20 is minimum size of IP header}
So, we need ceil(log2 raise to power 65514) = 16 bits for fragment offset but fragment offset
field has only 13 bits. So, to represent efficiently we need to scale down fragment offset field
by 216/213 = 8 which acts as a scaling factor. Hence, all fragments except the last fragment
should have data in multiples of 8 so that fragment offset ∈ N.
More fragments (MF = 1 bit) – tells if more fragments ahead of this fragment i.e. if MF = 1,
more fragments are ahead of this fragment and if MF = 0, it is the last fragment.
Don’t fragment (DF = 1 bit) – if we don’t want the packet to be fragmented then DF is set i.e.
DF = 1.
Reassembly of Fragments –
It takes place only at destination and not at routers since packets take independent
path(datagram packet switching), so all may not meet at a router and hence a need of
fragmentation may arise again. The fragments may arrive out of order also.

Algorithm :
Destination should identify that datagram is fragmented from MF, Fragment offset field.
Destination should identify all fragments belonging to same datagram from Identification
field.
Identify the 1st fragment(offset = 0).
Identify subsequent fragment using header length, fragment offset.
Repeat until MF = 0.
Efficiency –
Efficiency (e) = useful/total = (Data without header)/(Data with header)
Throughput = e * B { where B is bottleneck bandwidth }
Example – An IP router with a Maximum Transmission Unit (MTU) of 200 bytes has received
an IP packet of size 520 bytes with an IP header of length 20 bytes. The values of the relevant
fields in the IP header.

Explanation – Since MTU is 200 bytes and 20 bytes is header size so, maximum length of
data = 180 bytes but it can be represented in fragment offset since not divisible by 8 so,
maximum length of data feasible = 176 bytes.
Number of fragments = (520/200) = 3.
Header length = 5 (since scaling factor is 4 therefore, 20/4 = 5)
Efficiency, e = (Data without header)/(Data with header) = 500/560 = 89.2 %
Internet Protocol Version 6
(IPv6)
Exhaustion of IPv4 addresses gave birth to a next generation Internet Protocol version 6. IPv6
addresses its nodes with 128-bit wide address providing plenty of address space for future to
be used on entire planet or beyond.

IPv6 has introduced Anycast addressing but has removed the concept of broadcasting. IPv6
enables devices to self-acquire an IPv6 address and communicate within that subnet. This
auto-configuration removes the dependability of Dynamic Host Configuration Protocol
(DHCP) servers. This way, even if the DHCP server on that subnet is down, the hosts can
communicate with each other.

IPv6 provides new feature of IPv6 mobility. Mobile IPv6 equipped machines can roam around
without the need of changing their IP addresses.

IPv6 is still in transition phase and is expected to replace IPv4 completely in coming years. At
present, there are few networks which are running on IPv6. There are some transition
mechanisms available for IPv6 enabled networks to speak and roam around different
networks easily on IPv4. These are:

Dual stack implementation


Tunneling
NAT-PT
IPv6
IP v6 was developed by Internet Engineering Task Force (IETF) to deal with the problem of IP
v4 exhaustion. IP v6 is 128-bits address having an address space of 2^128, which is way bigger
than IPv4. In IPv6 we use Colon-Hexa representation. There are 8 groups and each group
represents 2 Bytes.

In IPv6 representation, we have three addressing methods :


Unicast
Multicast
Anycast

Unicast Address: Unicast Address identifies a single network interface. A packet sent to
unicast address is delivered to the interface identified by that address.
Multicast Address: Multicast Address is used by multiple hosts, called as Group, acquires a
multicast destination address. These hosts need not be geographically together. If any packet
is sent to this multicast address, it will be distributed to all interfaces corresponding to that
multicast address.
Anycast Address: Anycast Address is assigned to a group of interfaces. Any packet sent to
anycast address will be delivered to only one member interface (mostly nearest host possible).

Note : Broadcast is not defined in IPv6.


Types of IPv6 address:
Prefix Allocation Fraction of Address Space
0000 0000 Reserved 1/256
We have 128 bits 0000 0001 Unassigned (UA) 1/256
0000 001 Reserved for NSAP 1/128
in IPv6 address 0000 01 UA 1/64
but by looking at 0000 1 UA 1/32
first few bits we 0001 UA 1/16
can identify what 001 Global Unicast 1/8
010 UA 1/8
type of address it 011 UA 1/8
is. 100 UA 1/8
101 UA 1/8
Note : In IPv6, all 110 UA 1/8
1110 UA 1/16
0’s and all 1’s can
1111 0 UA 1/32
be assigned to any 1111 10 UA 1/64
host, there is not 1111 110 UA 1/128
any restriction like 1111 1110 0 UA 1/512
Link-Local Unicast
IPv4 1111 1110 10
Addresses
1/1024
Site-Local Unicast
1111 1110 11 1/1024
Addresses
1111 1111 Multicast Address 1/256
Provider based Unicast address :
These are used for global communication.

First 3 bits identifies it as of this type.


Registry Id (5-bits) : Registry Id identifies the region to which it belongs. Out of 32 (i.e.
2^5), only 4 registry id’s are being used.

Provider Id : Depending on the number of service providers that operates under a region,
certain bits will be allocated to Provider Id field. This field need not be fixed. Let’s say if
Provider Id = 10 bits then Subscriber Id will be 56 – 10 = 46 bits.
Subscriber Id : After Provider Id is fixed, remaining part can be used by ISP as normal IP
address.
Intra Subscriber : This part can be modified as per need of organization that is using the
service.
Geography based Unicast
address :
Global routing prefix : Global routing prefix contains all the details of Latitude and Longitude.
As of now, it is not being used. In Geography based Unicast address routing will be based on
location.
Interface Id : In IPv6, instead of using Host Id, we use the term Interface Id.

Some special addresses:


Unspecified

Loopback –

IPv4 Compatible –

IPv4 mapped _

Local Unicast Addresses :


There are two types of Local Unicast addresses defined- Link
local and Site Local.
Link local address:
Link local address is used for addressing on a single link. It can also be used to communicate
with nodes on the same link. Link local address always begins with 1111111010 (i.e. FE80).
Router will not forward any packet with Link local address.

Site local address:


Site local addresses are equivalent to private IP address in IPv4. Likely,
some address space is reserved, which can only be routed within an
organization. First 10-bits are set to 1111111011, which is why Site local
addresses always begin with FEC0. Following 32 bits are Subnet ID,
which can be used to create subnet within organization. Node address is
used to uniquely identify the link; therefore, we use 48-bits MAC address
here
Internet Protocol version 6 (IPv6)
IP version 6 is the new version of Internet Protocol, which is way better than IP version 4 in
terms of complexity and efficiency. Let’s look at the header of IP version 6 and understand
how it is different from IPv4 header.

IP version 6 Header Format :


Version (4-bits) : Indicates version of Internet Protocol which contains bit sequence 0110.
Traffic Class (8-bits) : The Traffic Class field indicates class or priority of IPv6 packet which is
similar to Service Field in IPv4 packet. It helps routers to handle the traffic based on priority
of the packet. If congestion occurs on router then packets with least priority will be
discarded.
As of now only 4-bits are being used (and remaining bits are under research), in which 0 to 7
are assigned to Congestion controlled traffic and 8 to 15 are assigned to Uncontrolled traffic.
Priority assignment of Congestion controlled traffic :

Uncontrolled data traffic is mainly used for Audio/Video data. So we


give higher priority to Uncontrolled data traffic.
Source node is allowed to set the priorities but on the way routers can
change it. Therefore, destination should not expect same priority which
was set by source node
Flow Label (20-bits) : Flow Label field is used by source to label the packets belonging to the
same flow in order to request special handling by intermediate IPv6 routers, such as non-
default quality of service or real time service. In order to distinguish the flow, intermediate
router can use source address, destination address and flow label of the packets. Between a
source and destination multiple flows may exist because many processes might be running at
the same time. Routers or Host that do not support the functionality of flow label field and
for default router handling, flow label field is set to 0. While setting up the flow label, source
is also supposed to specify the lifetime of flow.

Payload Length (16-bits) : It is a 16-bit (unsigned integer) field, indicates total size of the
payload which tells routers about amount of information a particular packet contains in its
payload. Payload Length field includes extension headers(if any) and upper layer packet. In
case length of payload is greater than 65,535 bytes (payload up to 65,535 bytes can be
indicated with 16-bits), then the payload length field will be set to 0 and jumbo payload
option is used in the Hop-by-Hop options extension header.

Next Header (8-bits) : Next Header indicates type of extension header(if present)
immediately following the IPv6 header. Whereas In some cases it indicates the protocols
contained within upper-layer packet, such as TCP, UDP.

Hop Limit (8-bits) : Hop Limit field is same as TTL in IPv4 packets. It indicates the maximum
number of intermediate nodes IPv6 packet is allowed to travel. Its value gets decremented
by one, by each node that forwards the packet and packet is discarded if value decrements
to 0. This is used to discard the packets that are stuck in infinite loop because of some
routing error.
Source Address (128-bits) : Source Address is 128-bit IPv6 address of the original source of
the packet.
Destination Address (128-bits) : Destination Address field indicates the IPv6 address of the
final destination(in most cases). All the intermediate nodes can use this information in order
to correctly route the packet.
Extension Headers : In order to rectify the limitations of IPv4 Option Field, Extension Headers
are introduced in IPversion 6. The extension header mechanism is very important part of the
IPv6 architecture. Next Header field of IPv6 fixed header points to the first Extension Header
and this first extension header points to the second extension header and so on.
IPv6 packet may contain zero, one or more extension headers but these should be present in
their recommended order:
Rule : Hop-by-Hop option header(if present) should always be placed after IPv6 base header.
Conventions :
Any extension header can appear at most once except Destination Header because
Destination Header is present two times in above list itself.
If Destination Header is present before Routing Header then it will be examined by all
intermediate nodes specified in routing header.
If Destination Header is present just above Upper layer then it will be examined only by
Destination node.
Given order in which all extension header should be chained in IPv6 packet and working of
each extension header :
Difference Between IPv4 and
IPv6:
IPv4 IPv6
IPv4 has 32-bit address length IPv6 has 128-bit address length
It Supports Manual and DHCP address configuration It supports Auto and
_____________________________________________renumbering address configuration
In IPv4 end to end connection integrity is Unachievable In IPv6 end to end connection
________________________________________________integrity is Achievable
It can generate 4.29×109 address space Address space of IPv6 is 3.4×1038
Security feature is dependent on application IPSEC is inbuilt security feature in the IPv6
Address representation of IPv4 in decimal Address Representation of IPv6 is in
________________________________________hexadecimal
Fragmentation performed by Sender and forwarding routers fragmentation done by
_________________________________________ _____________sender
In IPv4 Packet flow identification is not available In IPv6 packetflow identification
________________________________are Available and uses flow label field in the header
In IPv4 checksum field is available In IPv6 checksum field is not available
It has broadcast Message Transmission Scheme In IPv6 multicast and any cast message
_______________________________________________transmission scheme is available
In IPv4 Encryption and Authentication
facility not provided In IPv6 Encryption and Authentication are
_________________________________________provided
Internet Control Message Protocol
(ICMP)
ICMP is network diagnostic and error reporting protocol. ICMP
belongs to IP protocol suite and uses IP as carrier protocol. After
constructing ICMP packet, it is encapsulated in IP packet. Because IP
itself is a best-effort non-reliable protocol, so is ICMP.

Any feedback about network is sent back to the originating host. If


some error in the network occurs, it is reported by means of ICMP.
ICMP contains dozens of diagnostic and error reporting messages.

ICMP-echo and ICMP-echo-reply are the most commonly used ICMP


messages to check the reachability of end-to-end hosts. When a host
receives an ICMP-echo request, it is bound to send back an ICMP-
echo-reply. If there is any problem in the transit network, the ICMP
will report that problem.
ICMP
Since IP does not have a inbuilt mechanism for sending error and control messages. It
depends on Internet Control Message Protocol(ICMP) to provide an error control. It is used
for reporting errors and management queries. It is a supporting protocol and used by
networks devices like routers for sending the error messages and operations information.
e.g. the requested service is not available or that a host or router could not be reached.
Source quench message :
Source quench message is request to decrease traffic rate for messages sending to the
host(destination). Or we can say, when receiving host detects that rate of sending packets
(traffic rate) to it is too fast it sends the source quench message to the source to slow the
pace down so that no packet can be lost.
ICMP will take source IP from the discarded packet and informs to source by sending source
quench message.
Then source will reduce the speed of transmission so that router will free for congestion.

When the congestion router is far away from the source the ICMP will
send hop by hop source quench message so that every router will
reduce the speed of transmission.
Parameter problem :
Whenever packets come to the router then calculated header checksum should be equal to
recieved header checksum then only packet is accepted by the router.

If there is mismatch packet


will be dropped by the
router.
ICMP will take the source IP
from the discarded packet
and informs to source by
sending parameter problem
Time exceeded message :
message.
When some fragments are lost in a network then the holding fragment by the router will be
droped then ICMP will take source IP from discarded packet and informs to the source, of
discarded datagram due to time to live field reaches to zero, by sending time exceeded
message.
Destination un-reachable :
Destination unreachable is generated by the host or its inbound gateway to inform the client
that the destination is unreachable for some reason.

There is no necessary condition that only router give the ICMP error
message some time destination host send ICMP error message when any
type of failure (link failure,hardware failure,port failure etc) happen in the
network.
Redirection message :
Redirect requests data packets be sent on an alternate route. The
message informs to a host to update its routing information (to send
packets on an alternate route).
Ex. If host tries to send data through a router R1 and R1 sends data on a router R2 and there
is a direct way from host to R2. Then R1 will send a redirect message to inform the host that
there is a best way to the destination directly through R2 available. The host then sends data
packets for the destination directly to R2.
The router R2 will send the original datagram to the intended destination.
But if datagram contains routing information then this message will not be sent even if a
better route is available as redirects should only be sent by gateways and should not be sent
by Internet hosts.

Whenever a packet is forwarded in a wrong direction later it is re-directed


in a current direction then ICMP will send re-directed message.
Network Addressing
The next router on the path follows the same thing and eventually the data packet reaches
its destination.

Network address can be of one of the following:

1. Unicast (destined to one host)

2. Multicast (destined to group)

3. Broadcast (destined to all)

4. Anycast (destined to nearest one)

A router never forwards broadcast traffic by default. Multicast traffic uses special
treatment as it is most a video stream or audio with highest priority. Anycast is just similar
to unicast, except that the packets are delivered to the nearest destination when multiple
destinations are available.
Unicast routing
Most of the traffic on the internet and intranets known as unicast data or
unicast traffic is sent with specified destination. Routing unicast data
over the internet is called unicast routing. 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.
Broadcast routing
By default, the broadcast packets are not routed and forwarded by the routers on any
network. Routers create broadcast domains. But it can be configured to forward broadcasts
in some special cases. A broadcast message is destined to all network devices.

Broadcast routing can be done in two ways (algorithm):

A router creates a data packet and then sends it to each host one by one. In this case, the
router creates multiple copies of single data packet with different destination addresses. All
packets are sent as unicast but because they are sent to all, it simulates as if router is
broadcasting.
This method consumes lots of bandwidth and router must destination address of each
node.

Secondly, when router receives a packet that is to be broadcasted, it simply floods those
packets out of all interfaces. All routers are configured in the same way.
This method is easy on router's CPU but may cause the problem of duplicate packets
received from peer routers.

Reverse path forwarding is a technique, in which router knows in advance about its
predecessor from where it should receive broadcast. This technique is used to detect and
discard duplicates.
Broadcast Routing
Multicast Routing
Multicast routing is special case of broadcast routing with
significance difference and challenges. In broadcast routing,
packets are sent to all nodes even if they do not want it.
But in Multicast routing, the data is sent to only nodes
which wants to receive the packets.
The router must know that there are nodes, which wish to
receive multicast packets (or stream) then only it should
forward. Multicast routing works spanning tree protocol to
avoid looping.

Multicast routing also uses reverse path Forwarding


technique, to detect and discard duplicates and loops.
Multicast Routing
Anycast Routing
Anycast packet forwarding is a mechanism where multiple hosts can have same logical
address. When a packet destined to this logical address is received, it is sent to the host which
is nearest in routing topology.
Anycast routing is done with help of DNS server. Whenever an Anycast packet is received it is
enquired with DNS to where to send it. DNS provides the IP address which is the nearest IP
configured on it
Unicast Routing Protocols
There are two kinds of routing protocols available to route unicast packets:

Distance Vector Routing Protocol


Distance Vector is simple routing protocol which takes routing decision on the number of hops
between source and destination. A route with less number of hops is considered as the best
route. Every router advertises its set best routes to other routers. Ultimately, all routers build
up their network topology based on the advertisements of their peer routers,

For example Routing Information Protocol (RIP).

Link State Routing Protocol


Link State protocol is slightly complicated protocol than Distance Vector. It takes into account
the states of links of all the routers in a network. This technique helps routes build a common
graph of the entire network. All routers then calculate their best path for routing purposes.for
example, Open Shortest Path First (OSPF) and Intermediate System to Intermediate System
(ISIS).
Multicast Routing Protocols
Unicast routing protocols use graphs while Multicast routing protocols use trees, i.e. spanning
tree to avoid loops. The optimal tree is called shortest path spanning tree.

1. DVMRP - Distance Vector Multicast Routing Protocol

2. MOSPF - Multicast Open Shortest Path First

3. CBT - Core Based Tree

4. PIM - Protocol independent Multicast

Protocol Independent Multicast is commonly used now. It has two flavors:

5. PIM Dense Mode


This mode uses source-based trees. It is used in dense environment such as LAN.

6. PIM Sparse Mode


This mode uses shared trees. It is used in sparse environment such as WAN.
Network Layer Routing
When a device has multiple paths to reach a destination, it always selects one path by
preferring it over others. This selection process is termed as Routing. Routing is done by
special network devices called routers or it can be done by means of software processes.The
software based routers have limited functionality and limited scope.

A router is always configured with some default route. A default route tells the router where
to forward a packet if there is no route found for specific destination. In case there are
multiple path existing to reach the same destination, router can make decision based on the
following information:

1. Hop Count

2. Bandwidth

3. Metric

4. Prefix-length

5. Delay

Routes can be statically configured or dynamically learnt. One route can be configured to be
preferred over others.
Routing Algorithms
Flooding
Flooding is simplest method packet forwarding. When a packet is received, the routers send
it to all the interfaces except the one on which it was received. This creates too much burden
on the network and lots of duplicate packets wandering in the network.
Time to Live (TTL) can be used to avoid infinite looping of packets. There exists another
approach for flooding, which is called Selective Flooding to reduce the overhead on the
network. In this method, the router does not flood out on all the interfaces, but selective
ones.

Shortest Path
Routing decision in networks, are mostly taken on the basis of cost between source and
destination. Hop count plays major role here. Shortest path is a technique which uses
various algorithms to decide a path with minimum number of hops.

Common shortest path algorithms are:

1. Dijkstra's algorithm

2. Bellman Ford algorithm

3. Floyd Warshall algorithm


Internetworking
In real world scenario, networks under same administration are generally scattered
geographically. There may exist requirement of connecting two different networks
of same kind as well as of different kinds. Routing between two networks is called
internetworking.

Networks can be considered different based on various parameters such as,


Protocol, topology, Layer-2 network and addressing scheme.

In internetworking, routers have knowledge of each other’s address and addresses


beyond them. They can be statically configured go on different network or they can
learn by using internetworking routing protocol.

Routing protocols which are used within an organization or administration are


called Interior Gateway Protocols or IGP. RIP, OSPF are examples of IGP. Routing
between different organizations or administrations may have Exterior Gateway
Protocol, and there is only one EGP i.e. Border Gateway Protocol
Internetworking
Tunneling
If they are two geographically separate networks, which want to communicate with
each other, they may deploy a dedicated line between or they have to pass their
data through intermediate networks.

Tunneling is a mechanism by which two or more same networks communicate with


each other, by passing intermediate networking complexities. Tunneling is
configured at both ends.

When the data enters from one end of Tunnel, it is tagged. This tagged data is then
routed inside the intermediate or transit network to reach the other end of Tunnel.
When data exists the Tunnel its tag is removed and delivered to the other part of
the network.

Both ends seem as if they are directly connected and tagging makes data travel
through transit network without any modifications
Tunneling
Network Layer Protocol
ARP protocol

While communicating, a host needs Layer-2 (MAC) address of the destination machine which belongs to
the same broadcast domain or network. A MAC address is physically burnt into the Network Interface
Card (NIC) of a machine and it never changes.

On the other hand, IP address on the public domain is rarely changed. If the NIC is changed in case of
some fault, the MAC address also changes. This way, for Layer-2 communication to take place, a mapping
between the two is required.

ARP Mechanism
To know the MAC address of remote host on a broadcast domain, a computer wishing to initiate
communication sends out an ARP broadcast message asking, “Who has this IP address?” Because it is a
broadcast, all hosts on the network segment (broadcast domain) receive this packet and process it. ARP
packet contains the IP address of destination host, the sending host wishes to talk to. When a host
receives an ARP packet destined to it, it replies back with its own MAC address.

Once the host gets destination MAC address, it can communicate with remote host using Layer-2 link
protocol. This MAC to IP mapping is saved into ARP cache of both sending and receiving hosts. Next time,
if they require to communicate, they can directly refer to their respective ARP cache.

Reverse ARP is a mechanism where host knows the MAC address of remote host but requires to know IP
address to communicate
References

https://en.wikipedia.org/wiki/Classful_network
TechNet – Microsoft
Classful network – Wikipedia
Question
s?
??
?
?? ??
?? ? ??
? ?
? ?
?? ? ? ?

?
? ? ? ? ?
? ???
? ? ?? ?? ????
? ?? ? ?
? ??? ? ? ? ?
? ? ?
? ? ?
? ? ? ? ?

You might also like