Understanding Subnetting: IP Addresses, Routers, and the Difference Between IP and MAC Addresses

Hey everyone, it’s alanturrr1703 back again! 😄 Today, we’re going to explore a critical concept in networking: Subnetting. Subnetting allows networks to be divided into smaller, more manageable segments, helping to improve efficiency and security. We’ll break down what subnetting is, explain how IP addresses are assigned to routers, and clarify the difference between IP addresses and MAC addresses.

We’ll also use diagrammatic examples to explain subnetting and show how networks are segmented in practice. Let’s dive in! 🚀

What is Subnetting?

Subnetting is the process of dividing a large network into smaller, more efficient subnetworks (subnets). This helps in managing IP addresses more effectively and reduces network congestion. Each subnet is like a smaller network within a larger one, and it’s easier to handle local traffic and security.

The IP address consists of two parts:

  1. Network part: Identifies the specific network.
  2. Host part: Identifies the devices (hosts) on that network.

Why Subnetting Is Important:

  • Efficient Use of IP Addresses: Subnetting allows more granular allocation of IP addresses.
  • Improved Performance: Reducing the size of each subnet decreases network congestion.
  • Enhanced Security: Segmentation limits traffic to specific subnets, reducing the chance of network-wide attacks.

How Subnetting Works:

Let’s take a simple IP address example: 192.168.10.15/24.

  • 192.168.10.15 is the IP address.
  • /24 is the subnet mask, meaning the first 24 bits represent the network portion and the last 8 bits represent the host portion.

This address belongs to the network 192.168.10.0, and the host ID 15 represents the specific device in that network.

Example of a Subnet:

Network: 192.168.10.0/24
Subnet Mask: 255.255.255.0

This subnet has a network portion of 192.168.10 and can support up to 254 devices (from 192.168.10.1 to 192.168.10.254), where 192.168.10.0 is the network address and 192.168.10.255 is the broadcast address.

How Subnetting Divides Networks: A Simple Example

Problem: Divide a Network into Subnets

Let’s say you are given the network 192.168.1.0/24, and you want to divide it into four smaller subnets.

Step 1: Subnet Mask Calculation

You start with the subnet mask /24 (which corresponds to 255.255.255.0). This gives you a total of 256 addresses (2^8 = 256) in the original network.

To divide the network into four subnets, we need to borrow two bits from the host portion of the address. This gives us the following subnet mask:

New Subnet Mask: /26 (255.255.255.192)

Step 2: Calculate the Number of Subnets

With two additional subnet bits, we can create four subnets (2^2 = 4). The remaining six bits are for hosts, which gives us 2^6 = 64 total addresses per subnet, with 62 usable host addresses (excluding the network and broadcast addresses).

Step 3: Subnet Breakdown

Here are the four subnets:

Subnet Subnet Address Usable IP Range Broadcast Address
Subnet 1 192.168.1.0/26 192.168.1.1 – 192.168.1.62 192.168.1.63
Subnet 2 192.168.1.64/26 192.168.1.65 – 192.168.1.126 192.168.1.127
Subnet 3 192.168.1.128/26 192.168.1.129 – 192.168.1.190 192.168.1.191
Subnet 4 192.168.1.192/26 192.168.1.193 – 192.168.1.254 192.168.1.255

Now, each subnet has 62 usable IP addresses and is neatly segmented.

Diagram for Visual Understanding:

Original Network: 192.168.1.0/24
|
|-- Subnet 1: 192.168.1.0/26
|-- Subnet 2: 192.168.1.64/26
|-- Subnet 3: 192.168.1.128/26
|-- Subnet 4: 192.168.1.192/26

How Routers Are Assigned IP Addresses

When it comes to routers, each router interface (both LAN and WAN) must have an IP address assigned. In a subnetted network, each router acts as a gateway between subnets.

Assigning IP Addresses to Routers:

Let’s say you have a router that connects two subnets:

  1. Subnet 1: 192.168.1.0/24
  2. Subnet 2: 192.168.2.0/24

The router needs an IP address for each network it connects:

  • Interface for Subnet 1: Assign 192.168.1.1
  • Interface for Subnet 2: Assign 192.168.2.1

The devices on each subnet will use the router’s IP as their default gateway for accessing other networks.

Example of IP Assignment:

Network 1 (192.168.1.0/24) --- [192.168.1.1] Router [192.168.2.1] --- Network 2 (192.168.2.0/24)

This allows the router to forward packets between the two subnets.

The Difference Between IP and MAC Addresses

While IP addresses are used to identify devices on a network and facilitate communication between networks, MAC addresses are used to uniquely identify devices at the hardware level.

What Is a MAC Address?

A MAC (Media Access Control) address is a unique identifier assigned to network interfaces. Every device that connects to a network (such as your phone, laptop, or printer) has a MAC address. It’s burned into the hardware and typically looks like this: 00:1A:2B:3C:4D:5E.

MAC addresses operate at the Data Link Layer (Layer 2) of the OSI model, and they are essential for communication within a local network (LAN).

How IP and MAC Addresses Work Together:

  1. IP Addresses: Used to route packets across the internet (Layer 3).
  2. MAC Addresses: Used to route packets within a local network (Layer 2).

When you send data across a network, the data is first directed to the destination IP address. Once the data reaches the destination network, the router uses the destination MAC address to deliver the data to the correct device on that network.

Example of IP vs MAC Addresses:

  • IP Address: 192.168.1.5 – Logical address used to route data across networks.
  • MAC Address: 00:1A:2B:3C:4D:5E – Physical address used to deliver data within the local network.

ARP (Address Resolution Protocol)

To bridge the gap between IP addresses and MAC addresses, the ARP protocol is used. When a device wants to send data to an IP address within the local network, it sends an ARP request to get the MAC address associated with that IP. The device with the matching IP replies with its MAC address, and the communication can proceed.

Diagrammatic Example of Subnetting

Let’s visualize a scenario where we have a network 10.0.0.0/24 that needs to be divided into two subnets:

  1. Subnet A: For the admin team.
  2. Subnet B: For the engineering team.
Original Network: 10.0.0.0/24
|
|-- Subnet A: 10.0.0.0/25 (Admin) [Usable IPs: 10.0.0.1 – 10.0.0.126]
|-- Subnet B: 10.0.0.128/25 (Engineering) [Usable IPs: 10.0.0.129 – 10.0.0.254]
  • Subnet A has 126 usable IP addresses (from 10.0.0.1 to 10.0.0.126).
  • Subnet B has 126 usable IP addresses (from 10.0.0.129 to 10.0.0.254).

Each subnet is assigned its own range of IP addresses, and a router with interfaces in each subnet can route traffic between them.

Wrapping It Up

In

this blog, we covered the basics of subnetting and how it helps manage networks efficiently by dividing them into smaller subnets. We learned how IP addresses are assigned to routers and how subnets are created by modifying the subnet mask. We also clarified the difference between IP addresses and MAC addresses, explaining how they work together in data communication.

Understanding subnetting is essential for network administrators, as it allows you to optimize IP address usage and improve network performance. Whether you’re managing a large corporate network or setting up a home lab, mastering subnetting will give you the tools to handle networks more effectively.

That’s all for today! I hope this post helped you grasp the fundamentals of subnetting and networking. Until next time, happy networking! 🚀