Internet Protocol
IPv4
The InternetProtocol (IP) is a set of rules that allows data to be sent from one
device to another across the internet.
IPv4 stands for Internet Protocol and v4 stands for Version Four (IPv4). IPv4
was the primary version brought into action for production within the ARPANET
in 1983. IP version four addresses are 32-bit integers which will be expressed in
decimal notation.
IPv4 is a connectionless protocol used for packet-switched networks.
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.
3.
IPv4
IPv4 uses 32-bitaddresses 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 multicasting, while class E addresses
are reserved for military purposes.
IPv4 uses 32-bit (4-byte) addressing, which gives 232
addresses.
IPv4 addresses are written in the dot-decimal notation, which comprises four
octets of the address expressed individually in decimal and separated by
periods, for instance, 192.168.1.5.
4.
Characteristics of IPv4
•IPv4could be a 32-Bit IP Address.
•IPv4 could be a numeric address, and its bits are separated by a dot.
•The number of header fields is twelve and the length of the header field is
twenty.
•It has Unicast, broadcast, and multicast style of addresses.
•IPv4 supports VLSM (Virtual Length Subnet Mask).
•IPv4 uses the Post Address Resolution Protocol to map to the MAC address.
•Networks ought to be designed either manually or with DHCP.
•Packet fragmentation permits from routers and causing host.
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
7.
IPv4 Datagram Header
•Timeto 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.
•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
8.
IPv4 Addressing
An IPv4address is a unique number assigned to every device that connects to
the internet or a computer network. It’s like a home address for your computer,
smartphone, or any other device, allowing it to communicate with other
devices.
•Format: An IPv4 address is written as four numbers separated by periods, like
this: 192.168.1.1. Each number can range from 0 to 255.
•The IPv4 address is divided into two parts: Network ID and Host ID.
•Purpose: The main purpose of an IPv4 address is to identify devices on a
network and ensure that data sent from one device reaches the correct
destination.
•Example: When you type a website address into your browser, your device
uses the IPv4 address to find and connect to the server where the website is
hosted.
•Host ID
9.
IPv4 Addressing
There aretwo notations in which the IP address is written,
(1) dotted decimal and (2) hexadecimal notation.
Dotted Decimal Notation
Some points to be noted about dotted decimal notation:
•The value of any segment (byte) is between 0 and 255 (both included).
•No zeroes are preceding the value in any segment (054 is wrong, 54 is
correct).
10.
IPv4 Addressing
Need ForClassful Addressing
Initially in 1980’s IP address was divided into two fixed part i.e., NID(Network
ID) = 8bit, and HID(Host ID) = 24bit. So there are 28
that is 256 total network are
created and 224
that is 16M Host per network.
There are one 256 Networks and even a small organization must buy 16M
computer(Host) to purchase one network. That’s why we need classfull
addressing.
Classful Addressing
The 32-bit IP address is divided into five sub-classes. These are given below:
•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 determines the classes of the IP address.
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
11.
IPv4 Addressing
The classfuladdressing starts with the leading bits in binary. The reason
for the leading bits was because early routers had very limited CPU power.
Looking at the first 2 bits of the address could tell the router how far it had
to read into the address to make a routing decision. That isn't the case any
longer, but that is the original "why" for classful routing.
12.
To be avalid IPv4 address, it must meet the following conditions:
1.Format:
•The IPv4 address is written as four decimal numbers separated by dots (e.g., 192.168.0.1).
•Each number in the address is an octet, corresponding to 8 bits, ranging from 0 to 255.
2.Range:
•Each of the four octets must be between 0 and 255 (inclusive).
•For example, 256.100.50.25 is invalid since 256 is out of range.
3.No Leading Zeros:
•Each octet should not have leading zeros unless it is 0.
•For example, 192.168.01.1 is invalid because 01 should be written as 1.
4.Complete Address:
•The address must contain exactly four octets.
•Example: 192.168.1 is invalid because it only contains three octets.
5.Reserved Addresses:
•Certain ranges of IP addresses are reserved for special purposes, such as private networking or multicast. These
include:
•0.0.0.0: Represents all IPv4 addresses on the local machine.
•127.0.0.0 to 127.255.255.255: Reserved for loopback (localhost).
•10.0.0.0 to 10.255.255.255, 172.16.0.0 to 172.31.255.255, 192.168.0.0 to 192.168.255.255: Reserved for
private networks.
Valid IPv4 Addressing
13.
Examples of InvalidIPv4
Addressing
Here are some examples of invalid IPv4 addresses and the reasons why they are
invalid:
300.168.1.1
192.168.256.10
192.168.1
192.168.01.1
192.168.-1.10
192.168.1.1.1
192.168.1.abc
256.300.500.600
192.168.1.
1234.23.45.22
20.111.20.10101
14.
Examples of InvalidIPv4
Addressing
Here are some examples of invalid IPv4 addresses and the reasons why they are invalid:
1.300.168.1.1
•Reason: The first octet (300) exceeds the maximum allowed value of 255.
2.192.168.256.10
•Reason: The third octet (256) exceeds the valid range of 0–255.
3.192.168.1
•Reason: The address has only three octets instead of four.
4.192.168.01.1
•Reason: The third octet (01) has a leading zero. It should be written as 1.
5.192.168.-1.10
•Reason: The third octet is negative (-1), which is not allowed.
6.192.168.1.1.1
•Reason: The address has five octets, but an IPv4 address should only have four.
7.192.168.1.abc
•Reason: The fourth octet (abc) contains non-numeric characters, which is invalid.
8.256.300.500.600
•Reason: All octets exceed the maximum valid value of 255.
9.192.168.1.
•Reason: There is an empty octet (the last one), making the address incomplete.
10.1234.23.45.22
•Reason: The first octet (1234) exceeds 255 and is more than 3 digits long.
11. 20.111.20.10101
• Reason: Binary in the last Octet
Calculation of SubnetAddress
Steps for the Calculation of SUBNET ADDRESS
1) IP address in Binary
2) MASK address in Binary
3) Bitwise AND gives SUBNET ADDRESS
18.
Calculation of SubnetAddress
(Network Address)
Example:
Given :IPAddress: 140.11.36.22, Mask: 255.255.255.0
Step 1: Convert IPAddress and Subnet Mask to Binary
IP Address (140.11.36.22): 10001100.00001011.00100100.00010110
Subnet Mask (255.255.255.0): 11111111.11111111.11111111.00000000
Step 2: Perform Bitwise AND Operation to Find Subnet Address
10001100.00001011.00100100.00010110 (IP Address)
AND
11111111.11111111.11111111.00000000 (Subnet Mask)
=
10001100.00001011.00100100.00000000 (Subnet Address)
Converting this back to decimal:
So, the subnet address is 140.11.36.0.
19.
Calculation of HOSTAddress
Steps for the Calculation of HOST Address
1) IP address in Binary
2) Invert MASK address in Binary
3) Bitwise AND gives HOST ID
20.
Calculation of HOSTAddress
Example:
Given :IPAddress: 140.11.36.22, Mask: 255.255.255.0
Steps for the Calculate Host ID
10001100.00001011.00100100.00010110 (IP Address)
AND
00000000.00000000.00000000.11111111 (Inverse of Subnet Mask)
=
00000000.00000000.00000000.00010110 (Host ID)
Converting this back to decimal:
So, the host ID is 0.0.0.22.
21.
Calculation of SubnetAddress
Steps for the Calculation of SUBNET ADDRESS
1) IP address in Binary
2) MASK address in Binary
3) Bitwise AND gives SUBNET ADDRESS
Calculation of HOST Address
Steps for the Calculation of HOST ID
1) IP address in Binary
2) Invert MASK address in Binary
3) Bitwise AND gives HOST ID
22.
Need for IPv6
Needfor IPv6:
The Main reason of IPv6 was the address depletion as the need for electronic
devices rose quickly when Internet Of Things (IOT) came into picture after
the 1980s & other reasons are related to the slowness of the process due to
some unnecessary processing, the need for new options, support for
multimedia, and the desperate need for security. IPv6 protocol responds to
the above issues using the following main changes in the protocol:
1. Large address space
An IPv6 address is 128 bits long .compared with the 32 bit address of IPv4,
this is a huge(2 raised 96 times) increases in the address space.
2. Better header format
IPv6 uses a new header format in which options are separated from the base
header and inserted, when needed, between the base header and the upper
layer data . This simplifies and speeds up the routing process because most
of the options do not need to be checked by routers.
3. New options
IPv6 has new options to allow for additional functionalities.
4. Allowance for extension
23.
IPv6 Address
IPv6 wasdeveloped by Internet Engineering Task Force (IETF) to deal with the
problem of IPv4 exhaustion. IPv6 is a 128-bits address having an address
space of 2128
, which is way bigger than IPv4. IPv6 use Hexa-Decimal format
separated by colon (:)
Components in Address
format :
1.There are 8 groups and
each group represents 2
Bytes (16-bits).
2.Each Hex-Digit is of 4 bits
(1 nibble)
3.Delimiter used – colon (:)
24.
Advantages of IPv6
1.Realtime Data Transmission : Realtime data transmission refers to the
process of transmitting data in a very fast manner or immediately. Example
: Live streaming services such as cricket matches, or other tournament that
are streamed on web exactly as soon as it happens with a maximum delay of
5-6 seconds.
2. IPv6 supports authentication: Verifying that the data received by the
receiver from the sender is exactly what the sender sent and came through
the sender only not from any third party. Example : Matching the hash value
of both the messages for verification is also done by IPv6.
3. IPv6 performs Encryption: Ipv6 can encrypt the message at network
layer even if the protocols of application layer at user level didn’t encrypt the
message which is a major advantage as it takes care of encryption.
4. Faster processing at Router: Routers are able to process data packets of
Ipv6 much faster due to smaller Base header of fixed size – 40 bytes which
helps in decreasing processing time resulting in more efficient packet
transmission. Whereas in Ipv4, we have to calculate the length of header
which lies between 20-60 bytes.
25.
Need for IPv6
5.Support for resource allocation
In IPv6,the type of service field has been removed, but two new fields , traffic
class and flow label have been added to enables the source to request special
handling of the packet . this mechanism can be used to support traffic such
as real-time audio and video.
6. Support for more security
The encryption and authentication options in IPv6 provide confidentiality and
integrity of the packet.
IPv6 Datagram Header
IPv6Fixed Header
The IPv6 header is a part of the information sent over the internet. It’s
always 40 bytes long and includes details like where data should go and
how it should get there. This helps devices talk to each other and share
information smoothly online.
Version (4-bits)
The size of this field is 4-bit. Indicates the version of the Internet Protocol,
which is always 6 for IPv6, so the bit sequence is 0110.
Traffic Class(8-bit)
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 the priority of the packet. If congestion occurs on the router then
packets with the least priority will be discarded.
As of now, only 4-bits are being used (and the 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.
28.
IPv6 Datagram Header
Priorityassignment of Congestion
controlled traffic :
Uncontrolled data traffic is mainly used for Audio/Video data. So we give
higher priority to Uncontrolled data traffic.
The source node is allowed to set the priorities but on the way, routers can
change it. Therefore, the destination should not expect the same priority
which was set by the source node.
29.
IPv6 Datagram Header
FlowLabel (20-bits)
Flow Label field is used by a 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, an intermediate router can use the source address, a 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 does 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, the source is also supposed to specify the lifetime of the flow.
Payload Length (16-bits)
It is a 16-bit (unsigned integer) field, indicates the total size of
the payload which tells routers about the amount of information a particular
packet contains in its payload.
The payload Length field includes extension headers(if any) and an upper-layer
packet. In case the length of the 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 the jumbo payload option is used in the Hop-by-Hop
30.
IPv6 Datagram Header
NextHeader (8-bits)
Next Header indicates the type of extension header(if present) immediately
following the IPv6 header. Whereas In some cases it indicates the protocols
contained within upper-layer packets, such as TCP, UDP.
Hop Limit (8-bits)
Hop Limit field is the 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 the
packet is discarded if the value decrements to 0. This is used to discard the
packets that are stuck in an infinite loop because of some routing error.
Source Address (128-bits)
Source Address is the 128-bit IPv6 address of the original source of the
packet.
Destination Address (128-bits)
The destination Address field indicates the IPv6 address of the final
destination(in most cases). All the intermediate nodes can use this
31.
IPv6 Address Format
Thefollowing are examples of valid IPv6 (normal) addresses
2001:db8:3333:4444:CCCC:DDDD:EEEE:FFFF
:2001:db8:3333:4444:5555:6666:7777:8888
:: (implies all 8 segments are zero)
2001:db8:: (implies that the last six segments are zero)
::1234:5678 (implies that the first six segments are zero)
2001:db8::1234:5678 (implies that the middle four segments are zero)
2001:0db8:0001:0000:0000:0ab9:C0A8:0102
(This can be compressed to eliminate leading zeros, as follows:
2001:db8:1::ab9:C0A8:102 )
32.
Transition from IPv4to IPv6
Address
In the current scenario, the IPv4 address is exhausted and IPv6 had come to
overcome the limit.
Various organization is currently working with IPv4 technology and in one day
we can’t switch directly from IPv4 to IPv6. Instead of only using IPv6, we use
combination of both and transition means not replacing IPv4 but co-existing of
both.
When we want to send a request from an IPv4 address to an IPv6 address, but
it isn’t possible because IPv4 and IPv6 transition is not compatible.
33.
Distance Vector Routing
Algorithm
DistanceVector Routing (DVR) Protocol is a method used by routers to find the best
path for data to travel across a network. Each router keeps a table that shows the
shortest distance to every other router, based on the number of hops (or steps) needed
to reach them. Routers share this information with their neighbors, allowing them to
update their tables and find the most efficient routes. This protocol helps ensure that
data moves quickly and smoothly through the network.
The protocol requires that a router inform its neighbors of topology changes
periodically. Historically known as the old ARPANET routing algorithm (or known as
the Bellman-Ford algorithm).
Bellman-Ford Basics
Each router maintains a Distance Vector table containing the distance between itself
and All possible destination nodes. Distances, based on a chosen metric, are computed
using information from the neighbors’ distance vectors.
34.
Distance Vector Routing
Algorithm
•Arouter transmits its distance vector to each of its neighbors in a routing
packet.
•Each router receives and saves the most recently received distance vector from
each of its neighbors.
•A router recalculates its distance vector when:
• It receives a distance vector from a neighbor containing different
information than before.
• It discovers that a link to a neighbor has gone down.
Link State RoutingAlgorithm
Phase 1: Reliable Flooding
Each node knows the cost of its neighbour
Each node knows the entire graph
Phase 2: Route Calculation
Each node uses Dijkstra’s algorithm to calculate the optimal
path.
37.
Link State RoutingAlgorithm-
Example
For the given graph, compute routing using link-state routing algorithm
38.
Internet Control Message
Protocol(ICMP)
Internet Control Message Protocol is known as ICMP. The protocol is at the
network layer. It is mostly utilized on network equipment like routers and is
utilized for error handling at the network layer. Since there are various kinds
of network layer faults, ICMP can be utilized to report and troubleshoot these
errors.
Since IP does not have an inbuilt mechanism for sending error and control
messages. It depends on Internet Control Message Protocol(ICMP) to
provide error control.
Border Gateway Protocol(BGP)
Border Gateway Protocol (BGP) is a standardized set of rules that helps the
internet to determine the best routes for data transmission. It's used to
exchange routing information between autonomous systems (AS) on the
internet, and is the most scalable routing protocol.
How it works
BGP works by allowing ASes to
connect to neighboring ASes to
share routing
information. Internal routers
then forward outbound
transmissions to the AS, which
uses BGP to send them to their
destinations.
An autonomous system (AS) is a collection
of networks that are managed by a single
organization and have a single routing policy
41.
Protocol Independent Multicast
(PIM)
ProtocolIndependent Multicast (PIM) is a collection of protocols that help
deliver IP multicast data efficiently over a network. PIM is used to send traffic
from a single source to multiple destinations across a network.
How it works
PIM uses unicast
routing information to
perform multicast
forwarding, instead of
building its own
multicast routing table.