Kahibaro
Discord Login Register

7.1 IPv4 Fundamentals

Overview

IPv4 is the most widely used addressing system on today’s Internet. It gives every device a logical address so that data can be sent to the right destination. In this chapter you will focus on what an IPv4 address is, how it is written, what its internal structure looks like, and a few essential behaviors that are unique to IPv4.

You will not design subnets or do calculations here. Those topics belong to later chapters such as Classful Addressing, Subnet Masks, and CIDR. For now, the goal is to become comfortable reading and recognizing IPv4 addresses and understanding what they represent.

IPv4 Address Structure

An IPv4 address is a 32 bit number. A bit is a single binary digit, either 0 or 1. If you wrote an IPv4 address in pure binary it would have 32 characters, like this example:

$$11000000\ 10101000\ 00000001\ 00001010$$

Humans do not normally use this binary format. Instead IPv4 addresses are grouped into four chunks of 8 bits, called octets, and each octet is written as a decimal number between 0 and 255.

For example, the binary number above corresponds to the address:

$$192.168.1.10$$

Each octet is one byte, so an IPv4 address is 4 bytes long.

An IPv4 address is always:
• 32 bits in length
• Written as 4 decimal octets separated by dots
• Each octet ranges from 0 to 255

The total number of possible IPv4 addresses is:

$$2^{32} = 4{,}294{,}967{,}296$$

In practice, not all of these can be used directly for hosts, because some ranges are reserved for special purposes. The idea that there is a finite pool of about 4.3 billion addresses is central to why later technologies like private addressing and IPv6 exist, but those are covered in other chapters.

Dotted Decimal Notation

The most common human readable representation of an IPv4 address is called dotted decimal notation. It has these properties:

  1. Four decimal numbers.
  2. Each number corresponds to an 8 bit binary value.
  3. Dots separate the octets, there are exactly three dots.

Here are some examples:

Binary (32 bits)Dotted decimal
00001010 00000000 00000000 0000000110.0.0.1
11000000 10101000 00000000 00000001192.168.0.1
01111111 00000000 00000000 00000001127.0.0.1
00101010 00110011 00000101 1111000042.51.5.240

You will learn systematic binary to decimal conversion in a later chapter. For now, it is enough to understand that each octet is just a decimal representation of 8 bits.

When you see something like “IP: 192.168.1.1” in a configuration or a screenshot, that is dotted decimal notation for an IPv4 address.

Network and Host Portions

Logically, an IPv4 address has two parts:

  1. A network part that identifies which network the device belongs to.
  2. A host part that identifies the specific device within that network.

An analogy is a street address. The network part is similar to the street name, and the host part is similar to the house number. Two houses on different streets can both be number 10, because the street names are different. In the same way, two devices in different IP networks can have the same host part, but they remain unique when combined with their network parts.

In IPv4, where the boundary sits between network and host is not fixed. You will use subnet masks and CIDR notation to define that boundary in later chapters. At this stage just remember that:

Routers mainly care about the network part, because it tells them where to send traffic. Devices on the same network care about the host part, because that is how they distinguish each other.

Special Host Values: Network and Broadcast

Within any IPv4 network, two special host values are reserved:

  1. The all zeros host value.
  2. The all ones host value.

These are not used for individual devices. Instead they represent special addresses for the network itself and for broadcast traffic.

In a particular network:

You will calculate these addresses in detail when you learn about subnet masks and subnetting. For now you only need the idea that in each IPv4 network the first and last addresses in the range are reserved and are not assigned to normal hosts.

Within any IPv4 network:
• The all 0 host part is the network address.
• The all 1 host part is the broadcast address.
Neither of these can be used by a host.

Special Types of IPv4 Addresses

Not every IPv4 address is used for ordinary hosts that communicate globally. Some ranges and patterns have special roles. You will study public and private ranges in a separate chapter, so this section focuses on the fundamental special behaviors that are unique to IPv4 itself.

Loopback Addresses

The loopback range is used by a device to send traffic to itself. It never leaves the device or reaches the physical network. The best known example is 127.0.0.1, often called “localhost.”

In IPv4, the entire range from 127.0.0.0 to 127.255.255.255 is reserved for loopback. Any address in this range has the same basic behavior. If you “ping” 127.0.0.1 your computer is testing its own networking stack, not your network cable or Wi Fi.

Link Local Addresses

IPv4 reserves the range 169.254.0.0 to 169.254.255.255 for link local addresses. These are used automatically when a device cannot obtain an address from a server such as DHCP. The address is valid only on the local link and is not meant for routing to other networks.

On many systems, if you connect a device directly to a switch with no DHCP server, you might see it assign itself an address starting with 169.254. That usually means it could not get a “normal” configured address.

Unspecified Address

The unspecified IPv4 address is 0.0.0.0. It does not refer to any particular host. Operating systems often use 0.0.0.0 in configuration to represent “no address yet” or to mean “all IPv4 addresses on this device.” Routing and NAT chapters will explore its different roles in more depth.

Broadcast Address

There are two main ideas of broadcast in IPv4:

  1. The limited broadcast address 255.255.255.255. This is used to send traffic to all hosts on the local network when the sender does not yet know anything about the network boundaries.
  2. The directed broadcast to a specific network. In that case, all host bits for that network are set to 1. For example, if a network has addresses from 192.168.1.0 to 192.168.1.255, then 192.168.1.255 is the directed broadcast for that network.

Directed broadcasts are often disabled by default on routers for security reasons, which you will see in routing and security chapters. The important point here is that IPv4 has a concept where one packet can be addressed to “all hosts” in a network by using a special broadcast address.

Unicast, Broadcast, and Multicast in IPv4

Every IPv4 packet is addressed in a way that determines how many recipients it targets.

In basic IPv4 you will encounter three addressing styles:

  1. Unicast. One sender to one specific receiver. Most everyday communication uses unicast. For example, your computer sending traffic to 8.8.8.8 is unicast.
  2. Broadcast. One sender to all hosts in a local network. The source uses a broadcast address so that every device in that network receives and processes the packet.
  3. Multicast. One sender to a selected group of receivers that have joined a particular multicast group. The address identifies the group, not a single host.

IPv4 reserves the range 224.0.0.0 to 239.255.255.255 for multicast addresses. Various protocols use these addresses to deliver data efficiently to multiple receivers, for example for streaming or routing control messages.

IPv4 addressing types:
• Unicast: one to one
• Broadcast: one to all in the local network
• Multicast: one to many selected receivers

You will look at how Ethernet and switches treat broadcasts and multicasts in detail later. For now, recognize that these three styles are built into how IPv4 addresses are used.

Human Conventions and Readability

Because IPv4 addresses appear frequently in logs and configurations, there are some common conventions when humans write them:

Here is a small comparison table:

Written formValid IPv4?Comment
192.168.1.10YesCommon and correct
192.168.001.010YesTechnically valid, but uncommon for humans
10.0.0NoOnly three octets
256.10.10.10No256 is out of range
192.168.1.10.5NoFive octets

Different tools may accept or reject unusual forms differently, but for clean network documentation and beginner practice, you should always use the simple, four octet dotted decimal format.

IPv4 and the Idea of Addresses per Network

Although the details of calculating sizes belong to the Subnetting chapter, it is useful to understand a fundamental property of IPv4 networks now. The number of usable host addresses in a network depends on how many bits are allocated to the host part.

If a network uses $h$ bits for hosts, then the total number of different host combinations is $2^h$. However, two of those combinations are reserved for the network and broadcast addresses, as mentioned earlier. This leads to a common IPv4 pattern:

For a normal IPv4 network with $h$ host bits:
Total addresses: $2^h$
Usable host addresses: $2^h - 2$

You will apply this formula in detail when you learn subnet planning. At this stage, it prepares you for the idea that IPv4 networks always have slightly fewer usable addresses than the raw total suggests.

Practical Examples

Here are a few complete examples to tie the concepts together.

Consider the address 192.168.1.100. You can say:

Now consider 127.0.0.1:

Finally, consider 255.255.255.255:

These examples show how an IPv4 address is not just a number, but also carries meaning about how the network will treat a packet.

Summary

IPv4 provides 32 bit logical addresses for devices, written as four dotted decimal octets. Inside each address there is a network part and a host part, which determine where a device lives and which specific device it is within that network. Some addresses and ranges have special roles, such as loopback, link local, broadcast, and multicast.

Understanding what an IPv4 address looks like and what the basic special ranges are will make it much easier to learn about subnet masks, classful addressing, CIDR, and subnetting in the following chapters.

Views: 45

Comments

Please login to add a comment.

Don't have an account? Register now!