Pedro Explains: How to Calculate IP Addresses, Netmask, Network, and Subnets

“A network is like a city: it has neighborhoods, buildings, and apartments.

If you know the address, you know exactly where to go.” — Pedro


What Is an IP Address?

In the physical world, you need an address to receive mail or packages.

On the internet, every device also has an address — called an IP (Internet Protocol) address.

IPv4 Structure

An IPv4 address is made of four numbers, each ranging from 0 to 255, separated by dots:

192.168.0.15

Each number is called an octet, and each octet has 8 bits.

Pedro’s Analogy

  • City → first part of the IP
  • Neighborhood → next block
  • Building → third block
  • Apartment → last block

In networking terms, part of the IP identifies the network, and part identifies the host (the device).


What Is a Subnet Mask?

The subnet mask defines which part of the IP belongs to the network and which part belongs to the host.

Example:

  • IP Address: 192.168.0.15
  • Subnet Mask: 255.255.255.0

Where the mask is 255, that part is fixed (network).

Where the mask is 0, that part can change (host).

This means:

  • Network address: 192.168.0.0
  • Usable hosts: 192.168.0.1 to 192.168.0.254
  • Broadcast address: 192.168.0.255

The broadcast address is like a loudspeaker — every device in the network receives the message.


How This Works in Real Life

Think of an apartment building:

  • Building address → network
  • Apartment number → host
  • Message to all residents → broadcast

The subnet mask is like the ZIP code that defines who belongs to the same building.


IP Address Classes (Historical Context)

In the past, IPv4 addresses were divided into classes:

  • Class A: very large networks
  • Class B: medium networks
  • Class C: small networks
  • Class D: multicast
  • Class E: experimental

Today, we use CIDR notation instead of relying on classes.


CIDR and Prefix Notation

CIDR (Classless Inter-Domain Routing) uses a prefix to indicate how many bits belong to the network.

Example:

192.168.0.15/24

The /24 means:

  • 24 bits for the network
  • 8 bits for hosts

Calculating Network and Broadcast Addresses

Example

  • IP: 192.168.0.130
  • Mask: 255.255.255.192 (/26)

Step 1: Find the block size

Block size = 256 − 192 = 64

This means each subnet has 64 addresses.

Step 2: Identify the network

Possible blocks in the last octet:

0, 64, 128, 192

The IP 192.168.0.130 falls in the block starting at 128.

Network address:

192.168.0.128

Step 3: Find the broadcast

Next block starts at 192.

Broadcast = 192 − 1 = 191

Broadcast address:

192.168.0.191

Step 4: Host range

Usable hosts:

192.168.0.129 to 192.168.0.190

Summary:

  • Network: 192.168.0.128
  • Broadcast: 192.168.0.191
  • Hosts: 62

How to Check If Two Devices Are in the Same Network

Take both IPs and apply the subnet mask.

If the resulting network address is the same, they are in the same network.

Example:

  • 192.168.1.20/24 → Network: 192.168.1.0
  • 192.168.1.50/24 → Network: 192.168.1.0

They are in the same network.


Types of IPv4 Addresses

  • Public IP: visible on the internet, globally unique
  • Private IP: used inside local networks
    • 10.0.0.0 – 10.255.255.255
    • 172.16.0.0 – 172.31.255.255
    • 192.168.0.0 – 192.168.255.255
  • Loopback: 127.0.0.1 (the device talking to itself)
  • Network address: first IP in the subnet
  • Broadcast address: last IP in the subnet

Subnetting: Dividing Networks

Subnetting allows you to split a network into smaller parts by borrowing bits from the host portion.

Example:

  • 192.168.0.0/24 → 254 hosts
  • 192.168.0.0/26 → 4 subnets with 62 hosts each

This improves organization, performance, and security.


Worked Example

IP: 10.0.8.73/21

  • Network: 10.0.8.0
  • Broadcast: 10.0.15.255
  • Hosts: 2046

Challenge for You

IP: 172.16.35.200 / 255.255.255.240

Try to answer:

  • What is the network address?
  • What is the broadcast address?
  • How many usable hosts exist?
  • Is it in the same network as 172.16.35.210?

If you can solve this, you’re officially thinking like a network Guardian.

Deixe uma resposta

More Articles & Posts

Descubra mais sobre Cyber Heroes League

Assine agora mesmo para continuar lendo e ter acesso ao arquivo completo.

Continue reading