π‘ Networking: Interfaces & MAC Addresses
π What are Network Interfaces?
A network interface is the point where a computing device connects to a network. Itβs the hardware or software that handles the sending and receiving of data. Every device that connects to a networkβlike a laptop, smartphone, or serverβhas at least one network interface.
π Types of Network Interfaces
-
Physical Interfaces These are hardware components built for network connectivity.
- Ethernet Card (NIC): A card with a port for a network cable, used for wired connections on a Local Area Network (LAN).
- Wi-Fi Adapter: The hardware that enables a device to connect to a wireless network (WLAN).
- Bluetooth Adapter: Allows devices to connect wirelessly over short distances, often used for peripherals like keyboards and mice.
- Cellular Modem: Used in mobile devices to connect to cellular networks (e.g., 4G, 5G).
- Fiber Optic Interface: Used for high-speed internet connections, typically in enterprise environments.
- USB Network Adapter: A portable adapter that connects to a USB port to provide network connectivity, often used for laptops or devices without built-in Ethernet ports.
-
Virtual Interfaces These are software-based interfaces that donβt correspond to a physical piece of hardware.
- Loopback Interface (
lo): A virtual interface that always points back to the device itself (often with the IP127.0.0.1). Itβs used for testing and local service communication. - VPN Interface: When you connect to a VPN, your system creates a virtual interface that represents the secure connection tunnel.
- Loopback Interface (
π·οΈ What is a MAC Address?
A MAC (Media Access Control) address is a unique hardware identifier assigned to a physical network interface by the manufacturer. Itβs often called the physical address or hardware address.
π’ MAC Address Format
A MAC address is a 48-bit number, typically written as six pairs of hexadecimal characters separated by colons or hyphens.
- Example:
3C:A6:2B:9A:E4:F1 - Structure:
- OUI (Organizationally Unique Identifier): The first three pairs (
3C:A6:2B) identify the manufacturer (e.g., Apple, Intel). - Device Identifier: The last three pairs (
9A:E4:F1) are a unique serial number assigned by the manufacturer.
- OUI (Organizationally Unique Identifier): The first three pairs (
π MAC Address vs. IP Address
This is a critical distinction in networking.
| Feature | MAC Address | IP Address |
|---|---|---|
| Analogy | Chassis Number of a car | License Plate of a car |
| Layer | Data Link Layer (Layer 2) | Network Layer (Layer 3) |
| Scope | Used for communication on the same local network (LAN) | Used for communication between different networks (Internet) |
| Assignment | Fixed, burned into hardware | Can be dynamic and change based on the network |
| Purpose | Identifies the device | Identifies the deviceβs location on a network |
In simple terms, a switch uses MAC addresses to send data to the correct device on a local network, while a router uses IP addresses to send data to the correct network across the internet.