Introduction to IP Addresses
What is IP Address?
An IP address, or Internet Protocol address, is a unique numerical label assigned to each device
that is part of a computer network using the Internet Protocol for communication.
IP addresses play a fundamental role in enabling data transmission and routing on the internet.
Purpose:
IP addresses are used for two primary purposes:
1) Host Identification: They identify a specific device or host on a network, much like a postal
address identifies a physical location.
2) Routing: They facilitate the routing of data packets between devices on a network or across
the internet. Routers use IP addresses to determine where to forward data packets.
Versions:
There are two main versions of IP addresses:
IPv4 (Internet Protocol version 4): This is the older and more widely used version.
• IPv4 addresses consist of four groups of numbers separated by periods, and they have a limited
address space (allows for approximately 4.3 billion unique addresses).
• IP addresses are typically represented as a series of four decimal numbers separated by periods
(e.g., [Link]).
• These decimal numbers are actually 32-bit binary numbers, but they are more commonly
represented in decimal for human readability.
• The 32 bits are divided into two parts: the network portion and the host portion. The division is
determined by the subnet mask.
• IPv4 is the most widely used version of IP.
• The scarcity of IPv4 addresses is a significant issue, leading to the adoption of IPv6.
IPv6 (Internet Protocol version 6): IPv6 was introduced to address the exhaustion of IPv4
addresses and to accommodate the growing number of internet-connected devices.
• It provides a vastly larger address space and uses hexadecimal notation.
• IPv6 is the newer version of IP.
• It uses a 128-bit address, providing an almost limitless number of unique addresses.
• The address format is hexadecimal with colons (e.g.,
[Link]).
Public and Private IP Addresses:
IP addresses can be categorized as public or private:
Public IP Addresses: These are unique on a global scale and are used to identify devices
on the public internet.
Private IP Addresses: These are used within local networks, like your home or office,
and are not directly accessible from the internet.
• They are used to route data within a local network, and Network Address Translation
(NAT) is often used to translate between private and public IP addresses when data is
sent out to the internet.
Dynamic and Static IP Addresses
Dynamic IP Addresses: These are assigned by a Dynamic Host Configuration Protocol (DHCP)
server and can change over time. They are common in home networks and among internet service
providers.
Static IP Addresses: These are manually configured and remain fixed.
• They are often used for servers, routers, or other devices that need a consistent address.
Subnet Masks
• A subnet mask is a 32-bit number that separates the network portion from the host portion of
an IP address.
• It is represented in the same format as IP addresses, using decimal numbers.
• Subnet masks contain ones for network bits and zeros for host bits.
P Address Classes (IPv4)
• IPv4 addresses are divided into five classes: A, B, C, D, and E.
Class A:
Addresses range from [Link] to [Link]
Example: [Link].
Default subnet mask: [Link] (or /8 in CIDR notation).
Class B:
Addresses range from [Link] to [Link]
Example: [Link].
Default subnet mask: [Link] (or /16 in CIDR notation).
Class C:
Addresses range from [Link] to [Link]
Example: [Link].
Default subnet mask: [Link] (or /24 in CIDR notation).
Class D
Class D IP addresses fall within the range of [Link] to [Link].
• For example, an IP address like [Link] could be used for multicast communication within a
local network.
• Reserved for multicast addresses.
• Class D addresses are not used for general host addressing and are not routable on the public
internet.
• They are intended for use within local or private networks and are typically not seen on the
global internet.
Class E:
• Class E IP addresses are in the range of [Link] to [Link].
• Reserved for experimental purposes.
Subnetting
Subnetting is the process of dividing a larger network into smaller, more manageable
subnetworks or subnets.
It is commonly used in IP networking, particularly with IPv4, to efficiently allocate IP
addresses and manage network resources.
Subnetting provides several benefits, including improved network performance, security,
and organization.
Here's a basic overview of subnetting:
IP Addresses: In IPv4, IP addresses are typically written in the format [Link],
where each "xxx" represents an octet (8 bits) of the IP address.
• An IP address consists of a network portion and a host portion.
Subnet Mask: A subnet mask is used to define the boundary between the network and
host portions of an IP address. It consists of a series of binary 1s (representing the network
portion) followed by binary 0s (representing the host portion).
• Common subnet masks are expressed in CIDR notation, such as /24, /16, or /8.
Subnetting:
To subnet a network, you borrow bits from the host portion of the IP address and allocate
them for subnetting.
This creates multiple subnets within the original network, each with its own range of host
addresses.
Here are the key steps for subnetting:
Determine the IP address and subnet mask: You'll need to start with an IP address and its
associated subnet mask. For example, let's use the IP address [Link] and a default
subnet mask of [Link] (or /24 in CIDR notation).
Convert the subnet mask to binary: In our example, the binary representation of
[Link] is 11111111.11111111.11111111.00000000.
Determine the number of bits to borrow: This depends on the number of subnets and hosts
you need.
The formula to calculate the number of subnets (S) and the number of hosts per subnet (H) is:
S = 2^(number of borrowed/subnet bits)
H = 2^(number of remaining bits) - 2
Note that you subtract 2 from the host calculation because the all-0s and all-1s host addresses are
reserved for network and broadcast addresses.
Choose a subnet mask: Determine how many bits to borrow for the subnets and how many
bits will remain for the hosts. For example, if you need 8 subnets and each subnet should have
30 hosts, you'll need to borrow 3 bits for subnets (2^3 = 8) and leave 5 bits for hosts (2^5 - 2 =
30).
So, your new subnet mask will be [Link] in decimal notation (or /27 in CIDR notation).
In binary, this is 11111111.11111111.11111111.11100000.
Calculate the new subnet ranges: To create subnets, increase the subnet portion of the IP
address in increments of the subnet size. In our example, you can start with
[Link]/27, then [Link]/27, [Link]/27, and so on.
Determine the valid host IP ranges: Each subnet will have a range of valid host IP
addresses. In our example, each subnet will have 30 valid host addresses. You can
calculate the valid host ranges by excluding the network and broadcast addresses:
Network address: [Link]
First valid host: [Link]
...
Last valid host: [Link]
Broadcast address: [Link]
Question) Given
IP Address: [Link]
Default Subnet Mask: [Link] (or /24 in CIDR notation)
Create subnets with 4 subnets and 30 hosts in each subnet.
Here are the steps:
Convert the default subnet mask to binary:
Default Subnet Mask: [Link]
Binary: 11111111.11111111.11111111.00000000
Determine the number of bits to borrow:
We need 4 subnets, which can be represented by 2 bits (2^2 = 4), and each subnet should
have 30 hosts, which can be represented by 5 bits (2^5 - 2 = 30, subtracting 2 for network
and broadcast addresses).
Choose the new subnet mask:
We will borrow 2 bits for subnets and leave 5 bits for hosts.
This results in a subnet mask of /27.
New Subnet Mask: [Link] (or /27 in CIDR notation)
Binary: 11111111.11111111.11111111.11100000
Calculate the new subnet ranges:
• To create the subnets, we'll increment the subnet portion of the IP address in multiples of the
subnet size.
• The subnet size in this case is 2^5, which is 32.
• Starting from the original IP address, we can create the following subnets:
Subnet 1: [Link]/27
Subnet 2: [Link]/27
Subnet 3: [Link]/27
Subnet 4: [Link]/27
Determine the valid host IP ranges:
• For each subnet, you can determine the valid host IP ranges by excluding the network and
broadcast addresses:
Subnet 1 ([Link]/27):
• Network address: [Link]
• First valid host: [Link]
• Last valid host: [Link]
• Broadcast address: [Link]
Subnet 2 ([Link]/27):
• Network address: [Link]
• First valid host: [Link]
• Last valid host: [Link]
• Broadcast address: [Link]
Repeat the same process for Subnets 3 and 4.