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

IP in Practice: Special IPv4 Addresses

We have already discussed three private ranges used in classful and classless subnetting. The list does not stop there. This post identifies six types of special IP addresses that you will encounter. By the end of this post, you should have a clearer understanding of how these addresses are used in troubleshooting, how they appear on certification exams, and how they shape the way traffic moves across the Internet. 1. Loopback Address (127.0.0.1) Every networked device has a loopback address. Most commonly, it is 127.0.0.1 . The loopback address is typically used to test internal connections. You may wonder, “Why do I need to know if my device can connect to itself? Shouldn’t it connect to other resources and the Internet?” Think about it this way. Before you walk out the door, you make sure you look presentable by taking a shower, brushing your teeth, ironing your clothes, and checking yourself in the mirror. Once everything looks good, you are ready to go. Similarly, your compute...

IP in Practice: Public and Private IP Addresses

Do you speak another language? Personally, I love learning new languages, but one of the hardest parts is translation. When it comes to networking, it is something similar. Devices within our home and office networks do not directly go to the internet. There needs to be a "translator". What does this have to do with public and private IPv4 addresses? In this post, we will explore: IPv4 Addresses Private Ranges  The difference and teamwork between NAT and PAT Helpful troubleshooting commands such as ipconfig or ping A demo that puts it altogether.  (Link to topology here .) By the end of this post, you will see how public and private IP addresses work together in action.  IPv4 Address Private Ranges RFC1918 Private IP Address Ranges Class IANA Blocks Range Total Addresses A 10.0.0.0/8 10.0.0.0 - 10.255.255.255 16.7 million (16,777,216) ...

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