Setting IP Addresses and Subnets

Ch. 2 of 1012 mins4 Tasks

Learn IPv4 dotted decimal notation, network prefixes, and how subnet masks define local communication boundaries.

Track Series

Chapters in this Track (Ch. 2 of 10)

2Setting IP Addresses and Subnets
12m

Imagine walking into a massive apartment complex where every single room only has a permanent factory serial number stamped on the door hinge. The factory knows the serial number, but the delivery courier has no idea which floor, wing, or hallway that door belongs to. To deliver mail efficiently, the city assigns a logical system: building street number, floor level, and apartment suite. The physical hinge serial number still exists, but the logical address makes delivery predictable.

Computer networking operates on the exact same two-tier principle. While every network interface card leaves the factory with a permanent 48-bit hardware MAC address, computers cannot organize millions of global devices using hardware numbers alone. They require a logical, hierarchical addressing scheme. In modern local networks, that logical foundation is Internet Protocol Version 4 (IPv4).

Anatomy of an IPv4 Address

An IPv4 address is fundamentally a 32-bit binary number—a string of 32 ones and zeros such as 11000000.10101000.00000001.00001010. Because memorizing strings of 32 bits is nearly impossible for human network administrators, engineers divide the 32 bits into four equal chunks of 8 bits each, called octets. Each 8-bit octet is converted into its base-10 decimal equivalent, separated by periods. This format is known as dotted decimal notation.

Because an 8-bit byte can represent values from 00000000 to 11111111, each decimal octet spans from 0 to 255. An address like 192.168.1.10 represents four distinct numerical bytes that identify both the network neighborhood and the specific computer inside that neighborhood.

Address Component Dotted Decimal Value 32-Bit Binary Representation
Octet 1 192 11000000
Octet 2 168 10101000
Octet 3 1 00000001
Octet 4 10 00001010

The Subnet Mask Boundary

An IP address on its own is incomplete. If you hand a computer the address 192.168.1.10 without any context, it cannot determine which part of the number represents the local office and which part represents its unique workstation. To solve this, every IP configuration must be paired with a Subnet Mask.

A subnet mask is another 32-bit number composed of unbroken binary ones followed by unbroken binary zeros. The ones represent the Network Portion (the street name shared by all local neighbors), while the zeros represent the Host Portion (the unique room number assigned to that machine). When using a standard classless prefix like /24, the first 24 bits are set to 1, producing the familiar mask 255.255.255.0.

IP Address:    192 . 168 .   1 .  10  ->  11000000.10101000.00000001 . 00001010
Subnet Mask:   255 . 255 . 255 .   0  ->  11111111.11111111.11111111 . 00000000
--------------------------------------------------------------------------------
Network ID:    192 . 168 .   1 .   0  ->  Network Boundary (All hosts share this)
Usable Hosts:  192.168.1.1 through 192.168.1.254 (254 unique device addresses)
Broadcast IP:  192 . 168 .   1 . 255  ->  Reserved to shout to all local hosts

Rule of Local Networking: Two computers can communicate directly across a physical wire or switch without a router if and only if they share the exact same Network ID. If PC-1 is on 192.168.1.10/24 and PC-2 is configured as 192.168.2.20/24, their network stacks will refuse to speak directly, believing they live on completely different networks.

How Computers Calculate Local Destinations

Whenever an operating system prepares to send a packet, its networking stack performs a lightning-fast mathematical operation known as a Bitwise AND. It compares the destination IP address with its own subnet mask bit by bit:

  • If the resulting Network ID matches its own local Network ID, the computer knows the target is right next door on the local wire. It broadcasts an ARP request to find the target physical MAC address directly.
  • If the resulting Network ID is different, the computer realizes the target is far away across the Internet or in another building. It immediately forwards the packet to its configured Default Gateway router instead.

This explains why a typo in a subnet mask causes bizarre connection bugs. If one computer uses 255.255.255.0 and its neighbor is accidentally set to 255.255.0.0, the first machine may think the destination is on a different network and look for a router, while the second machine tries to talk directly. Both machines must share the exact same subnet mask to agree on where their local network begins and ends.

Hands-On Canvas Verification

In this lab on the right, PC-1 and PC-2 are wired directly using a Copper Cross-Over cable. PC-1 has been assigned the static IP address 192.168.1.10 with subnet mask 255.255.255.0. PC-2 is configured with 192.168.1.20 and the same subnet mask. Because both machines share the identical network prefix 192.168.1.0/24, they can converse seamlessly across the wire.

Select PC-1, click the Terminal tab, and run ipconfig to inspect the active network parameters. Next, verify that pinging 192.168.1.20 succeeds with zero packet loss, proving that both Layer 1 electrical signaling and Layer 3 IP addressing are operating in perfect harmony.

Hands-On Practice Checklist

Progress:0 / 4

Perform actions on the practice lab canvas on the right. Tasks automatically check off as you connect cables and run commands.

Task 1: Inspect PC-1 Network Settings

Click Workstation PC-1 on the canvas to open its hardware drawer. Verify that its static IPv4 address is set to 192.168.1.10 and subnet mask is 255.255.255.0.

Task 2: Verify PC-2 Matching Subnet

Click Workstation PC-2. Confirm that its IP is 192.168.1.20 and shares the identical 255.255.255.0 subnet mask, placing both nodes in 192.168.1.0/24.

Task 3: Query IP Configuration in Terminal

Select PC-1, open the Terminal tab, and execute ipconfig to review the active IPv4 address, subnet mask, and interface state directly from the CLI.

Task 4: Test Subnet Reachability with Ping

In the PC-1 terminal, execute ping 192.168.1.20 to confirm that the operating system recognizes the target as local and successfully receives ICMP replies.