Skip to main content

Understanding IP Addressing and Subnetting

Understanding IP Addressing and Subnetting Understanding IP Addressing and Subnetting

Understanding IP Addressing and Subnetting

by Linux Playground

What is an IP Address?

An Internet Protocol (IP) address is a unique numerical identifier assigned to each device connected to a network that uses the Internet Protocol for communication. Think of it as the digital equivalent of a home address, guiding data packets to their destination.

Types of IP Addresses

  • IPv4 (Internet Protocol version 4): Consists of 32 bits, divided into four octets. Commonly represented as dotted-decimal notation (e.g., 192.168.1.1). Supports approximately 4.3 billion unique addresses.
  • IPv6 (Internet Protocol version 6): Introduced to address IPv4 exhaustion. Consists of 128 bits, divided into eight groups of hexadecimal digits (e.g., 2001:0db8:85a3:0000:0000:8a2e:0370:7334). Supports a virtually unlimited number of unique addresses.

IP Address Classes

IPv4 addresses are categorized into classes to define the network portion and the host portion of the address:

Class Range Subnet Mask Suitable For
A 1.0.0.0 to 126.0.0.0 255.0.0.0 Large networks
B 128.0.0.0 to 191.255.0.0 255.255.0.0 Medium-sized networks
C 192.0.0.0 to 223.255.255.0 255.255.255.0 Small networks
D 224.0.0.0 to 239.255.255.255 N/A Multicast groups
E 240.0.0.0 to 255.255.255.255 N/A Experimental purposes

What is Subnetting?

Subnetting is the process of dividing a larger network into smaller, more manageable sub-networks or subnets. This practice enhances network performance and security.

Benefits of Subnetting

  • Improved Network Management: Smaller networks are easier to manage and troubleshoot.
  • Efficient IP Address Utilization: Prevents wastage of IP addresses by dividing networks based on actual needs.
  • Enhanced Security: Limits broadcast traffic, reducing the risk of network-wide attacks.

Subnet Masks

A subnet mask is used to identify the network and host portions of an IP address. It helps in determining which part of the address is used for network identification and which part is for device identification.

Common Subnet Masks

  • Class A Subnet Mask: 255.0.0.0
  • Class B Subnet Mask: 255.255.0.0
  • Class C Subnet Mask: 255.255.255.0

Calculating Subnets

To calculate subnets, one must understand the concept of borrowing bits from the host portion of the IP address to create subnetworks. For instance, in a Class C network (255.255.255.0), you can borrow bits from the last octet to create subnets:

Example:

  • Borrowing 2 bits from the last octet:
  • Subnet Mask: 255.255.255.192
  • Number of Subnets: 22 = 4
  • Number of Hosts per Subnet: 26 - 2 = 62

CIDR Notation

Classless Inter-Domain Routing (CIDR) is a method for allocating IP addresses and routing. CIDR notation is used to represent a subnet mask along with an IP address, simplifying the representation:

  • Example: 192.168.1.0/24
  • The "/24" indicates that the first 24 bits are used for the network portion.

© 2025 Linux Playground. All rights reserved.

Comments

Popular posts from this blog

Understanding sudo and su: A Comprehensive Guide

Understanding sudo and su: A Comprehensive Guide Understanding sudo and su : A Comprehensive Guide What is sudo ? The sudo (superuser do) command allows a permitted user to execute a command as the superuser or another user, as specified by the security policy. Essentially, sudo grants temporary administrative privileges to perform a specific task. Key Features of sudo : Granular Control: sudo allows system administrators to delegate limited root access to users, specifying exactly which commands they are permitted to run. Auditability: Every use of sudo is logged, providing a clear trail of who used sudo , what commands were executed, and when. Temporary Elevation: sudo grants elevated privileges for the duration of a single command, reducing the risk of accidental system-wide changes. Sec...

Using ping, traceroute, and netstat for Network Diagnostics

Using ping, traceroute, and netstat for Network Diagnostics Using ping, traceroute, and netstat for Network Diagnostics In the complex world of networking, diagnosing and troubleshooting issues is essential for maintaining a healthy and efficient network. Three fundamental tools often used for these purposes are ping , traceroute , and netstat . Each of these utilities offers unique insights into network performance and connectivity. Let's dive into their functionalities, use cases, and how they can be employed effectively. 1. Ping: Checking Connectivity and Latency The ping command is one of the most straightforward and commonly used network diagnostic tools. It tests the reachability of a host on an Internet Protocol (IP) network and measures the round-trip time for messages sent from the source to a destination computer. How It Works: The ping command sends Inte...

Special File Permissions: setuid and setgid

Special File Permissions: setuid and setgid Special File Permissions: setuid and setgid Setuid (Set User ID) The setuid permission is used primarily for executable files. When setuid is applied to a file, it allows users to run the file with the file owner's privileges. This is particularly useful for executing programs that require higher privileges to perform certain operations. How It Works When a user executes a setuid program, the operating system sets the effective user ID of the process to that of the file owner. Example -rwsr-xr-x 1 root root 53232 Jan 14 09:32 /usr/bin/passwd The passwd command, used to change user passwords, typically has the setuid bit set. This allows it to modify system password files which are normally only accessible by the root user. ...