DEV Community

Kervie Sazon
Kervie Sazon

Posted on

Networking Fundamentals - Part 2: Subnetting & CIDR

What is a Subnet?

A subnet is a smaller network inside a bigger network.

Why subnetting exists?

  • To reduce network traffic
  • To improve security
  • To organize systems (apps, DBs, users)

What is CIDR?

CIDR = Classless Inter-Domain Routing
CIDR is the /number after an IP address.
Example:

192.168.1.10/24
Enter fullscreen mode Exit fullscreen mode

The /24 tells how big the network is.

For idea:
/16 - bigger network.
/24 - common, small network.
/32 - just one device.

Subnet Example

192.168.1.0/24
Enter fullscreen mode Exit fullscreen mode

It means:

  • All devices in this subnet start with 192.168.1
  • They can talk to each other directly.

Example of devices in the same subnet:

192.168.1.10
192.168.1.20
192.168.1.50
Enter fullscreen mode Exit fullscreen mode

Explanation:

“These servers are in the same subnet, so they can communicate without routing issues.”

If Devices Are in Different Subnets

Example:

Server A: 192.168.1.10/24
Server B: 192.168.2.10/24
Enter fullscreen mode Exit fullscreen mode

They are in different subnets.
Need a router to talk to each other.

Explanation:

"Ping fails because the servers are in different subnets.”

To See Subnet Info in Linux

Command:

ip addr
Enter fullscreen mode Exit fullscreen mode

Example Output:

10.0.2.15/24
Enter fullscreen mode Exit fullscreen mode

What to read?
IP Address: 10.0.2.15
Subnet size: /24

Very Important Special CIDR Values

/32
One single IP
Used for routes or security rules

/24
Most common subnet
Typical LAN or server subnet

/16
Large private network
Often used in cloud networks

Example Scenario

Problem:

“The app server can’t reach the database.”

Check:

ip addr
Enter fullscreen mode Exit fullscreen mode

Observation:

App: 10.0.1.10/24
DB: 10.0.2.10/24
Enter fullscreen mode Exit fullscreen mode

Conclusion

“They are in different subnets and need routing or firewall rules.”

Subnetting divides networks into smaller segments, and CIDR notation tells us the size of the network. Devices in the same subnet can communicate directly.

Today, I learned that a subnet is a smaller network inside a larger network, and CIDR notation tells us the size of the network. I understood that a /24 subnet is very common, and devices in the same subnet can communicate directly. I also learned that devices in different subnets need routing to talk to each other.
Tomorrow, I’m going to study default gateways and routing to see how networks connect across subnets.

Top comments (0)