Fundamentals of Network Devices and CIDR
Understanding how data moves across a computer network is essential for anyone studying computer science or preparing for networking certifications. This course breaks down the core concepts behind common network devices, the way they handle MAC and IP addresses, and the fundamentals of Classless Inter‑Domain Routing (CIDR). By the end of the lesson you will be able to answer practical quiz questions, calculate usable host addresses, and differentiate between private and public IP spaces.
1. Core Network Devices
Network infrastructure is built from a handful of devices, each with a specific role in the OSI model. The most frequently encountered devices are NICs, hubs, switches, and routers. Below is a concise overview.
- Network Interface Card (NIC) – Operates at Layer 2 (Data Link). It attaches a host to the physical medium and processes frames based on MAC addresses. In promiscuous mode a NIC accepts every frame, regardless of the destination MAC.
- Hub – A simple Layer 1 device that repeats incoming electrical signals to all ports. Because it broadcasts every frame, all attached devices share the same collision domain and total bandwidth.
- Switch – A Layer 2 device that maintains a MAC address table. It forwards frames only to the port associated with the destination MAC. When the destination MAC is unknown, the switch floods the frame out all ports except the one it arrived on.
- Router – Operates at Layer 3 (Network). It uses a routing table to forward packets based on IP addresses, not MAC addresses. Routers also perform Network Address Translation (NAT) between private and public networks.
Why a Hub Can Cause Bandwidth Bottlenecks
When four computers connect to a hub, the total bandwidth of the hub (e.g., 100 Mbps) is shared among all active devices. If two computers transmit simultaneously, each effectively receives only half of the hub’s capacity. This shared‑medium behavior contrasts sharply with a switch, where each port can operate in full‑duplex mode, providing a dedicated 100 Mbps channel to each device.
2. MAC Address Handling and Frame Delivery
Every Ethernet frame carries a source and destination MAC address. Devices use these addresses to decide whether to accept or forward a frame.
- If the destination MAC matches the NIC’s own address (or the broadcast address
FF-FF-FF-FF-FF-FF), the NIC processes the frame. - If the NIC is in promiscuous mode, it accepts all frames, which is useful for network monitoring tools like Wireshark.
- Switches consult their MAC address table. When the table lacks an entry, the switch floods the frame to every port except the incoming one, ensuring the destination device eventually receives it.
These mechanisms explain why a hub broadcasting frames can cause two computers on the same LAN to see each other’s traffic, while a properly configured switch isolates traffic.
3. Routing vs. Switching: IP vs. MAC
Switches and routers make forwarding decisions at different layers:
- Switch – Uses a MAC address table to forward frames within the same broadcast domain.
- Router – Uses a routing table to forward IP packets between distinct networks. The router strips the original Ethernet frame, examines the IP header, and encapsulates the packet in a new frame appropriate for the next hop.
Because routers operate on IP addresses, they are the only devices that can connect a private LAN to the public Internet, applying NAT to translate private IPs to a single public address.
4. CIDR and Subnetting Basics
Classless Inter‑Domain Routing (CIDR) replaces the old class‑based system with a flexible prefix length notation, such as 192.168.1.0/24. The number after the slash indicates how many bits belong to the network portion of the address.
Calculating Usable Host Addresses
To determine the number of usable hosts in a CIDR block:
- Calculate the total number of addresses:
2^(32 - prefix). - Subtract 2 for the network address (all host bits zero) and the broadcast address (all host bits one).
For 192.168.1.0/24, the calculation is 2^(32‑24) = 256 total addresses, minus 2, yielding 254 usable host addresses. This matches the quiz answer.
Identifying Subnet Membership
To check whether an IP belongs to a given CIDR subnet, perform a bitwise AND between the IP and the subnet mask. For example, the subnet 172.22.20.159/21 has a mask of 255.255.248.0. Applying the mask to candidate addresses shows that 172.22.22.45 falls within the same /21 range, while the other options do not.
5. Private vs. Public IP Addresses
Home networks typically use private IP address ranges defined by RFC 1918:
- 10.0.0.0 – 10.255.255.255 (/8)
- 172.16.0.0 – 172.31.255.255 (/12)
- 192.168.0.0 – 192.168.255.255 (/16)
These addresses are not routable on the public Internet. The public IP address is assigned by the Internet Service Provider (ISP) to the router’s WAN interface. The router then uses NAT to map many private addresses to the single public address, allowing all internal devices to access external resources.
Key distinction:
- Private addresses are assigned locally (often by the home router’s DHCP server).
- Public addresses are allocated by the ISP and must be unique across the Internet.
6. Applying Concepts: Quiz Walkthrough
Below we revisit each quiz question, explain why the correct answer is right, and reinforce the underlying concept.
Question 1 – Unexpected MAC Reception
Two computers on the same LAN see each other’s frames. The device causing this is a hub, which broadcasts every incoming frame to all ports. Unlike a switch, a hub does not filter based on MAC addresses, so every attached NIC receives the traffic.
Question 2 – Usable Hosts in a /24 Block
As shown earlier, a /24 network provides 254 usable host addresses. The calculation subtracts the network and broadcast addresses from the total of 256.
Question 3 – Switch Action on Unknown MAC
When a switch’s MAC table lacks an entry for the destination, it floods the frame out all other ports. This ensures the frame reaches its intended recipient while the switch learns the new MAC‑port mapping.
Question 4 – Private vs. Public Assignment
The correct statement is that private addresses are assigned by the router (often via DHCP), while the public address comes from the ISP. This reflects the typical home‑network topology.
Question 5 – Subnet Membership in a /21 Network
Only 172.22.22.45 shares the same /21 prefix as 172.22.20.159. The other candidates fall outside the 8‑address block defined by the mask 255.255.248.0.
Question 6 – Broadcast MAC Handling
The MAC address FF-FF-FF-FF-FF-FF is the Ethernet broadcast address. All NICs accept frames with this destination, regardless of mode, because it signals a network‑wide broadcast.
Question 7 – Bandwidth Sharing on a Hub
When multiple devices transmit through a hub, they share the same total bandwidth. As more devices become active, the per‑device throughput decreases, which is why modern networks favor switches.
Question 8 – Device Using a Routing Table
A router forwards packets based on its routing table, which maps destination IP prefixes to next‑hop interfaces. Neither NICs, hubs, nor switches use IP‑level routing tables.
7. Practical Tips for Network Design
- Prefer switches over hubs to eliminate collisions and provide full‑duplex bandwidth per port.
- Enable port security on switches to prevent MAC‑address spoofing.
- When planning subnets, always reserve two addresses per block for network and broadcast identifiers.
- Document your CIDR allocations; a clear naming convention (e.g.,
10.0.0.0/16 – Corporate LAN) simplifies troubleshooting. - Use DHCP reservations for critical devices (servers, printers) to keep IP assignments predictable.
8. Summary
This course covered the essential differences between hubs, switches, NICs, and routers, explained how MAC and IP addresses guide traffic, and demonstrated CIDR calculations for host capacity and subnet membership. By mastering these fundamentals, you can confidently design, troubleshoot, and secure small‑to‑medium networks, and you are now prepared to answer quiz questions that test real‑world networking knowledge.