Since module 2 we have been using addresses like 192.168.10.21 and notations like /24 with the promise that "the detail would come later". That moment has arrived. In this lesson we open up an IPv4 address: what exactly those four numbers are, why the machine sees them as 32 bits, how to convert between decimal and binary (essential for the subnetting in the next lesson), which addresses have special meanings, and why the Meridiano network uses "private" addresses you will never see on the Internet. By the end, you will be able to read the IP configuration of Marta's PC and understand every field, not just recognize it.
Contents
- Anatomy of an IPv4 address: 32 bits in 4 octets
- Decimal ↔ binary conversion: the weight-table method
- Network portion and host portion: the role of the mask
- The historical classes A/B/C (and why they died)
- Special addresses you must recognize
- Public and private addresses (RFC 1918)
- Who hands out public addresses? IANA and the RIRs
- Meridiano case: a full reading of Marta's configuration
Anatomy of an IPv4 address: 32 bits in 4 octets
To the computer, an IPv4 address is a 32-bit number: a string of 32 ones and zeros. Since reading 11000000101010000000101000010101 is inhuman, the convention is to split it into 4 groups of 8 bits (each group is called an octet, or byte) and write each octet in decimal, separated by dots. This is the so-called dotted decimal notation:
Binary (32 bits): 11000000 . 10101000 . 00001010 . 00010101
Dotted decimal: 192 . 168 . 10 . 21
└─ octet 1 ─┴─ octet 2 ─┴─ octet 3 ─┴─ octet 4 ─┘Two immediate consequences:
- Each octet has 8 bits, so its value ranges from 0 (
00000000) to 255 (11111111). That is why you will never see an address like192.300.1.5: 300 does not fit in 8 bits. - In total there are 2³² possible addresses: 4,294,967,296 (about 4.3 billion). That seemed infinite in 1981; today it is one of the reasons NAT (lesson 05-03) and IPv6 (lesson 05-04) exist.
The address 192.168.10.21 on Marta's PC and 11000000.10101000.00001010.00010101 are the same number written in two different bases. The router and the switch only ever see the bits; the decimal is for us.
Decimal ↔ binary conversion: the weight-table method
For next lesson's subnetting you need to convert octets fluently. The tool is the weight table: each bit of an octet is "worth" a power of 2, from left to right:
| Bit position | 1st | 2nd | 3rd | 4th | 5th | 6th | 7th | 8th |
|---|---|---|---|---|---|---|---|---|
| Weight | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Memorize the row of weights: 128, 64, 32, 16, 8, 4, 2, 1. Each weight is double the one to its right, and they all add up to 255.
From binary to decimal: add the weights of the bits set to 1
Example with the third octet of Marta's PC, 00001010:
Weight: 128 64 32 16 8 4 2 1
Bit: 0 0 0 0 1 0 1 0
↓ add only where there is a 1 ↓
8 + 2 = 10 ✔ (the "10" in 192.168.10.21)Another example, 11000000 (first octet):
And 11111111 (which you will see constantly in masks):
From decimal to binary: the successive-subtraction method
Walk the weight table from left to right asking: does this weight fit into what I have left? If it fits, write a 1 and subtract it; if it doesn't, write a 0 and move on.
Worked example: converting 168 (Marta's second octet):
Does 128 fit into 168? Yes → bit 1. Left: 168 − 128 = 40
Does 64 fit into 40? No → bit 0. Left: 40
Does 32 fit into 40? Yes → bit 1. Left: 40 − 32 = 8
Does 16 fit into 8? No → bit 0. Left: 8
Does 8 fit into 8? Yes → bit 1. Left: 8 − 8 = 0
Does 4 fit into 0? No → bit 0
Does 2 fit into 0? No → bit 0
Does 1 fit into 0? No → bit 0
168 = 10101000Second example: converting 21 (Marta's last octet):
Does 128 fit into 21? No → 0
Does 64 fit into 21? No → 0
Does 32 fit into 21? No → 0
Does 16 fit into 21? Yes → 1. Left: 21 − 16 = 5
Does 8 fit into 5? No → 0
Does 4 fit into 5? Yes → 1. Left: 5 − 4 = 1
Does 2 fit into 1? No → 0
Does 1 fit into 1? Yes → 1. Left: 0
21 = 00010101With this you can now write Marta's full address in binary:
Practice tip: learn by heart the values that show up in networking again and again: 0, 128, 192, 224, 240, 248, 252, 254, 255. They are the possible octets of a mask (bits set to 1 "filling in from the left") and you will use them non-stop in lesson 05-02.
| Binary | Decimal | Bits set to 1 |
|---|---|---|
| 00000000 | 0 | 0 |
| 10000000 | 128 | 1 |
| 11000000 | 192 | 2 |
| 11100000 | 224 | 3 |
| 11110000 | 240 | 4 |
| 11111000 | 248 | 5 |
| 11111100 | 252 | 6 |
| 11111110 | 254 | 7 |
| 11111111 | 255 | 8 |
Network portion and host portion: the role of the mask
As we saw when discussing the routing table (module 2), an IP address is not a flat identifier like a MAC: it has structure. Its 32 bits are divided into two fields:
- Network portion: the bits on the left. They identify which network the machine is on. Every machine in the Valencia office shares the same network portion.
- Host portion: the remaining bits. They identify which specific machine within that network.
192.168.10.21 with mask /24 (255.255.255.0):
11000000.10101000.00001010 | 00010101
└──── NETWORK portion (24 bits) ──┘└ HOST (8 bits) ┘
"network 192.168.10" "machine 21"And who decides where the boundary sits? The subnet mask. The /24 we have been dragging along since module 2 means exactly that: "the first 24 bits are network, the remaining 8 are host". The address on its own does not say where the network ends: 192.168.10.21 could be host 21 of network 192.168.10 (with /24) or host 10.21 of network 192.168 (with /16). That is why an IP configuration always comes as a pair: address + mask.
The idea is analogous to a phone number: country code + national number. The prefix (network portion) tells the worldwide network where to route; the rest (host portion) identifies the final destination within that zone. For this lesson, this introduction is enough; all the mechanics of the mask (bitwise AND, network calculation, subnetting) belong to lesson 05-02.
The historical classes A/B/C (and why they died)
In the original IPv4 design (the 1980s) there was no explicit mask: the network/host boundary was fixed by the first bits of the address itself. This is classful addressing:
| Class | Leading bits | 1st-octet range | Fixed boundary | Possible networks | Hosts per network |
|---|---|---|---|---|---|
| A | 0... |
1 – 126 | /8 | 126 | 16,777,214 |
| B | 10.. |
128 – 191 | /16 | 16,384 | 65,534 |
| C | 110. |
192 – 223 | /24 | ~2 million | 254 |
| D | 1110 |
224 – 239 | — (multicast) | — | — |
| E | 1111 |
240 – 255 | — (experimental) | — | — |
(127 is missing from class A because it is reserved for loopback, as we will see shortly.)
The system was simple but wasted addresses on an industrial scale. A company with 300 machines did not fit in a class C (254 hosts), so it received an entire class B: 65,534 addresses to use 300. Thousands of assignments like that accelerated the exhaustion of the IPv4 space.
The solution, in 1993, was CIDR (Classless Inter-Domain Routing): abolish the classes and make the boundary explicit and flexible through the /n notation you already know. With CIDR, a /23, a /26 or a /29 are just as valid as a /24: the network is sized to fit what is needed. That is the world we work in today and the one we will develop in lesson 05-02.
The classes did, however, leave behind some fossil vocabulary: you will hear "a class C" as informal shorthand for "a /24", and you will see the RFC 1918 private ranges described as "one class A, 16 class Bs and 256 class Cs". Understand the historical reference, but always calculate with CIDR.
Special addresses you must recognize
Not every address can be assigned to a machine. These will show up in your day-to-day work and you must identify them instantly:
| Address | Name | Meaning |
|---|---|---|
Host portion all 0s (e.g. 192.168.10.0/24) |
Network address | Identifies the network as a whole; it is what appears in routing tables. Never assigned to any machine. |
Host portion all 1s (e.g. 192.168.10.255/24) |
Directed broadcast | "Every machine on this network". ARP doesn't use it — ARP works with layer-2 broadcast; what does use it is, for example, Wake-on-LAN to wake machines on another network. Not assignable either. |
255.255.255.255 |
Limited broadcast | Every machine on the local segment, without even knowing which network you are on (DHCP DISCOVER uses it, module 2). |
127.0.0.1 (all of 127.0.0.0/8) |
Loopback | "Myself". Traffic to 127.x.x.x never leaves the machine; it is used to test the local TCP/IP stack (ping 127.0.0.1) and for services that only listen locally. |
169.254.x.x (169.254.0.0/16) |
APIPA / link-local | Self-assigned by the operating system when DHCP does not respond. If a Valencia PC shows up with 169.254.a.b, the near-certain diagnosis is: it never reached the DHCP server (router .10.1 down, loose cable, wrong VLAN). It is a symptom, not a valid configuration. |
0.0.0.0 |
"No address" / any | As a source: "I don't have an IP yet" (the DHCP client uses it in the DISCOVER). In a routing table: 0.0.0.0/0 is the default route (module 4). On a server: "listen on all interfaces" (you saw it with ss in module 4). |
A real operational example at Meridiano: Ana calls because "she has no Internet". She runs ipconfig and reads 169.254.113.7. Nothing more is needed: her machine asked for an IP over DHCP, nobody answered, and Windows self-assigned an APIPA address. The problem is not "the Internet": it is that she cannot reach the router/DHCP server at .10.1.
Public and private addresses (RFC 1918)
You may have noticed that the Valencia network (192.168.10.0/24) and the Bilbao one (192.168.20.0/24) start the same way as your home network, the café across the street, and millions of businesses. That is no coincidence: they are private addresses, defined in RFC 1918. Three blocks were reserved for free internal use:
| RFC 1918 block | Range | Size | Historical equivalent |
|---|---|---|---|
10.0.0.0/8 |
10.0.0.0 – 10.255.255.255 | 16,777,216 addresses | 1 class A |
172.16.0.0/12 |
172.16.0.0 – 172.31.255.255 | 1,048,576 addresses | 16 class Bs |
192.168.0.0/16 |
192.168.0.0 – 192.168.255.255 | 65,536 addresses | 256 class Cs |
Rules of the game:
- Anyone can use them inside their network without asking anyone's permission. That is why Meridiano freely chose 192.168.10.0/24 and 192.168.20.0/24.
- They are not unique in the world: your neighbor can use exactly the same ones. That is fine, because...
- Internet routers do not route them: a packet with a 192.168.x.x source or destination that reaches a carrier's router gets dropped. Private addresses only make sense inside an organization.
Which raises the obvious question: if Marta's PC has an address the Internet won't accept, how does Marta browse the web? The short answer is NAT: the Valencia router swaps the private address for its own public address on the way out. The full operational how and why, translation tables and consequences included, is lesson 05-03. For now, keep the distinction:
- Private address: RFC 1918, free, repeatable, valid only internally.
- Public address: unique across the entire Internet, formally assigned, the one that is "seen" from outside.
Quick identification trick: if an address starts with 10., with 192.168., or falls between 172.16. and 172.31., it is private. If it is 127.x it is loopback, and if it is 169.254.x it is APIPA. Everything else (except multicast and reserved ranges) is, in principle, public.
Who hands out public addresses? IANA and the RIRs
Public addresses are not chosen: they are assigned through a hierarchy:
graph TD
IANA["IANA (global authority)"] --> RIPE["RIPE NCC<br/>Europe and the Middle East"]
IANA --> ARIN["ARIN<br/>North America"]
IANA --> APNIC["APNIC<br/>Asia-Pacific"]
IANA --> LACNIC["LACNIC<br/>Latin America"]
IANA --> AFRINIC["AFRINIC<br/>Africa"]
RIPE --> ISP["Carriers / ISPs<br/>(Meridiano's included)"]
ISP --> CLIENTE["End customers:<br/>1 public IP for the Valencia headquarters"]
- IANA administers the global space and delegates large blocks to the RIRs (Regional Internet Registries), one per region of the world. Spain falls under RIPE NCC.
- The RIRs assign blocks to carriers (ISPs) and to large organizations.
- The carrier assigns each customer their share. Meridiano, as a typical small business, receives a single public IP per site from its ISP (sometimes not even a fixed one). With NAT, that single address serves all 20 machines in Valencia.
A bit of context: IANA handed out its last free IPv4 block to the RIRs in 2011, and the RIRs ran through their reserves over the following years. Today public IPv4 addresses are rationed, leased and even bought on secondary markets. This exhaustion is the thread connecting the next two lessons: NAT as the patch (05-03) and IPv6 as the solution (05-04).
Meridiano case: a full reading of Marta's configuration
Let's close by applying everything. Marta runs ipconfig /all on her Valencia PC (on Linux it would be ip addr, which you already used in module 4). Abridged output:
Ethernet adapter Ethernet0:
Connection-specific DNS Suffix . : grupomeridiano.example
Physical Address. . . . . . . . . : 5C-26-0A-4B-91-D3
DHCP Enabled. . . . . . . . . . . : Yes
IPv4 Address. . . . . . . . . . . : 192.168.10.21
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.10.1
DHCP Server . . . . . . . . . . . : 192.168.10.1
DNS Servers . . . . . . . . . . . : 192.168.10.1A line-by-line reading with what you have learned:
- IPv4 Address
192.168.10.21: 32 bits,11000000.10101000.00001010.00010101. Starts with192.168.→ private, RFC 1918: it will never be seen as-is on the Internet. - Mask
255.255.255.0: in binary, 24 ones followed by 8 zeros → it is the/24. It marks192.168.10as the network portion and21as the host portion: Marta is machine 21 on the Valencia network. - Wait:
.21assigned by DHCP when the dynamic range is.100–.199? Correct: Marta's PC has a DHCP reservation (the router always hands the same IP to her MAC5C-26-0A-4B-91-D3), common practice for machines you want to locate reliably. The file server (.10.10) goes one step further: a static IP configured by hand. - Default Gateway
192.168.10.1: the router's address, inside the same network (it shares the192.168.10portion). It is host1, the typical convention for the gateway. - Addresses Marta should not see there:
169.254.x.x(DHCP down),127.0.0.1(that is loopback, not a network address) or the addresses192.168.10.0/192.168.10.255(network and broadcast, not assignable).
And in Bilbao, Jon's PC would tell the same story with different numbers: 192.168.20.7, mask 255.255.255.0, gateway 192.168.20.1. Same structure, different network portion — exactly the reason a router (and the VPN) is needed for Marta and Jon to communicate.
Common Mistakes and Tips
- Treating the address as "four independent numbers". It is ONE 32-bit number; the decimal dotting is just notation. Many subnetting errors are born from working octet by octet without thinking in bits.
- Writing impossible octets (256, 300, −1). Each octet runs from 0 to 255. If a calculation gives you 256, you slipped up in a subtraction or a carry.
- Believing the address alone defines the network. Without a mask,
192.168.10.21is ambiguous. Always ask for the pair: address + mask. - Ignoring a 169.254.x.x. It is not "some weird IP": it is the system shouting that DHCP did not respond. Immediate diagnosis: connectivity to the DHCP server.
- Assigning the network address or the broadcast to a machine.
.0and.255in a /24 are not valid hosts. (With other masks the values change: you will see it in 05-02.) - Thinking in classes when calculating. Classes are history and vocabulary; modern calculations are CIDR. "It's a 192.168, so class C, so /24" is false reasoning in the CIDR world: a 192.168.10.x can perfectly well carry a /26.
- Tip: practice binary conversions 5 minutes a day for a week. Fluency with 128-64-32-16-8-4-2-1 is the difference between suffering through subnetting and doing it in your head.
Exercises
Exercise 1: conversion to binary
Convert to binary, using the successive-subtraction method and showing every step, the four octets of the Meridiano file server's address: 192.168.10.10.
Exercise 2: conversion to decimal and identification
A colleague dictates an address to you in binary: 10101100.00010000.00100000.11001000.
a) Convert it to dotted decimal by adding weights.
b) Is it public or private? Justify it with the RFC 1918 table.
Exercise 3: diagnosis by reading a configuration
Three Meridiano machines show these configurations. For each one, state whether it is a normal configuration or the symptom of a problem, and which problem:
- Ana's PC:
IPv4 169.254.203.44, mask255.255.0.0, no default gateway. - Valencia printer:
IPv4 192.168.10.255, mask255.255.255.0. - Jon's PC:
IPv4 192.168.20.7, mask255.255.255.0, gateway192.168.20.1.
Solutions
Solution 1
Octet 1, 192:
128 into 192? Yes → 1, left 64
64 into 64? Yes → 1, left 0
32,16,8,4,2,1 into 0? No → 000000
192 = 11000000Octet 2, 168:
128 into 168? Yes → 1, left 40
64 into 40? No → 0
32 into 40? Yes → 1, left 8
16 into 8? No → 0
8 into 8? Yes → 1, left 0
4,2,1 into 0? No → 000
168 = 10101000Octets 3 and 4, 10 (identical to each other):
128,64,32,16 into 10? No → 0000
8 into 10? Yes → 1, left 2
4 into 2? No → 0
2 into 2? Yes → 1, left 0
1 into 0? No → 0
10 = 00001010Result: 192.168.10.10 = 11000000.10101000.00001010.00001010.
Solution 2
a) Sum of weights per octet:
10101100 = 128 + 32 + 8 + 4 = 172
00010000 = 16 = 16
00100000 = 32 = 32
11001000 = 128 + 64 + 8 = 200Address: 172.16.32.200.
b) The middle private block of RFC 1918 is 172.16.0.0/12, which spans from 172.16.0.0 to 172.31.255.255. Since 172.16.32.200 has 172 as its first octet and 16 as its second (within the 16–31 range), it is private. It would not be routable on the Internet.
Solution 3
- Ana's PC:
169.254.x.xis APIPA. Her machine asked for an address over DHCP and nobody answered, so it self-assigned a link-local one. With no gateway, it cannot leave its segment. Problem to investigate: reachability of the DHCP server (router 192.168.10.1): cable, switch port, VLAN or the DHCP service itself. - Printer:
192.168.10.255with a /24 mask is the broadcast address of the Valencia network, which is not assignable to any machine. It is a botched manual configuration (or software displaying the broadcast where it shouldn't). It needs a valid host address (an unused one between .1 and .254, ideally reserved outside the DHCP range .100–.199). - Jon's PC: normal configuration for the Bilbao branch: a valid private host address in 192.168.20.0/24, with the gateway at the .20.1 router, inside its own network.
Conclusion
You now know what an IPv4 address really is: a 32-bit number in four octets, convertible between decimal and binary with the 128-64-32-16-8-4-2-1 weight table; divided into a network portion and a host portion by a mask; with special addresses (network, broadcast, loopback, APIPA, 0.0.0.0) you must recognize at a glance; and split into two worlds, the private RFC 1918 one Meridiano uses and the public one rationed by the IANA → RIR → ISP hierarchy. You also know that classes A/B/C died and CIDR replaced them with the flexible /n notation.
But we have left the central piece barely introduced: the mask. How exactly does a machine calculate its network address? How many hosts fit in a /26? How would you carve up 192.168.10.0/24 to separate the corporate VLAN, the guest VLAN and the servers? That — the AND operation, the 5-step method and subnetting with all its arithmetic — is the next lesson: Subnet Masks and Subnetting.
Networking Course
Module 1: Introduction to Networks
Module 2: Communication Protocols
- Introduction to Communication Protocols
- Data Link Protocols
- Network Protocols
- Transport Protocols
- Application Protocols
Module 3: The OSI Model
- Introduction to the OSI Model
- Physical Layer
- Data Link Layer
- Network Layer
- Transport Layer
- Session Layer
- Presentation Layer
- Application Layer
Module 4: The TCP/IP Model
- Introduction to the TCP/IP Model
- Network Access Layer
- Internet Layer
- Transport Layer
- Application Layer
- OSI vs TCP/IP Comparison
