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

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...

How to Set Up a Cisco Router as a DHCP Server (Step-by-Step Guide)

Lab time! Want to build a DHCP server?  In this lab, I will show you how to build your own DHCP server on a router using Cisco Packet Tracer, as shown above. By the end of this post, you will be able to create your own DHCP server with a Cisco 2911 router, perhaps in a home lab setting, and prepare you to build your own on other hardware.  Why a Router?  A DHCP server is a centralized, automated service that assigns important network configuration details to devices on a network, such as IP addresses. Without it, we would have to create manual entries for our entire network, which can be time-consuming and lead to errors. Traditionally, there are dedicated servers to handle these functions. There are many ways to implement a DHCP server in your topology, including a dedicated physical server, a virtual machine, cloud-based gateways, and firewalls. However, there are specific benefits to using a router as your DHCP server: Reduced infrastructur...

My Trek up Mount Net

   Networking is ...          Let me hold off on that. Expect a definition later. First, let's set the scene.         This is a new platform, new field, new everything for me. You might or might not ask yourself - how?   If you are part of the "might not", I get it. I am currently a college student just trying to make sense at staring at the daunting Mount Net - one of many peaks among the IT Mountain Range that grows not centimeters every year, but centimeters every second it seems like. Yet this is a trek I know I want to take step by step.         Let me just say, my journey to networking started a few years ago. When I graduated high school, I had different interests - psychology, math, animal science, just to name a few. I had a brief stint of interest in electrical engineering that sparked from a fascination with electricity. My mother also told me that my grandfather used to be in ...