IPv4 Addresses
IPv4 Addresses
An IPv4 address is a 32-bit address used at the network layer of the TCP/IP protocol suite to identify the connection of a device—such as a host or router—to the Internet.
A very important point is:
An IP address identifies the connection to the Internet, not the physical device itself.
For example, if a computer is moved from one network to another, its IP address may change because its network connection has changed.
1. IPv4 Address is 32 Bits
An IPv4 address consists of 32 bits.
These 32 bits are divided into four groups of 8 bits, called octets or bytes.
For example:
10000000 00001011 00000011 00011111 8 8 8 8 = 32 bits
Each octet can have a value from 0 to 255.
2. Address Space
The address space is the total number of addresses that can be represented by an addressing scheme.
If an address contains b bits, then:
For IPv4:
So IPv4 theoretically provides more than 4 billion possible addresses.
3. IPv4 Address Notations
IPv4 addresses can be represented in different forms. The following are the three important notations.
A. Binary Notation
The address is represented directly as 32 bits.
Example:
10000000 00001011 00000011 00011111
The spaces separate the four 8-bit octets to make the address easier to read.
B. Dotted-Decimal Notation
This is the most commonly used representation of an IPv4 address.
Each 8-bit octet is converted to decimal, and the four values are separated by dots.
For example:
Binary: 10000000 00001011 00000011 00011111 Dotted decimal: 128.11.3.31
Since each octet contains 8 bits, its value can range from:
0 to 255
Therefore, an IPv4 address has the general form:
0–255 . 0–255 . 0–255 . 0–255
For example:
192.168.1.10
C. Hexadecimal Notation
Each hexadecimal digit represents 4 bits.
Since IPv4 contains 32 bits:
Therefore, an IPv4 address can be represented using 8 hexadecimal digits.
For example:
Binary: 10000000 00001011 00000011 00011111 Hexadecimal: 800B031F
This notation is often useful in network programming.
4. Hierarchical Addressing
IPv4 addressing is hierarchical.
The idea is similar to a postal address.
For example:
Country → State → City → Street → House
Similarly, an IPv4 address is divided into two logical parts:
┌─────────────────────┬─────────────────────┐ │ Prefix │ Suffix │ │ Network │ Node │ └─────────────────────┴─────────────────────┘
Prefix
The prefix identifies the network.
Suffix
The suffix identifies the node, or the connection of a particular device to that network.
If the prefix contains n bits, then the suffix contains:
bits.
Therefore:
5. Why Hierarchical Addressing is Useful
Suppose a router receives a packet destined for a particular IP address.
The router can first determine which network the destination belongs to using the network portion of the address.
Then the remaining portion identifies the particular node within that network.
This hierarchical structure makes addressing and routing more manageable.
6. Classful and Classless Addressing
There are two approaches to dividing an IPv4 address into prefix and suffix.
Classful Addressing
Originally, IPv4 used a fixed-length network prefix.
This approach is called classful addressing.
The prefix length was determined by the address class.
Note that classful addressing is now obsolete.
Classless Addressing
The newer approach is called classless addressing.
Here, the network prefix has a variable length.
IPv4 Address ┌─────────────────────────┬───────────────┐ │ Variable-length Prefix │ Suffix │ │ Network │ Node │ └─────────────────────────┴───────────────┘
Classless addressing is the approach used for modern IPv4 addressing.
We will study this in detail later.
7. Summary
| Concept | Key Point |
|---|---|
| IPv4 address | 32-bit address |
| Purpose | Identifies a device's connection to the Internet |
| Address space | |
| Octet | 8 bits |
| Dotted decimal | Four decimal numbers separated by dots |
| Range of each octet | 0–255 |
| Prefix | Identifies the network |
| Suffix | Identifies the node/connection |
| Classful addressing | Fixed-length prefix; obsolete |
| Classless addressing | Variable-length prefix; modern approach |
Simple example
Consider:
192.168.1.25
Conceptually, it can be viewed as:
┌──────────────────┬──────────┐ │ Network Prefix │ Suffix │ └──────────────────┴──────────┘ Network Node
The exact boundary between prefix and suffix is determined by the prefix length (subnet mask/CIDR prefix). Thus, an IPv4 address by itself does not tell us where the network portion ends; the prefix length is also needed.
IPv4 uses 32-bit hierarchical addresses. The address identifies a device's connection to a network and is divided into a network prefix and a node suffix. IPv4 addresses can be written in binary, dotted-decimal, or hexadecimal notation, and the modern addressing approach uses variable-length prefixes (classless addressing).
Comments
Post a Comment