IP Addressing 2023
IP Addressing 2023
They are expressed in the form of four pairs - an example address might be 255.255.255.255
wherein each set can range from 0 to 255.
IP addresses are not produced randomly. They are generated mathematically and are further
assigned by the IANA (Internet Assigned Numbers Authority), a department of the ICANN.
ICANN stands for Internet Corporation for Assigned Names and Numbers. It is a non-profit
corporation founded in the US back in 1998 with an aim to manage Internet security and
enable it to be available by all.
IPv4-32 bit logical address divided into 4 octets
The number of networks and the number of hosts per class can be derived by this formula −
NOTE: When calculating hosts' IP addresses, 2 IP addresses are decreased because they cannot be assigned to
hosts, i.e. the first IP of a network is network number and the last IP is reserved for Broadcast IP.
Representation of 8 Bit Octet
Now, we will see how to obtain the binary representation of the above IP address, i.e., 66.94.29.13
To obtain 66, we put 1 under 64 and 2 as the sum of 64 and 2 is equal to 66 (64+2=66), and the remaining bits will
be zero, as shown above. Therefore, the binary bit version of 66 is 01000010.
Step 3: The next number is 29.
To obtain 29, we put 1 under 16, 8, 4, and 1 as the sum of these numbers is equal to 29, and the remaining
bits will be zero. Therefore, the binary bit version of 29 is 00011101.
Class A :
In a class A address, the first bit of the first octet is always ‘0’. Thus, class A addresses range from 0.0.0.0 to
127.255.255.255(as 01111111 in binary converts to 127 in decimal).
The first 8 bits or the first octet denote the network portion and the rest 24 bits or the 3 octets belong to the
host portion. Its Subnet mask is 255.0.0.0.
Example: 10.1.1.1
NOTE:
The default subnet mask for Class A IP address is 255.0.0.0 which implies that Class A
addressing can have 126 networks (27-2) and 16777214 hosts (224-2).
0NNNNNNN.HHHHHHHH.HHHHHHHH.HHHHHHHH
8 bits reserved for network id and 24 bits are reserved for host id.
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.
10NNNNNN.NNNNNNNN.HHHHHHHH.HHHHHHHH
Class C Address
The first octet of Class C IP address has its first 3 bits set to 110, that is −
Class C gives 2097152 (221) Network addresses and 254 (28-2) Host addresses.
Class D is reserved for Multicasting. In multicasting data is not destined for a particular host, that is why there is
no need to extract host address from the IP address, and Class D does not have any subnet mask.
Class E Address
This IP Class is reserved for experimental purposes only for R&D or Study.
Like Class D, this class too is not equipped with any subnet mask.
Important Points
For any given IP Address,
•If the range of first octet is [1, 126], then IP Address belongs to class A.
•If the range of first octet is [128, 191], then IP Address belongs to class B.
•If the range of first octet is [192, 223], then IP Address belongs to class C.
•If the range of first octet is [224, 239], then IP Address belongs to class D.
•If the range of first octet is [240, 254], then IP Address belongs to class E.
For any given IP Address,
•IP Address of its network is obtained by setting all its Host ID part bits to 0.
•Direct Broadcast Address is obtained by setting all its Host ID part bits to 1.
• limited Broadcast Address is obtained by setting all its bits to 1.
•For any network, its limited broadcast address is always 255.255.255.255
Class D IP Addresses are not divided into Net ID and Host ID parts.
Class E IP Addresses are not divided into Net ID and Host ID parts.
For all Class A address subnet mask is: 255.0.0.0 (set first octet bits to 1 reserved for net id)
For all Class B address subnet mask is: 255.255.0.0 (set first two octet bits to 1 reserved for net id)
•For all Class C address subnet mask is: 255.255.255.0 (set first three octet bits to 1 reserved for net id)
Class B : Class C :
In a class B address, the first octet would always start In a class C address, the first octet would
with ’10’. always start with ‘110’.
Thus, class B addresses range from 128.0.0.0 to
191.255.255.255. Thus, class C addresses range from
192.0.0.0 to 223.255.255.255.
The first 16 bits or the first two octets denote the
network portion and the remaining 16 bits or two octets The first 24 bits or the first three octets
belong to the host portion. denote the network portion and the rest 8
bits or the remaining one octet belong to
Its Subnet mask is 255.255.0.0. the host portion.
Its Subnet mask is 255.255.255.0.
Class D :
Class D is used for multicast addressing and in a class D Class E :
address the first octet would always start with ‘1110’. Class E addresses are reserved for research
purposes and future use. The first octet in a
Thus, class D addresses range from 224.0.0.0 to class E address starts with ‘1111’.
239.255.255.255.
Thus, class E addresses range from 240.0.0.0
Its Subnet mask is not defined. to 255.255.255.255.
Class D addresses are used by routing protocols like Its Subnet mask is not defined.
OSPF, RIP, etc
PRACTICE PROBLEMS BASED ON IP ADDRESS IN NETWORKING-
Q1. For the following IP Addresses-
1.1.2.3.4
2.10.15.20.60
3.130.1.2.3
4.150.0.150.150
5.200.1.10.100
6.220.15.1.10
7.250.0.1.2
8.300.1.2.3
Identify the Class, Network IP Address, Direct broadcast address and Limited broadcast address of each IP Address.
Solution-
Que 3: A host with IP Address 10.100.100.100 wants to use loop back testing. What will be-
Source IP Address
Destination IP Address
Solution-
Solution- Column-I:
Given IP Address belongs to class A.
Thus, I. 200.10.192.100
II. 7.10.230.1
Number of bits reserved for Network ID = 8 III. 128.1.1.254
Number of bits reserved for Host ID = 24 IV. 255.255.255.255
V. 100.255.255.255
Que 5. What is the network ID of the IP Address
230.100.123.70? Column-II:
Solution-
A. Class A
Given IP Address belongs to class D. B. Limited Broadcast Address
Class D IP Addresses are not divided into the Network ID and C. Direct Broadcast Address
Host ID parts. D. Class C
Thus, there is no network ID for the given IP Address. E. Class B
Solution:
(I, D), (II, A), (III, E), (IV, B), (V, C)
Que 8. Suppose that instead of using 16 bits for network part of a class B Address, 20 bits have been used.
Solution-
Solution-
2. It is used to communicate within the network. It is used to communicate outside the network.
Range:
8. 10.0.0.0 – 10.255.255.255, 172.16.0.0 – 172.31.255.255, Range: Besides private IP addresses, the rest are public.
192.168.0.0 – 192.168.255.255
Private IP uses numeric code that is not unique and can be Public IP uses a numeric code that is unique and cannot be used by
9. used again other
10. Private IP addresses are secure Public IP address has no security and is subjected to attack
Drawbacks of IPv4
Currently, the population of the world is 7.6 billion. Every user
is having more than one device connected with the internet, and
private companies also rely on the internet. As we know that
IPv4 produces 4 billion addresses, which are not enough for
each device connected to the internet on a planet.
Answer: a
Explanation: There is no concept of broadcast address in IPv6. Instead, there is an anycast address in IPv6 which
allows sending messages to a group of devices but not all devices in a network. Anycast address is not
standardized in IPv4.
Answer: b
Explanation: An IPv6 address is 128 bits long. Therefore, 2128 i.e. 340 undecillion addresses are possible in
IPv6. IPv4 has only 4 billion possible addresses and IPv6 would be a brilliant alternative in case IPv4 runs out of
possible new addresses.
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.
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 CIDR was introduced.
Why CIDR is used?
The problem with this classful addressing method is that millions of class A addresses
are wasted, many of the class B addresses are wasted, whereas, number of addresses
available in class C is so small that it cannot cater to 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).
Loopback Address is used to let a system send a message to itself to make sure that the
TCP/IP stack is installed correctly on the machine.
CIDR(Classless Inter-Domain Routing or supernetting)
No concept of classes
Here we can provide as many block of addresses to the user which he
requested so NO wastage of IP addresses.
Here IPv4 (32 bit address) consist of Block ID and Host Id but no classes
Notation: x.y.z.w/n
Here n represent the mask(no. of 1’s) or no of bits for the block or network.
Example: 200.10.20.40/28 (28 no of 1’s) therfore net id is of 28 bits and
host id is of 4 bits
Total no of host in this network=24
Now to find network Id: 28 bits of 1’s
11111111. 11111111. 11111111. 11110000 (default mask)
255.255.255.240
200.10.20.40/28
200.10.20.00101000 Keep network intact and make remaining 4 host
bits to zero
200.10.20.00100000 200.10.20.32/28 (network Id or block id of given IP
Difference between Classful Addressing and Classless Addressing
Sr. No. Parameter Classful Addressing Classless Addressing
1. Basics In Classful addressing IP addresses are allocated according Classless addressing came to replace the classful addressing and to
to the classes- A to E. handle the issue of rapid exhaustion of IP addresses.
3. Network ID and The changes in the Network ID and Host ID depend on the There is no such restriction of class in classless addressing.
Host ID class.
4. VLSM It does not support the Variable Length Subnet Mask It supports the Variable Length Subnet Mask (VLSM).
(VLSM).
Classful addressing requires more bandwidth. As a result, it It requires less bandwidth. Thus, fast and less expensive as compared to
5. Bandwidth becomes slower and more expensive as compared to classful addressing.
classless addressing.
6. CIDR It does not support Classless Inter-Domain Routing (CIDR). It supports Classless Inter-Domain Routing (CIDR).
IPv4 has a 32-bit address length IPv6 has a 128-bit address length
It supports Auto and renumbering address
It Supports Manual and DHCP address configuration
configuration
In IPv4 end to end, connection integrity is Unachievable In IPv6 end to end, connection integrity is Achievable
Address space of IPv6 is quite large it can produce
It can generate 4.29×109 address space
3.4×1038 address space
IPSEC is an inbuilt security feature in the IPv6
The Security feature is dependent on application
protocol
Address representation of IPv4 is in decimal Address Representation of IPv6 is in hexadecimal
Fragmentation performed by Sender and forwarding
In IPv6 fragmentation performed only by the sender
routers
In IPv6 packet flow identification are Available and
In IPv4 Packet flow identification is not available
uses the flow label field in the header
In IPv4 checksum field is available In IPv6 checksum field is not available
In IPv6 multicast and anycast message transmission
It has broadcast Message Transmission Scheme
scheme is available
IPv4 IPv6
In IPv4 Encryption and Authentication facility not In IPv6 Encryption and Authentication are provided
provided
IPv6 has header of 40 bytes fixed
IPv4 has a header of 20-60 bytes.
IPv4 can be converted to IPv6 Not all IPv6 can be converted to IPv4
IPv6 consist of 8 fields, which are separated by colon
IPv4 consist of 4 fields which are separated by dot (.)
(:)
IPv4’s IP addresses are divided into five different
IPv6 does not have any classes of IP address.
classes. Class A , Class B, Class C , Class D , Class E.
IPv4 supports VLSM(Variable Length subnet mask). IPv6 does not support VLSM.
Example of IPv6:
Example of IPv4: 66.94.29.13
2001:0000:3238:DFE1:0063:0000:0000:FEFB
In networking,
Subnetting in Networking-
•The process of dividing a single network into multiple sub networks is called as subnetting.
•The sub networks so created are called as subnets.
Following diagram shows the subnetting of a big single network into 4 smaller subnets-
Subnetting in Networking-
Advantages-
Subnet ID-
•Each subnet has its unique network address known as its Subnet ID.
•The subnet ID is created by borrowing some bits from the Host ID part of the IP
Address.
•The number of bits borrowed depends on the number of subnets created.
Types of Subnetting-
Subnetting of a network may be carried out in the following two ways-
Fixed length subnetting also called as classful subnetting divides the network into
subnets where-
•All the subnets are of same size.
•All the subnets have equal number of hosts.
•All the subnets have same subnet mask.
2. Variable Length Subnetting-
Variable length subnetting also called as classless subnetting divides the network into
subnets where-
•All the subnets are not of same size.
•All the subnets do not have equal number of hosts.
•All the subnets do not have same subnet mask.
Subnetting
Consider-
•We have a big single network having IP Address 200.1.2.0.
•We want to do subnetting and divide this network into 2
subnets.
So,
•We borrow two bits from the Host ID part.
•After borrowing two bits, Host ID part remains
with only 6 bits.
•If borrowed bits = 00, then it represents the 1st subnet.
•If borrowed bits = 01, then it represents the 2nd subnet.
•If borrowed bits = 10, then it represents the 3rd subnet.
•If borrowed bits = 11, then it represents the 4th subnet .
IP Address of the four subnets are-
•200.1.2.00000000 = 200.1.2.0
•200.1.2.01000000 = 200.1.2.64
•200.1.2.10000000 = 200.1.2.128
•200.1.2.11000000 = 200.1.2.192
1.Subnet Address
2.First Host ID
3.Last Host ID
4.Broadcast Address
Solution-