Skip to main content

IP in Practice: IPv4 Address Structure & Classes

There are two main types of IP addresses: IPv4 and IPv6. Many of us are familiar with the first option. The first post in this series included an interactive section where you could test IP addresses. Stay tuned for IPv6. The numbers may seem random, but did you know your IP address matters? It matters for our privacy and could also matter to external actors if they can gain access to our systems. I, however, am talking about what it could reveal.

  • Is your IP address private or public?
  • How much does that affect the number of IP addresses that can be on a network?
  • How are IP addresses organized into classes?

In this post, I'll focus on answering each of these questions.

Structure of an IPv4 Address

  • Follows a dotted-decimal notation
  • Has four octets
  • Each octet has a value between 0 and 255, made up of 8 bits
  • Has a total length of 32 bits in binary form

IPv4 Packet Format

Version Header Length Differentiated Services (DSCP & ECN) Total Length
Identification Flags Fragment Offset
Time to Live Protocol Header Checksum
Source Address
Destination Address

What are IP Classes?

Because IPv4 addresses have 32 bits, there are 232 possible combinations. That is over 4 billion possible IPv4 addresses. These IP addresses are split into 5 separate classes.

Class IPv4 Address Range Leading Bits
A 0.0.0.0 - 127.255.255.255 0xxxxxxx
B 128.0.0.0 - 191.255.255.255 10xxxxxx
C 192.0.0.0 - 223.255.255.255 110xxxxx
D 224.0.0.0 - 239.255.255.255 1110xxxx
E 240.0.0.0 - 255.255.255.255 1111xxxx

Within these ranges, there are both private and public IP addresses. Private IP address ranges are addressed in RFC1918.

What exactly are private and public IP addresses?

Going beyond which one is routable over the Internet, let's approach it from another view: What resource are we reaching for and how do we access it? RFC1918 highlights three categories to consider:

  • Am I reaching for hosts within my network?
  • Am I reaching hosts on another network without necessarily going across the Internet?
  • Am I going out to the Internet?

If you answer yes to the first two questions, you need a private IP address. Using a private IP address offers:

  • Security by isolation: Using private IP addresses is like having a private account on social media. Not everyone has access to your posts unless they follow. Similarly, your private network can only be accessed if connected to it, just as someone asking for your Wi-Fi password.
  • Preserves precious IP space: On January 31, 2011, we ran out of IPv4 addresses. Using private IP addresses allowed for many devices to share one IP address to send and receive traffic (NAT). Think of a family within a home. Everyone can send and receive mail or some package, but it all goes to one address.
  • Allows for IP address reuse: Private IP addresses can be reused. For example, you and your neighbor can share the same subnet of IP addresses: 192.168.1.0/24. How? Many addresses can share a house or building number of 123 but have different street names to identify the exact destination. Similarly, NAT abstracts the shared IP addresses and routes each household's traffic by a designated IP address to reach the Internet.
NAT diagram
Network Address Translation takes multiple hosts on a network with unique IP addresses to share a single public NAT IP address from the router.

If you answer yes to the last question, you are using a public IP address. Using a public IP address offers:

  • More uniqueness across the Internet: There are approximately 17.8 million private IP addresses, which seems a drop in the bucket with the remaining 4 billion possible public IP addresses.
  • Easily accessed across the Internet: Whenever you access a website, you are accessing the web server, which uses a public IP address. You can find most websites' public IP addresses by doing a public lookup or using a terminal application command (i.e. nslookup or dig)
  • Supports hosting and peer-to-peer connections: Public IP addresses are required when you want others to initiate connections to your device, such as running a web server, online game server, or even setting up remote access directly to your computer.
RFC1918 Private IP Address Ranges
Class Range Number of Possible Addresses
A 10.0.0.0 - 10.255.255.255 16.7 million (16,777,216)
B 172.16.0.0 - 172.31.255.255 1.04 million (1,048,576)
C 192.168.0.0 - 192.168.255.255 65,536

As you can see, the private IP ranges do not account for the over 4 billion IP addresses that IPv4 provides. Some are used by public-facing servers, while others have specific, reserved purposes such as experimentation and multicasting, particularly for classes D and E. This will be discussed in-depth in a later post.

What's Next?

We scratched the surface with the types of IPv4 addresses. The next part will include a deeper dive into public and private addresses, routing techniques, and a lab demo on Cisco Packet Tracer to see all IP in action.

Comments

Popular posts from this blog

Subnets: Key to Network Organization

Whether it is a to-do list or a big project, organization is key. We have busy lives. The task in itself can have several parts or may require some sort of collaboration with a partner or a team. A project may call to meet deadlines, which means keeping up with those crucial dates and having a system of order. Similarly, our networks are busy, transferring a great deal of data across links and nodes. The amount of traffic generated can lead to bottlenecks, packet loss, and delays. A network’s design can vary in complexity, depending on the environment or needs of a customer. Just as we find a manageable way to handle heavy workloads, our networks have a way of efficiently handling network traffic by creating "mini-networks" within our network. This process is called subnetting.   Why We Subnet To reduce congestion. Just as traffic in cities cause slowdowns and delays, too much traffic can lead to bottlenecks, packet loss, and delays. Subnetting breaks the netwo...

Journey to Being Network+ Certified

I Passed the Network+ Exam! Here's My Journey I can't believe it. After months and years of practice, patience, and frustration, I am Network+ certified. Even thinking about it gets me excited. The journey here was not easy. Many people have their stories on how they passed, such as what study resources they used, the amount of time spent, sacrifices, or even field experience. I am going to throw my hat in the ring and share my experience, from what I remember, to get here. I'll even include some tips and the resources I used to pass this exam. Discovering Networking Through A+ It started with going into the A+ certification. The hardware sections were overwhelming at first, but I especially enjoyed the parts about cloud computing, virtualization, and networking. Consistently, networking stood out as my best-performing domain. At first, I just needed an introduction to networking, but as time went on—and with the opportunity of getting an internship—the need for the ...

New Series: IP in Practice

I have done a few posts on subnetting and the inner workings of DHCP. I wanted to do a post on IPv6 and a hands-on demo on implementing DHCP on actual networking equipment. However, I missed a few parts that I would like to cover that would particularly help in understanding how IP works and why it is needed. Unlike the previous series, this will be a direct approach to a certain protocol: Internet Protocol (IP). I recently started my first series, covering important ports, protocols, and acronyms used in the networking field. However, I realized not only is it difficult to address the ones to mention, but for some letters it's hard to find. The intended structure was to have several per letter not just one. The idea seemed fun and engaging, however, doing over 20 posts alphabetically on acronyms, ports, and protocols lacks order and deviates from the direct approach I want this blog to have. For that reason, I am putting it on hold indefinitely. It was fun at first, but it was not...