Unit-4
Unit-4
Prepared By:
Mr. Shaktisinh S. Parmar (Lecturer)
Department of Computer Engineering, C.U.S.P., Surendranagar
1
LEARNING OUTCOME(S) (LOs) OF THIS UNIT
Students are able to:
• Describe IP v4 and IP v6 protocol.
• Illustrate subnet and usage of subnet masking.
• Differentiate IPv4 and IPv6.
2
IP Protocol
• The Internet Protocol (IP) is the principal communications protocol in the
Internet protocol suite for transferring datagrams across network boundaries.
• Its routing function enables internetworking, and essentially establishes
the Internet.
• IP has the task of delivering packets from the source host to the
destination host based on the IP addresses in the packet headers.
• IP defines packet structures that encapsulate the data to be delivered.
• It also defines addressing methods that are used to label the datagram with
source and destination information.
• The first major version of IP, Internet Protocol Version 4 (IPv4), is the dominant
protocol of the Internet. Its successor is Internet Protocol Version 6 (IPv6).
• IPv4
• IPv6
3
IP PROTOCOL VERSION 4
• Internet Protocol version 4 (IPv4) is the fourth version of the
Internet Protocol (IP).
• It is one of the core protocols of standards-based internetworking
methods in the Internet, and was the first version deployed for
production in the ARPANET in 1983.
• IPv4 is a connectionless protocol for use on packet- switched
networks.
• It does not provide error control and flow control.
• It is unreliable protocol.
• IP version four addresses are 32-bit integers which will be expressed
in decimal notation.
• Example- 192.0.2.126 could be an IPv4 address.
Parts of IPv4
• Network part:
• The network part indicates the distinctive variety that’s appointed to the
network. The network part conjointly identifies the category of the network
that’s assigned.
• Host Part:
• The host part uniquely identifies the machine on your network. This part of the
IPv4 address is assigned to every host.
• For each host on the network, the network part is the same, however, the host
part must vary.
• Subnet number:
• It is an optional part of the IP address. It is the partition of an IP address into
many smaller segments. It helps interconnect networks and reduces traffic.
• Local networks that have massive numbers of hosts are divided into subnets and
subnet numbers are appointed to that.
4
5
Characteristics of IPv4
• IPv4 could be a 32-Bit IP Address.
• IPv4 could be a numeric address, and its bits are separated by a dot.
• 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.
• Routing Information Protocol(RIP) may be a routing protocol supported
by the routed daemon.
• Networks ought to be designed either manually or with DHCP.
• Packet fragmentation permits from routers and causing host.
Advantages of IPV4
• IPV4 is necessary to encrypt data to ensure privacy. It takes security
measures to encrypt data in its address packets.
• IPV4 protocol can be easily supported by most of the topology.
• Since addresses are combined more effectively the process of routing has
become more efficient in IPV4.
• Devices can easily handle IPV4 routing, which is part of the IPV4 protocol.
As a consequence, practically every major device will accept the IPV4
protocol.
• IPV4 does to great lengths to ensure that data packets arrive at their
destination. This is because the transmission control protocol employs
IPV4 variants.
• Compatible with any device. IPv4’s fundamental purpose is to connect
devices across the network. And certainly, millions of devices already
support this protocol. That makes it the easiest compatible Internet
Protocol for devices.
6
Disadvantages of IPV4
• The lack of address space - the number of different devices connected to the
Internet grows exponentially, and the size of the address space is quickly
depleted;
• Weak protocol extensibility - the insufficient size of the IPv4 header, which
does not accommodate the required number of additional parameters;
• The problem of security of communications - no means are provided to limit
access to information hosted on the network. IPv4 has never been designed for
security.
• Originally designed as an isolated military network
• Then adapted for public education and research network
• Lack of quality-of-service support - placement of information about
bandwidth, delays required for smooth operation of some network applications
are not supported;
• Geographic limitations - since the Internet was created in the USA, this country
is also involved in the distribution of IP addresses. Almost 50% of all addresses
are reserved for the United States.
7
IPv4 - Packet Structure
8
IPv4 - Packet Structure
• Version − Version no. of Internet Protocol used (e.g. IPv4).
• DSCP − Differentiated Services Code Point; this is Type of Service. Originally defined as the
Type of service (ToS) field. New technologies are emerging that require real-time data
streaming and therefore make use of the DSCP field. An example is Voice over IP (VoIP),
which is used for interactive data voice exchange.
• ECN − Explicit Congestion Notification; It carries information about the congestion seen in
the route.
• Total Length − Length of entire IP Packet (including IP header and IP Payload). This 16-bit
field defines the entire packet size, (header + data) in bytes. The minimum-length of packet
is 20 bytes and the maximum is 65,535 bytes.
9
IPv4 - Packet Structure
• Protocol − Tells the Network layer at the destination host, to which Protocol this packet
belongs to, i.e. the next level Protocol. For example, protocol number of ICMP is 1, TCP is 6
and UDP is 17.
• Header Checksum − This field is used to keep checksum value of entire header which is then
used to check if the packet is received error-free.
• Source Address − 32-bit address of the Sender (or source) of the packet.
• Destination Address − 32-bit address of the Receiver (or destination) of the packet.
• Options − This is optional field, which is used if the value of IHL is greater than 5. These
options may contain values for options such as Security, Record Route, Time Stamp, etc.
IP ADDRESSING SCHEMES
• IP Address: it is a logical address used to identify a device in a
network uniquely.
• IPv4 uses 32-bit (four-byte) addresses, which limits the address space
to 4294967296 (2^32) addresses.
• IP addressing schemes:
• Classful addressing
• Classless addressing
• IP Address Notations:
• Binary notation
• Dotted decimal notation
10
IP ADDRESS NOTATIONS
CLASSFUL ADDRESSING
• Internet Protocol hierarchy contains several classes of IP Addresses to
be used efficiently in various situations as per the requirement of hosts per
network. Broadly, the IPv4 Addressing system is divided into five classes
of IP Addresses. All the five classes are identified by the first octet of IP
Address.
• Internet Corporation for Assigned Names and Numbers is responsible for
assigning IP addresses.
• The number of networks and the number of hosts per class can be derived
by this formula −
11
CLASSFUL ADDRESSING
• The high order octet of the addresses was redefined to
create a set of classes of networks, in a system which
later became known as Classful networking.
• The system defined five classes, Class A, B, C, D, and E.
• The Classes A, B, and C had different bit lengths for
the new network identification.
• The rest of an address was used as previously to identify a
host within a network, which meant that each network
class had a different capacity to address hosts.
• Class D was allocated for multicast addressing.
• Class E was reserved for future applications.
CLASSFUL ADDRESSING
Network id Host id
12
Class A Address
• The first bit of the first octet is always set to 0 (zero). Thus, the first octet
ranges from 1 – 127, i.e.
• Class A addresses only include IP starting from 1.x.x.x to 126.x.x.x only. The
IP range 0.X.X.X is reserved for default network 127.x.x.x is reserved for
loopback IP addresses.
Class B Address
• An IP address which belongs to class B has the first two bits in the first
octet set to 10, i.e.
Class D Address
• Very first four bits of the first octet in Class D IP addresses are set to
1110, giving a range of −
14
Class E Address
• This IP Class is reserved for experimental purposes only for R&D or
Study. IP addresses in this class ranges from 240.0.0.0 to
255.255.255.254. Like Class D, this class too is not equipped with any
subnet mask.
15
Disadvantage of Classful Addressing:
• Class A with a mask of 255.0.0.0 can support 128 Network, 16,777,216
addresses per network and a total of 2,147,483,648 addresses.
• Class B with a mask of 255.255.0.0 can support 16,384 Network,
65,536 addresses per network and a total of 1,073,741,824 addresses.
• Class C with a mask of 255.255.255.0 can support 2,097,152 Network,
256 addresses per network and a total of 536,870,912 addresses.
• But what if someone requires 2000 addresses ?
• One way to address this situation would be to provide the person with class B
network. But that would result in a waste of so many addresses.
• Another possible way is to provide multiple class C networks, but that too can
cause a problem as there would be too many networks to handle.
• To resolve problems like the one mentioned above Classless Inter-
Domain Routing (CIDR) was introduced.
CIDR notation:
• In CIDR subnet masks are denoted by /X. For example, a subnet of
255.255.255.0 would be denoted by /24. To work a subnet mask in CIDR,
we have to first convert each octet into its respective binary value. For
example, if the subnet is of 255.255.255.0. then :
• First Octet – 255 has 8 binary 1's when converted to binary
• Second Octet –255 has 8 binary 1's when converted to binary
• Third Octet – 255 has 8 binary 1's when converted to binary
• Fourth Octet – 0 has 0 binary 1's when converted to binary
• Therefore, in total there are 24 binary 1’s, so the subnet mask is /24.
• While creating a network in CIDR, a person has to make sure that the
masks are contiguous, i.e. a subnet mask like 10111111.X.X.X can’t exist.
16
Difference between Classful Addressing and Classless Addressing
Sr. No. Parameter Classful Addressing Classless Addressing
In Classful addressing IP addresses are allocated according to the Classless addressing came to replace the classful addressing and to
1. Basics
classes- A to E. handle the issue of rapid exhaustion of IP addresses.
3. Network ID and Host ID The changes in the Network ID and Host ID depend on the class. There is no such restriction of class in classless addressing.
4. VLSM It does not support the Variable Length Subnet Mask (VLSM). It supports the Variable Length Subnet Mask (VLSM).
6. CIDR It does not support Classless Inter-Domain Routing (CIDR). It supports Classless Inter-Domain Routing (CIDR).
•Network
•Host
9. Division of Address •Host
•Subnet
•Subnet
17
SUBNET AND SUBNET MASKING
• Generally, we divide the network into smaller networks or subnets
which is called subnetting.
• Let’s take a class A of network. In class A, we have 224hosts. To
manage such a large number of hosts is a very difficult job. So, if we
divide this large network into the smaller network then maintaining
each network would become easy.
18
SUBNET AND SUBNET MASKING
19
SUBNET AND SUBNET MASKING
20
SUBNET AND SUBNET MASKING
• When a router receives a packet, it route a packet
based on network address or sub network address.
• Router uses masking process to extract the address
of network or subnetwork from IP address.
21
SUBNET AND SUBNET MASKING
22
SUBNET AND SUBNET MASKING
• Step 2: Determine the Number of Bits to Borrow
• The formula to calculate the number of subnets is:
• 2n ≥ Required Subnets (where n is the number of bits to borrow from the host portion.)
• 2n ≥ 6
22 = 4 (Not enough)
23 = 8 (Sufficient, as it covers at least 6 subnets)
• Borrowing 3 bits from the host portion increases the network bits to 16 + 3 = 19.
• This leaves 32 - 19 = 13 bits for hosts.
• The new subnet mask becomes /19. Now, let’s convert this to dotted-decimal notation:
23
SUBNET AND SUBNET MASKING
Step 4: Verify the Subnetting and Subnet Ranges
• The increment for subnets is determined by: 256−224=32
• Since 128.38.130.89 falls within the 128.38.128.0 – 128.38.159.255 subnet, the subnetting is valid. The network
address for this subnet is 128.38.128.0, and the broadcast address is 128.38.159.255.
Final Answer
• The subnet mask for a network with the IP address 128.38.130.89 divided
into six subnets is 255.255.224.0 (or /19).
24
Reserved IP Addresses:
• There are a few reserved IPv4 address spaces which cannot be
used on the internet. These addresses serve special purpose and
cannot be routed outside the Local Area Network.
• Classification of Reserved IP Addresses are:
• Private IP Addresses
• Link-local Addresses or Automatic Private IP Addressing
• Special IP Addresses
Private IP Addresses
25
Private IP Addresses
• Within each network class, there are designated IP address that is
reserved specifically for private/internal use only.
• This IP address cannot be used on Internet-facing devices as that are
non-routable. For example, web servers and FTP servers must use
non-private IP addresses.
• However, within your own home or business network, private IP
addresses are assigned to your devices (such as workstations, printers,
and file servers).
• Class A Private Range: 10.0.0.0 to 10.255.255.255 (Subnet Mask: 255.0.0.0)
• Class B Private Range: 172.16.0.0 to 172.31.255.255 (Subnet Mask: 255.240.0.0)
• Class C Private Range: 192.168.0.0 to 192.168.255.255 (Subnet Mask: 255.255.0.0)
26
Special IP Addresses
• IP Range: 127.0.0.1 to 127.255.255.255 are network testing
addresses (also referred to as loop-back addresses).
• These are virtual IP address, in that they cannot be assigned to a
device. Specifically, the IP 127.0.0.1 is often used to troubleshoot
network connectivity issues using the ping command.
• Specifically, it tests a computer's TCP/IP network software driver
to ensure it is working properly.
IP PROTOCOL VERSION 6
• Internet Protocol version 6 (IPv6) is the most recent version of the
Internet Protocol (IP), the communications protocol that provides
an identification and location system for computers on networks
and routes traffic across the Internet.
• IPv6 was developed by the Internet Engineering Task Force
(IETF) to deal with the long-anticipated problem of IPv4 address
exhaustion.
• IPv6 or Internet Protocol Version 6 is a network layer protocol that
allows communication to take place over the network. IPv6 was
designed by Internet Engineering Task Force (IETF) in December
1998 with the purpose of superseding the IPv4 due to the global
exponentially growing internet users.
27
IP PROTOCOL VERSION 6
• Initially, it was assumed it would never run out of addresses but
the present situation paves a new way to IPv6, let’s see why? An
IPv6 address consists of eight groups of four hexadecimal digits.
Here’s an example IPv6 address:
3001:0da8:75a3:0000:0000:8a2e:0370:7334
• This new IP address version is being deployed to fulfil the need
for more Internet addresses. It was aimed to resolve issues
which are associated with IPv4. With 128-bit address space, it
allows 340 undecillion unique address space. IPv6 also called
IPng (Internet Protocol next generation).
IP PROTOCOL VERSION 6
28
CHARACTERISTICS IP PROTOCOL VERSION 6
• Larger Address Space
• Simplified Header
• End-to-end Connectivity
• Auto-configuration
• Faster Forwarding/Routing
• IPSec
• No Broadcast
• Anycast Support
• Mobility
• Enhanced Priority Support
• Smooth Transition
• Extensibility
Advantages of IPv6
• High Reliability
• Faster Speeds: IPv6 supports multicast rather than broadcast in
IPv4.This feature allows bandwidth-intensive packet flows (like
multimedia streams) to be sent to multiple destinations all at once.
• Stronger Security: IPSecurity, which provides confidentiality, and data
integrity, is embedded into IPv6.
• Routing efficiency
• Most importantly it’s the final solution for growing nodes in Global-
network.
29
Disadvantages of IPv6
• Conversion: Due to widespread present usage of IPv4 it will take a
long period to completely shift to IPv6.
• Communication: IPv4 and IPv6 machines cannot communicate
directly with each other. They need an intermediate technology to
make that possible.
30
Compression of IPv6 address
• Rule-2: When continuous 0s (zeros) are available in IPv6 address
notation then all zeros are replaced by ::.
IPv6 = FE82:0:0:0:0:1A12:1234:1A12
After compression,
IPv6 = FE82::1A12:1234:1A12
• Rule-3: When zeros are present in discontinuous places then at only
one junction, 0s (zeros) are replaced by ::.
IPv6 = 2001:1234:0:0:1A12:0:0:1A13
After compression,
IPv6 = 2001:1234::1A12:0:0:1A13 or 2001:1234:0:0:1A12::1A13
31
Compression of IPv6 address
• Dual IPV6 Address Examples:
• The following list shows examples of valid IPv6 (Dual) addresses:
• 2001 : db8: : 123 . 123 . 123 . 123 (implies that the last four IPv6 segments are zero)
• : : 1234 : 5678 : 91 . 123 . 4 . 56 (implies that the first four IPv6 segments are zero)
• : : 1234 : 5678 : 1 . 2 . 3 . 4 (implies that the first four IPv6 segments are zero)
• 2001 : db8: : 1234 : 5678 : 5 . 6 . 7 . 8 (implies that the middle two IPv6 segments are zero)
32
Example
Example
33
ADRESSING MODES OF IP PROTOCOL VERSION 6
• Unicast addresses: In unicast mode of addressing, an IPv6 interface (host) is
uniquely identified in a network segment. The IPv6 packet contains both source
and destination IP addresses. A host interface is equipped with an IP address
which is unique in that network segment. When a network switch or a router
receives a unicast IP packet, destined to a single host, it sends out one of its
outgoing interface which connects to that particular host.
34
ADRESSING MODES OF IP PROTOCOL VERSION 6
• Anycast addresses: IPv6 has introduced a new type of addressing, which is
called Anycast addressing. In this addressing mode, multiple interfaces
(hosts) are assigned same Anycast IP address. When a host wishes to
communicate with a host equipped with an Anycast IP address, it sends a
Unicast message. With the help of complex routing mechanism, that Unicast
message is delivered to the host closest to the Sender in terms of Routing
cost.
35
ADRESSING TYPES OF IP PROTOCOL VERSION 6
• Link-Local Address: Auto-configured IPv6 address is known as Link-Local address.
This address always starts with FE80. The first 16 bits of link-local address is
always set to 1111 1110 1000 0000 (FE80). The next 48-bits are set to 0, thus:
• Link-local addresses are used for communication among IPv6 hosts on a link
(broadcast segment) only. These addresses are not routable, so a Router never
forwards these addresses outside the link.
• Prefix is always set to 1111 110. L bit, is set to 1 if the address is locally assigned. So
far, the meaning of L bit to 0 is not defined. Therefore, Unique Local IPv6 address
always starts with ‘FD’.
36
ADRESSING TYPES OF IP PROTOCOL VERSION 6
• Scope of IPv6 Unicast Addresses: The scope of Link-local address is limited to the
segment. Unique Local Address are locally global, but are not routed over the
Internet, limiting their scope to an organization’s boundary. Global Unicast
addresses are globally unique and recognizable. They shall make the essence of
Internet v2 addressing.
• As shown in the table, the address 0:0:0:0:0:0:0:0/128 does not specify anything
and is said to be an unspecified address. After simplifying, all the 0s are compacted
to ::/128.
• In IPv4, the address 0.0.0.0 with netmask 0.0.0.0 represents the default route. The
same concept is also applied to IPv6, address 0:0:0:0:0:0:0:0 with netmask all 0s
represents the default route. After applying IPv6 rule, this address is compressed to
::/0.
• Loopback addresses in IPv4 are represented by 127.0.0.1 to 127.255.255.255 series.
But in IPv6, only 0:0:0:0:0:0:0:1/128 represents the Loopback address. After
loopback address, it can be represented as ::1/128.
37
SPECIAL ADRESSES OF IP PROTOCOL VERSION 6
• IPv4-mapped address: Like the loopback address, IPv4-mapped addresses are
only used for internal representation on a host. They allow developers to use one
API for both IPv4 and IPv6 calls. The syntax of IPv4-mapped addresses looks like
this: ::FFFF:w.x.y.z, where "w.x.y.z" is the IPv4 address that is represented in the
IPv6 address.
• IPv6 multicast addresses: Like in IPv4, IPv6 multicast addresses are used to send
the same data to multiple hosts simultaneously. Since multicast-capable software,
such as OS imaging tools, typically do all the IP configuration, Windows admins
usually are not bothered with the networking details. But if you ever stumble across
an IPv6 address that begins with FF, you know what you are dealing with.
38
Difference between IPv4 and IPv6
CRITERIA IPV4 IPV6
Address length IPv4 is a 32-bit address. IPv6 is a 128-bit address.
Fields IPv4 is a numeric address that consists of 4 IPv6 is an alphanumeric address that
fields which are separated by dot (.). consists of 8 fields, which are separated by
colon.
Classes IPv4 has 5 different classes of IP address IPv6 does not contain classes of IP
that includes Class A, Class B, Class C, Class addresses.
D, and Class E.
Number of IP address IPv4 has a limited number of IP addresses. IPv6 has a large number of IP addresses.
VLSM It supports VLSM (Virtual Length Subnet It does not support VLSM.
Mask). Here, VLSM means that Ipv4
converts IP addresses into a subnet of
different sizes.
Address configuration It supports manual and DHCP It supports manual, DHCP, auto-
configuration. configuration, and renumbering.
Address space It generates 4 billion unique addresses It generates 340 undecillion unique
addresses.
Checksum field The checksum field is available in IPv4. The checksum field is not available in
IPv6.
39
Difference between IPv4 and IPv6
CRITERIA IPV4 IPV6
Transmission scheme IPv4 supports broadcasting. On the other hand, IPv6 supports
multicasting, which provides efficient
network operations.
Encryption and It does not provide encryption and It provides encryption and
Authentication authentication. authentication.
40