🌐 Basic Networking Tutorial (IP, Subnet, CIDR, MAC Address)

🧠 Easy Analogy (Must Read First!)

Think of networking like a city postal system:

  • 🏠 IP Address = Your house address (where data goes)
  • 🧍 MAC Address = Your identity (who you are physically)
  • 🏘️ Subnet = Your neighborhood
  • πŸ“¦ CIDR = How big your neighborhood is (how many houses)

πŸ“Œ 1. What is an IP Address?

An IP Address (Internet Protocol Address) is a unique number assigned to every device on a network.

Types:

  • IPv4 β†’ 192.168.1.1
  • IPv6 β†’ 2001:0db8:85a3::8a2e:0370:7334

Key Points:

  • Identifies device location
  • Required for communication over internet

πŸ“Œ 2. What is a MAC Address?

A MAC Address (Media Access Control) is a physical hardware address of your device.

Example:

  • 00:1A:2B:3C:4D:5E

Key Points:

  • Assigned by manufacturer
  • Unique per device
  • Works at data link layer

πŸ“Œ 3. Difference Between IP and MAC

Feature IP Address 🌐 MAC Address πŸ”§
Type Logical Physical
Changes? Yes (dynamic/static) No (fixed)
Purpose Identify network Identify device
Layer Network Layer Data Link Layer

πŸ“Œ 4. What is a Subnet?

A Subnet (Subnetwork) divides a large network into smaller parts.

Example:

  • Network: 192.168.1.0
  • Subnet Mask: 255.255.255.0

πŸ‘‰ This means: - First 3 parts = network - Last part = devices

Why use subnet?

  • Better organization
  • Improved security
  • Reduced network traffic

πŸ“Œ 5. What is CIDR?

CIDR (Classless Inter-Domain Routing) is a compact way to represent IP ranges.

Format:

  • 192.168.1.0/24

Meaning:

  • /24 β†’ first 24 bits are network
  • Remaining bits β†’ devices

Common CIDR Values:

CIDR Subnet Mask Devices
/24 255.255.255.0 256
/16 255.255.0.0 65,536
/8 255.0.0.0 Huge

πŸ“Œ 6. How Everything Works Together

Step-by-step:

  1. You enter a website (e.g., google.com)
  2. DNS converts it β†’ IP address
  3. Your device finds MAC address using ARP. πŸ‘‰ ARP = Finds MAC address from IP so data can be delivered locally
  4. Data is sent across network using:
  5. IP β†’ destination
  6. MAC β†’ actual device delivery

πŸ“Œ 7. Practical Commands

Check IP Address:

- ipconfig     # Windows
- ifconfig     # Linux/Mac

Check MAC Address:

- getmac       # Windows
- ip link      # Linux

🎯 Final Summary

IP = Where you are
MAC = Who you are
Subnet = Your group
CIDR = Group size

πŸš€ Why You Should Care

Hosting a website β†’ IP matters
Debugging internet β†’ MAC matters
Using VPS β†’ CIDR & subnet matter

πŸ“Œ What’s Next?

πŸ‘‰ Part 2: How Internet Works (Step-by-Step)