Understanding Networking Fundamentals: IP Addresses, Subnets, and More

TLDR: This blog post explains the fundamental concepts of networking, including IP addresses, subnets, and CIDR notation, in a simple and engaging manner. It covers how devices connect to networks, the significance of unique IP addresses, the importance of subnetting for security, and how to calculate CIDR ranges for effective network management.

Networking can often seem complex, filled with terms like IP address, subnet, CIDR range, and the OSI model. However, these concepts are essential for anyone working in technology, especially in roles like DevOps, data engineering, or full-stack development. In this blog post, we will break down these fundamental networking concepts in a simple and understandable way.

IP add → helps us to unique identify device(mobile,laptop) → defined by IPv4 standard → (ipconfig command)
192.168.1.1. → each no is separated by dot(.) →
each no → 1 bytes → 8bits → 0-255
so total 4 bytes → 32 bits → octet format
subnet → dividing network into smaller parts —→ network → divided into 2 parts → 2 subnet
eg : 65k ip add → 1st subnet only require 256 ip add → finance , 2nd subnet has remaining ip add → all(wifi)
now how to assign ip add to each subnet ? → CIDR
private → no internet access public → internet access
192.168.1.0/27 ——> CIDR = 32-27 =5 —> 2^5 → 32
192.168.1.0/n ——> CIDR = (2^(32-n))
port → unique no for your application
URL → http://192.168.1.1:8080 → port =8080

What is an IP Address?

An IP address serves as a unique identifier for a device connected to a network. Think of it as a home address for your devices. For example, in a household with multiple devices connected to a Wi-Fi network, each device needs a unique IP address to communicate effectively.

Example of IP Address Usage

Imagine a home network with four devices: two smartphones and two laptops. If one of these devices makes a payment online, you would want to track which device was used. Without unique IP addresses, it would be impossible to identify the device responsible for the transaction. Thus, each device is assigned a unique IP address, allowing for tracking and management of network access.

Format of IP Addresses

IP addresses are typically represented in the IPv4 format, which consists of four numbers separated by dots, such as 192.168.1.1. Each number can range from 0 to 255, allowing for a vast number of unique addresses. The reason for the 0-255 range is that each number in an IP address is represented by one byte (8 bits), and the maximum value for a byte is 255.

Understanding Subnets

Subnets are a way to divide a larger network into smaller, manageable sections. This is particularly useful for security and organization within a network. For instance, in a corporate environment, you might have a subnet for finance-related activities and another for general employee access.

Importance of Subnetting

If a hacker gains access to one device on a network, they could potentially access all devices connected to that network. By creating subnets, you can isolate sensitive information and reduce the risk of a widespread breach. For example, if the finance team has its own subnet, even if a hacker compromises a device on a general access subnet, they would not have access to the finance subnet.

Types of Subnets

There are two main types of subnets:

  • Private Subnet: Does not have access to the internet. Used for sensitive data and internal communications.

  • Public Subnet: Has access to the internet. Used for general access and services that need to be reachable from outside the network.

CIDR Notation

CIDR (Classless Inter-Domain Routing) notation is a method for allocating IP addresses and IP routing. It allows for more efficient use of IP addresses compared to traditional class-based addressing.

How CIDR Works

When creating a subnet, you specify a CIDR range, which indicates how many IP addresses are available in that subnet. For example, if you need 256 IP addresses, you might use a CIDR notation like 172.16.3.0/24. The /24 indicates that the first 24 bits of the address are fixed, leaving the last 8 bits available for device addresses.

Calculating CIDR Ranges

To determine how many IP addresses a CIDR range can provide, you can use the formula: 2^(32 - n), where n is the number after the slash in the CIDR notation. For example, a /24 subnet provides 256 addresses (2^(32-24) = 256).

Understanding Ports

In networking, ports are used to identify specific processes or services on a device. Each application running on a device can be assigned a unique port number, allowing multiple applications to run simultaneously without conflict.

Example of Port Usage

When accessing a web application, you might see a URL like http://192.168.1.1:8080. Here, 8080 is the port number that directs the request to the correct application on the server. Common port numbers are reserved for specific services, so it's important to choose unique port numbers for your applications to avoid conflicts.

ip address

subnet

CIDR range

ports

Conclusion

In this blog post, we have covered the essential concepts of networking, including IP addresses, subnets, CIDR notation, and ports. Understanding these fundamentals is crucial for anyone working in technology, as they form the backbone of how devices communicate and interact within networks. In the next part of this series, we will delve into the OSI model and explore more advanced networking topics. Stay tuned!