Master Network Fundamentals: From Switches and MAC Learning to Static Routing
This guide explains how computers connect via cables, how switches use MAC addresses and learning tables to forward traffic, how routers employ IP addressing, subnet masks, CIDR and VLSM for scalable networks, and provides step‑by‑step static routing experiments with configuration commands.
Network Devices and Basic Connectivity
Two computers (A and B) can communicate directly over a network cable; each can send and receive all data from the other.
When more computers (C, D, E, …) join, simple cabling is insufficient, so layered networking is introduced.
Switches (Layer‑2 Devices)
Switches interconnect multiple hosts. Each host’s network card has a unique MAC address . When a host sends data, the frame header includes its source MAC address, allowing the switch to identify the sender.
The switch learns which MAC address is reachable on which port via a learning mechanism , populating a MAC address table and using it to forward frames only to the appropriate port.
Routers (Layer‑3 Devices)
As the network grows (adding computers F, G, H, …), switches cannot scale because their MAC tables become too large. Routers solve this by using IP addresses , which consist of a network number and a host number . The network number identifies a subnet, while the host number identifies a host within that subnet.
Routers have multiple interfaces, each connected to a different subnet. They forward packets based on the destination IP’s network number, consulting a routing table to determine the outgoing interface.
IP Addressing and Subnet Planning
An IPv4 address is a 32‑bit binary number usually written in dotted‑decimal form. IP addresses are divided into classful ranges (A, B, C) with fixed network‑bit lengths:
Class A : 8 network bits (1.0.0.0 – 126.255.255.255), mask 255.0.0.0 or /8.
Class B : 16 network bits (128.0.0.0 – 191.255.255.255), mask 255.255.0.0 or /16.
Class C : 24 network bits (192.0.0.0 – 223.255.255.255), mask 255.255.255.0 or /24.
Private address ranges are reserved for internal use:
Class A private: 10.0.0.0/8 Class B private: 172.16.0.0/12 Class C private:
192.168.0.0/16Subnet Masks and Network/Host Separation
A subnet mask indicates which bits of an IP address belong to the network portion (1) and which belong to the host portion (0). Performing a bitwise AND between an IP address and its mask yields the network (subnet) address.
CIDR and VLSM
Classful addressing can waste IP space. CIDR (Classless Inter‑Domain Routing) aggregates multiple contiguous subnets into a larger block, reducing routing table entries. VLSM (Variable Length Subnet Mask) allows subnets of different sizes to be carved from a larger network, matching the exact number of required host addresses.
Static Routing
Routers automatically generate directly connected routes . For non‑connected networks, administrators add static routes using a command such as:
ip route-static destination-address mask-length nexthop-addressStatic routes have a default priority of 60 and a cost of 0. They are stable and controllable but lack scalability and automatic adaptation to topology changes.
Routing Priorities and Load Balancing
When multiple routes to the same destination exist, the router selects the one with the lowest preference value (smaller = higher priority). If preferences are equal, the route with the smallest cost is chosen.
Two static routes with identical destination but different next‑hops can provide load‑balancing, though asymmetrical paths may affect applications.
Default Route
A default route (e.g., 0.0.0.0/0) matches any destination not covered by more specific routes, ensuring that unknown traffic is forwarded, typically to an upstream ISP.
Practical Lab: Static Routing Experiment
Using the ENSP simulator, the lab builds a topology with two PCs (PC1, PC2) and two routers (RT1, RT2). IP addresses are assigned to each interface, and static routes are added to enable communication across subnets.
Assign IP addresses to PCs and router interfaces (e.g., PC1 → 192.168.1.1/24, RT1 → 192.168.1.10/24, etc.).
Verify that each host can ping only devices in its own subnet.
Add a default gateway on PC1 and a static route on RT1 to reach the 192.168.2.0/24 network.
Observe that PC2 cannot reply because RT2 lacks a return route.
Add a default gateway on PC2 and a static route on RT2 back to 192.168.1.0/24.
After both directions are configured, PC1 can successfully ping PC2 and trace the path.
Floating Static Route Experiment
An additional link (192.168.4.0/24) connects RT1 and RT2. A floating static route with higher priority (value 50) is configured on RT1 to serve as the primary path, while the original static route (priority 60) becomes a backup. The lab also demonstrates equal‑cost static routes for load‑balancing.
Key Takeaways
Switches operate at Layer 2 using MAC addresses and learning tables.
Routers operate at Layer 3, forwarding based on IP network numbers and routing tables.
Proper subnet planning (CIDR/VLSM) prevents address waste.
Static routes provide deterministic forwarding but require careful configuration of both forward and return paths.
Routing priorities and costs determine which static routes are preferred.
References: TCP/IP Illustrated Volume 1 (W. Richard Stevens), Network Fundamentals (Tian Guo), Routing and Switching Technology (Liu Danning).
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
