<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Igwe Francis</title>
    <description>The latest articles on DEV Community by Igwe Francis (@igwefran6).</description>
    <link>https://dev.to/igwefran6</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1530476%2F89373fb8-c66c-4a95-9c60-114ac1dc378b.jpg</url>
      <title>DEV Community: Igwe Francis</title>
      <link>https://dev.to/igwefran6</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/igwefran6"/>
    <language>en</language>
    <item>
      <title>The Anatomy of IPv4 Address</title>
      <dc:creator>Igwe Francis</dc:creator>
      <pubDate>Fri, 07 Aug 2026 15:57:45 +0000</pubDate>
      <link>https://dev.to/igwefran6/the-anatomy-of-ipv4-address-2io</link>
      <guid>https://dev.to/igwefran6/the-anatomy-of-ipv4-address-2io</guid>
      <description>&lt;p&gt;I used to think IPv4 addresses were just random numbers until recently. It blew my mind when I started digging and understanding that they have an anatomy where every number after the dot means something very important.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; To understand what IP addresses are, please consult this post because I won't be going over them here. &lt;a href="https://dev.to/noblepearl/ip-addresses-digital-connectivity-jf4"&gt;IP Addresses: Digital Connectivity&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is IPv4 in the First Place?
&lt;/h2&gt;

&lt;p&gt;IPv4 is short for &lt;strong&gt;Internet Protocol version 4&lt;/strong&gt;. As you might have already realized, it's the 4th version of the early test designs during the development of the Internet Protocol in test labs in the 1970s. The first real release, v4, came out in 1981 in a public document called RFC 791. &lt;a href="https://www.rfc-editor.org/info/rfc791/" rel="noopener noreferrer"&gt;RFC 791: STD 5: Internet Protocol&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;IPv4 is an Internet Protocol that's written in what's called &lt;strong&gt;Dotted Decimal Notation&lt;/strong&gt; (e.g., &lt;code&gt;172.17.0.3&lt;/code&gt;), where each portion is separated by a dot, and these portions are called octets. For example, &lt;code&gt;172&lt;/code&gt; is the first octet and &lt;code&gt;17&lt;/code&gt; is the second octet (more on this later).&lt;/p&gt;

&lt;h2&gt;
  
  
  Before We Explore What Octets Are, Let's Take a Stroll to the Basics of Binary (Simplified)
&lt;/h2&gt;

&lt;p&gt;Have you ever wondered why your computer or phone requires electricity to function? Though electricity can be used as a raw power source for things like fans or speakers, where it's converted into other forms of energy such as movement or sound, it's good to know that electricity can function differently in your computer's RAM or SSD. Inside your computer are billions of extremely tiny transistors. These transistors form circuits that can create and maintain different electrical states, which the computer interprets as 0s and 1s. In simple terms, 0 represents the absence of the electrical state (OFF), while 1 represents its presence (ON). These states, which we represent with 0s and 1s, are called &lt;strong&gt;binary digits&lt;/strong&gt; (or simply bits).&lt;/p&gt;

&lt;p&gt;1 bit has the possibility of representing either 0 or 1, which doesn't represent much information, and that's where multi-bits come in. Every additional bit doubles the number of possible values. What I mean by this is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1 bit = 0 or 1, 2 bits = 00, 01, 10, or 11&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As you can see, just by grouping two bits together, we are able to represent more possible values. To convert to decimal, we can say:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;2 bits value&lt;/th&gt;
&lt;th&gt;Decimal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;00&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;11&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;We are no longer representing either 0 or 1. With 2 bits, we can represent values from 0 up to 3 (that's 4 possible values). But can you spot how much the number of values we can represent increased exponentially just by grouping bits? Let's see how much we can represent with 3 bits (don't worry about the conversion method).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;3 bits value&lt;/th&gt;
&lt;th&gt;Decimal&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;000&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;001&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;010&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;011&lt;/td&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;100&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;101&lt;/td&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;110&lt;/td&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;111&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;From the table, you can see we are now able to represent 8 values, an exponential increase from the previous example (2 bits). So mathematically, we can say:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;bits&lt;/th&gt;
&lt;th&gt;Equation&lt;/th&gt;
&lt;th&gt;Possible values&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;2^1&lt;/td&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;2^2&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;2^3&lt;/td&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;2^4&lt;/td&gt;
&lt;td&gt;16&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;2^5&lt;/td&gt;
&lt;td&gt;32&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;2^6&lt;/td&gt;
&lt;td&gt;64&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;2^7&lt;/td&gt;
&lt;td&gt;128&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;2^8&lt;/td&gt;
&lt;td&gt;256&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;With 2 to the power of 1, we can only represent 2 possible values, but with an increase in power (which is the same as grouping more bits), it becomes possible to represent more values.&lt;/p&gt;

&lt;p&gt;An octet is 8 bits. Remember above when I gave an example of an IPv4 address such as &lt;code&gt;172.17.0.3&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's an Octet?
&lt;/h2&gt;

&lt;p&gt;An octet is just bits grouped into eight, capable of representing values between 0–255. (We start counting from 0, which is why the range is 0–255, but 8 bits are capable of representing 256 values, and 0 is still a valid value.) Each of the four values separated by a dot in an IPv4 address is an octet, so with that in mind, we'd have 4 octets:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172 → first octet&lt;br&gt;
17 → second octet&lt;br&gt;
0 → third octet&lt;br&gt;
3 → fourth octet&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Each of these octets is able to represent a value between 0–255. You'd never come across an IPv4 address where an individual octet crosses 255. Something like &lt;code&gt;192.258.0.12&lt;/code&gt; is an invalid IPv4 address because we can't represent 258 with 8 bits.&lt;/p&gt;

&lt;p&gt;IPv4 addresses are 32-bit values (1 octet is 8 bits, 4 octets is 32 bits), commonly represented to humans as four decimal octets. A traditional conversion of an IPv4 address (172.17.0.3) from decimal notation to binary representation would look like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172 → 10101100&lt;br&gt;
 17  → 00010001&lt;br&gt;
 0   → 00000000&lt;br&gt;
 3   → 00000011&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So this is how a typical networking pro would see an IPv4.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.17.0.3&lt;br&gt;
↓&lt;br&gt;
10101100.00010001.00000000.00000011&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Anatomy of IPv4
&lt;/h2&gt;

&lt;p&gt;An IPv4 address is two addresses in one. An IPv4 address contains information that allows us to determine &lt;strong&gt;which network a device belongs to and which device it is within that network&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But before we break that statement down, there's something important we need to establish; An IPv4 address is fundamentally &lt;strong&gt;one 32-bit value&lt;/strong&gt;. So when we write:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.17.0.3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;we're not actually dealing with four independent numbers, but one 32-bit value that has been divided into four groups of 8 bits so that humans can read and work with it more easily.&lt;/p&gt;

&lt;p&gt;I hope you still remember that:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;1 octet = 8 bits&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;4 octets × 8 bits = 32 bits&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That's why every valid IPv4 address has four octets so that we can visualize it like this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172 . 17 . 0 . 3&lt;/code&gt;&lt;br&gt;
 &lt;code&gt;↓    ↓    ↓   ↓&lt;/code&gt;&lt;br&gt;
 &lt;code&gt;8    8    8   8 bits&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And if we convert each octet to binary:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;172.17.0.3&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;becomes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;10101100.00010001.00000000.00000011&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Realistically this is the actual 32-bit structure of the dotted decimal notation. It's safe to say that the dots aren't part of the 32 bits themselves but simply separators that make it easier for us to see the four groups of 8 bits.&lt;/p&gt;

&lt;p&gt;But where the &lt;strong&gt;anatomy&lt;/strong&gt; of IPv4 becomes interesting is &lt;strong&gt;The Network and Host Portions&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Network and Host Portions
&lt;/h2&gt;

&lt;p&gt;When we say an IPv4 address tells us &lt;strong&gt;which network a device belongs to and which device it is within that network&lt;/strong&gt;, we're talking about two logical portions of those 32 bits:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Network portion | Host portion&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For example, assuming we have this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1.10/24&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;/24&lt;/code&gt; tells us that the first 24 bits are the &lt;strong&gt;network prefix&lt;/strong&gt; (more on it later). For now, lets convert the address to binary:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1.10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;becomes:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;11000000.10101000.00000001.00001010&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now we can show where the &lt;code&gt;/24&lt;/code&gt; boundary falls:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;11000000.10101000.00000001 | 00001010&lt;/code&gt;&lt;br&gt;
&lt;code&gt;&amp;lt;---------- network ----------&amp;gt; &amp;lt;--- host ---&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So the first 24 bits represent the network prefix and the remaining 8 bits represent the host portion. So we can think of the address as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Network: 192.168.1&lt;/code&gt;&lt;br&gt;
&lt;code&gt;Host: 10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And that's what I mean when I say an IPv4 address is &lt;strong&gt;two addresses in one&lt;/strong&gt;. It's one 32-bit IPv4 address, but when we apply a prefix length to it, those bits can be interpreted as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Network prefix + Host portion&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  But Wait, Where Did &lt;code&gt;/24&lt;/code&gt; Come From?
&lt;/h2&gt;

&lt;p&gt;You might be wondering why I suddenly added &lt;code&gt;/24&lt;/code&gt; to the IP address. This is important because the IPv4 address by itself doesn't tell us where the network portion ends and the host portion begins.&lt;/p&gt;

&lt;p&gt;Take for example:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1.10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;By looking at those four decimal numbers alone, there is no universal rule saying:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1 = network&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;10 = host&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So we need additional information to know where that boundary is and that's what the &lt;code&gt;/24&lt;/code&gt; provides.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/24&lt;/code&gt; simply means:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The first 24 bits are the network prefix.&lt;/strong&gt; This is also why you shouldn't memorize something like:&lt;/p&gt;

&lt;p&gt;"The first three numbers are the network and the last number is the host."&lt;/p&gt;

&lt;h2&gt;
  
  
  The Boundary Doesn't Always Fall Between Octets
&lt;/h2&gt;

&lt;p&gt;I think, this is where understanding the binary structure becomes very useful. &lt;/p&gt;

&lt;p&gt;Consider IPv4:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1.10/26&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;/26&lt;/code&gt; means the first 26 bits are the network prefix.&lt;/p&gt;

&lt;p&gt;Our address in binary is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;11000000.10101000.00000001.00001010&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now lets mark the first 26 bits:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;11000000.10101000.00000001.00 | 001010&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Notice that the boundary is inside the fourth octet.&lt;/p&gt;

&lt;p&gt;The fourth octet:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;00001010&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;has been split into:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;00 | 001010&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So we have:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;26 network bits&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;6 host bits&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;because:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;32 - 26 = 6&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is why it's important to think about IPv4 as &lt;strong&gt;32 bits&lt;/strong&gt;, rather than simply four decimal numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lastly, How Does the Computer Know This?
&lt;/h2&gt;

&lt;p&gt;Now you might be wondering; If the IP address itself doesn't contain &lt;code&gt;/24&lt;/code&gt;, how does my computer know what the network boundary is?&lt;/p&gt;

&lt;p&gt;If you're using Windows, run:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;terminal command: &lt;code&gt;ipconfig /all&lt;/code&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You'll see something similar to:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;IPv4 Address. . . . . . . . . . . : 192.168.1.10&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Subnet Mask . . . . . . . . . . . : 255.255.255.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Windows doesn't display &lt;code&gt;/24&lt;/code&gt; here. Instead, it displays the &lt;strong&gt;subnet mask&lt;/strong&gt;. But:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;255.255.255.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;is another way of saying:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/24&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;because in binary, &lt;code&gt;255.255.255.0&lt;/code&gt; is the same as &lt;code&gt;11111111.11111111.11111111.00000000&lt;/code&gt; because there are 24 1s followed by 8 0s.&lt;/p&gt;

&lt;p&gt;The 1s tell the computer which bits belong to the network prefix, while the 0s indicate the bits available for the host portion. &lt;/p&gt;

&lt;p&gt;So &lt;code&gt;192.168.1.10&lt;/code&gt; together with &lt;code&gt;255.255.255.0&lt;/code&gt; can be written more compactly as:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;192.168.1.10/24&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;So this is how your computer knows where the network boundary is.&lt;/p&gt;

</description>
      <category>networking</category>
      <category>beginners</category>
      <category>learning</category>
      <category>software</category>
    </item>
  </channel>
</rss>
