Network Hardware Switches Routers Hubs
Category: Network Fundamentals
Type: Network Concepts
Generated on: 2025-07-10 08:54:56
For: Network Engineering, Administration & Technical Interviews
Network Hardware Cheatsheet: Switches, Routers, Hubs
Section titled “Network Hardware Cheatsheet: Switches, Routers, Hubs”This cheatsheet provides a comprehensive overview of network hardware, focusing on hubs, switches, and routers. It’s designed for both students learning network fundamentals and professionals seeking a quick reference.
- Hub: A simple, outdated device that connects multiple network devices in a shared collision domain. It blindly broadcasts data to all connected devices.
- Switch: A more intelligent device than a hub that learns MAC addresses and forwards data only to the intended recipient, reducing collisions and improving network performance. Operates at Layer 2 (Data Link Layer) of the OSI model.
- Router: Connects different networks together (e.g., your home network to the internet). It uses IP addresses to route data packets between networks. Operates at Layer 3 (Network Layer) of the OSI model.
Importance: These devices are fundamental to creating and managing functional computer networks. Understanding their operation is crucial for designing, troubleshooting, and securing networks.
| Concept | Description | Device(s) |
|---|---|---|
| Collision Domain | A network segment where devices compete for bandwidth and data collisions can occur. | Hub |
| Broadcast Domain | A network segment where a broadcast message is received by all devices. | Hub, Switch |
| MAC Address | A unique hardware address assigned to a network interface card (NIC). Used by switches to learn device locations. | Switch |
| IP Address | A logical address assigned to a device on a network. Used by routers to route traffic between networks. | Router |
| Routing Table | A table maintained by a router that contains information about network destinations and the best path to reach them. | Router |
| ARP | Address Resolution Protocol. Used to map IP addresses to MAC addresses. | Switch, Router |
| CAM Table (MAC Address Table) | A table maintained by a switch that maps MAC addresses to switch ports. | Switch |
| VLAN | Virtual Local Area Network. A logical grouping of devices that allows you to segment a network without requiring physical separation. | Switch |
| Subnet | A logical subdivision of an IP network. | Router |
| Default Gateway | The IP address of the router that a device uses to send traffic to destinations outside its local network. | Router |
| OSI Model | A conceptual model that describes the functions of a networking system. Hubs operate at Layer 1 (Physical), Switches at Layer 2 (Data Link), Routers at Layer 3 (Network). | All |
- A device sends a packet to the hub.
- The hub blindly broadcasts the packet to all connected devices.
- Only the intended recipient processes the packet. Other devices discard it.
Device A --(Packet)--> Hub --(Packet)--> Device B | | +--(Packet)--> Device C | +--(Packet)--> Device D- Problem: Collisions are frequent, especially with many devices.
Switch
Section titled “Switch”- A device (A) sends a packet to the switch for device (B).
- The switch checks its CAM table (MAC address table).
- If B’s MAC address is known, the switch forwards the packet only to the port connected to device B.
- If B’s MAC address is unknown, the switch floods the packet to all ports (except the originating port) to learn B’s location. This is called flooding or unknown unicast. Device B will respond, and the switch will add B’s MAC address and port to its CAM table.
- Future packets to B will be forwarded directly.
Device A --(Packet)--> Switch --(Packet)--> Device B | +-- (No Packet) -> Device C (unless flooding) | +-- (No Packet) -> Device D (unless flooding)- Learning MAC Addresses: The switch learns by examining the source MAC address of incoming frames.
- Forwarding: The switch forwards based on the destination MAC address.
Router
Section titled “Router”- A device (A) sends a packet to the router, destined for a device (C) on a different network.
- The router examines the destination IP address of the packet.
- The router consults its routing table to determine the best path to reach the destination network.
- The router forwards the packet to the next hop router or the destination network directly.
- The router decrements the TTL (Time To Live) field in the IP header. If TTL reaches 0, the packet is dropped to prevent routing loops.
- The router may perform NAT (Network Address Translation) to translate private IP addresses to public IP addresses.
Device A (Network 1) --(Packet)--> Router --(Packet)--> Internet/Router --(Packet)--> Device C (Network 2)- Routing Table: A router’s routing table contains entries that specify the destination network, the next hop router, and the metric (cost) of the path.
- Routing Protocols: Routers use routing protocols (e.g., RIP, OSPF, BGP) to exchange routing information and build their routing tables.
ARP (Address Resolution Protocol)
Section titled “ARP (Address Resolution Protocol)”- Purpose: Resolves IP addresses to MAC addresses. A device needs to know the MAC address of the destination to send a frame.
- Process:
- Device A wants to send a packet to IP address 192.168.1.10 (Device B).
- Device A checks its ARP cache. If it doesn’t have the MAC address for 192.168.1.10, it sends an ARP broadcast request: “Who has 192.168.1.10? Tell 192.168.1.1 (Device A).”
- Device B receives the ARP request and responds with an ARP reply: “192.168.1.10 is at MAC address 00:11:22:33:44:55.”
- Device A caches the MAC address in its ARP cache and can now send the packet.
[ARP Request]Hardware Type: EthernetProtocol Type: IPv4Hardware Address Length: 6Protocol Address Length: 4Sender MAC Address: AA:BB:CC:DD:EE:FFSender IP Address: 192.168.1.1Target MAC Address: 00:00:00:00:00:00 (Unknown)Target IP Address: 192.168.1.10
[ARP Reply]Hardware Type: EthernetProtocol Type: IPv4Hardware Address Length: 6Protocol Address Length: 4Sender MAC Address: 00:11:22:33:44:55Sender IP Address: 192.168.1.10Target MAC Address: AA:BB:CC:DD:EE:FFTarget IP Address: 192.168.1.1Ethernet Frame (Simplified)
Section titled “Ethernet Frame (Simplified)”+-------------------+--------------------+-------------------+---------------------+-------+| Destination MAC | Source MAC | EtherType/Length | Payload (IP Packet) | FCS |+-------------------+--------------------+-------------------+---------------------+-------+| 6 bytes | 6 bytes | 2 bytes | Up to 1500 bytes | 4 bytes|+-------------------+--------------------+-------------------+---------------------+-------+- Destination MAC: MAC address of the intended recipient.
- Source MAC: MAC address of the sender.
- EtherType: Indicates the type of data in the payload (e.g., 0x0800 for IPv4).
- Payload: The actual data being transmitted (often an IP packet).
- FCS (Frame Check Sequence): Used for error detection.
IP Packet (Simplified)
Section titled “IP Packet (Simplified)”+---------+--------+--------+------------+--------+--------+-----------+------------+------+| Version | IHL | DSCP | Total Length| Identification | Flags | Fragment Offset | TTL | Protocol | Header Checksum | Source IP | Destination IP | Payload |+---------+--------+--------+------------+--------+--------+-----------+------------+------+| 4 bits | 4 bits | 6 bits | 16 bits | 16 bits | 3 bits | 13 bits | 8 bits | 8 bits | 16 bits | 32 bits | 32 bits | Variable |+---------+--------+--------+------------+--------+--------+-----------+------------+------+-
Version: IP version (e.g., 4 for IPv4, 6 for IPv6).
-
TTL (Time To Live): Limits the number of hops a packet can take to prevent routing loops.
-
Protocol: Indicates the protocol used in the payload (e.g., 6 for TCP, 17 for UDP).
-
Source IP: IP address of the sender.
-
Destination IP: IP address of the intended recipient.
-
Home Network: A router connects your home network to the internet. A switch connects your computers, phones, and other devices within your home network.
-
Small Business: A router connects the business network to the internet. A switch connects computers, printers, and servers within the local network. VLANs can be used to segment the network for security or organizational purposes (e.g., separate VLANs for employees, guests, and servers).
-
Enterprise Network: Multiple routers connect different branch offices. Switches provide connectivity within each office. Advanced routing protocols (e.g., BGP) are used to manage traffic flow between networks. Firewalls are used to secure the network perimeter.
-
Data Center: High-performance switches and routers are used to connect servers and storage devices. Redundancy is crucial to ensure high availability.
| Issue | Device(s) | Troubleshooting | Solution |
|---|---|---|---|
| Network Congestion/Slow Performance | Hub, Switch, Router | Check network utilization, identify bandwidth bottlenecks, use network monitoring tools (e.g., ping, traceroute, iperf). | Upgrade network hardware, implement QoS (Quality of Service) to prioritize traffic, segment the network with VLANs, optimize routing protocols. |
| IP Address Conflicts | Router | Check IP address assignments, use DHCP server to automatically assign IP addresses, use ipconfig (Windows) or ifconfig (Linux/macOS) to check IP address settings. | Configure DHCP properly, use static IP addresses for critical devices (e.g., servers, printers), ensure that no two devices have the same IP address. |
| Routing Loops | Router | Use routing protocols with loop prevention mechanisms (e.g., OSPF, EIGRP), check routing table configuration, use traceroute to identify routing paths. | Configure routing protocols correctly, implement route summarization, use default routes, configure loop prevention features. |
| Broadcast Storms | Hub, Switch | Identify the source of the broadcast traffic, use network analyzers (e.g., Wireshark) to capture and analyze broadcast packets. | Implement Spanning Tree Protocol (STP) to prevent loops in switched networks, configure broadcast storm control on switches. |
| ARP Poisoning/Spoofing | Switch, Router | Use ARP inspection features on switches, implement DHCP snooping, use static ARP entries for critical devices. | Configure switch security features to prevent ARP attacks, use intrusion detection systems (IDS) to detect malicious ARP traffic. |
| Switch Port Errors | Switch | Check switch port status, examine switch logs, use cable testers to verify cable integrity. | Replace faulty cables, disable and re-enable switch ports, upgrade switch firmware. |
| High CPU/Memory Utilization | Router, Switch | Monitor CPU and memory usage, identify processes consuming resources, check for configuration errors or software bugs. | Upgrade hardware, optimize configuration, apply software patches, restart the device. |
These examples use a Cisco-like CLI. Syntax may vary depending on the vendor.
Switch Configuration (Basic VLAN)
Section titled “Switch Configuration (Basic VLAN)”! Configure VLAN 10configure terminalvlan 10name Employeesexit
! Configure VLAN 20vlan 20name Guestsexit
! Assign port Gi0/1 to VLAN 10interface GigabitEthernet0/1switchport mode accessswitchport access vlan 10exit
! Assign port Gi0/2 to VLAN 20interface GigabitEthernet0/2switchport mode accessswitchport access vlan 20exit
! Configure trunk port Gi0/24 for all VLANsinterface GigabitEthernet0/24switchport mode trunkswitchport trunk encapsulation dot1qswitchport trunk allowed vlan allexit
! Show VLAN informationshow vlan briefRouter Configuration (Basic Static Routing)
Section titled “Router Configuration (Basic Static Routing)”! Configure interface IP addressesconfigure terminalinterface GigabitEthernet0/0ip address 192.168.1.1 255.255.255.0no shutdownexit
interface GigabitEthernet0/1ip address 10.0.0.1 255.255.255.0no shutdownexit
! Configure static route to network 192.168.2.0/24 via 10.0.0.2ip route 192.168.2.0 255.255.255.0 10.0.0.2
! Show routing tableshow ip routeRouter Configuration (DHCP Server)
Section titled “Router Configuration (DHCP Server)”configure terminalip dhcp pool LAN_POOLnetwork 192.168.1.0 255.255.255.0default-router 192.168.1.1dns-server 8.8.8.8 8.8.4.4exit
! Exclude IP addresses from DHCP rangeip dhcp excluded-address 192.168.1.1 192.168.1.10
! Show DHCP bindingsshow ip dhcp binding-
What is the difference between a hub, a switch, and a router?
- Answer: Hubs broadcast traffic, switches forward traffic based on MAC addresses, and routers route traffic based on IP addresses. Hubs operate at Layer 1, switches at Layer 2, and routers at Layer 3 of the OSI model.
-
What is a collision domain and a broadcast domain? How do hubs, switches, and routers affect these?
- Answer: A collision domain is a network segment where devices compete for bandwidth. A broadcast domain is a network segment where a broadcast message is received by all devices. Hubs create a single collision domain and a single broadcast domain. Switches create separate collision domains for each port but a single broadcast domain by default. Routers create separate collision domains and separate broadcast domains.
-
Explain how a switch learns MAC addresses.
- Answer: A switch learns MAC addresses by examining the source MAC address of incoming frames. It adds the MAC address and the associated port to its CAM table.
-
What is ARP and how does it work?
- Answer: ARP (Address Resolution Protocol) resolves IP addresses to MAC addresses. A device sends an ARP broadcast request to find the MAC address associated with a specific IP address. The device with that IP address responds with an ARP reply.
-
What is a routing table?
- Answer: A routing table is a table maintained by a router that contains information about network destinations and the best path to reach them.
-
What is the purpose of a VLAN?
- Answer: VLANs (Virtual Local Area Networks) allow you to logically segment a network without requiring physical separation. They improve security, performance, and manageability.
-
Explain the difference between static routing and dynamic routing.
- Answer: Static routing involves manually configuring routes in a router’s routing table. Dynamic routing uses routing protocols (e.g., RIP, OSPF, BGP) to automatically learn and update routes.
-
What is NAT (Network Address Translation)?
- Answer: NAT translates private IP addresses to public IP addresses, allowing devices on a private network to access the internet using a single public IP address.
-
How does a router use the TTL (Time To Live) field in the IP header?
- Answer: A router decrements the TTL field each time it forwards a packet. If the TTL reaches 0, the packet is dropped to prevent routing loops.
-
What is Spanning Tree Protocol (STP)? Why is it important?
- Answer: STP prevents loops in switched networks by blocking redundant paths. Without STP, loops can cause broadcast storms and network outages.
-
How would you troubleshoot a slow network connection?
- Answer: Check network utilization, identify bandwidth bottlenecks, use network monitoring tools (e.g.,
ping,traceroute,iperf), check for IP address conflicts, verify DNS settings, and examine router and switch configurations.
- Answer: Check network utilization, identify bandwidth bottlenecks, use network monitoring tools (e.g.,
-
OSI Model: Understanding the OSI model is crucial for understanding how network devices operate.
-
TCP/IP Protocol Suite: The foundation of the internet.
-
Subnetting: Dividing a network into smaller, more manageable segments.
-
Routing Protocols (RIP, OSPF, BGP): Used by routers to exchange routing information.
-
Network Security (Firewalls, Intrusion Detection Systems): Protecting networks from unauthorized access and malicious attacks.
-
Network Monitoring Tools (Wireshark, Nagios): Tools for analyzing network traffic and monitoring network performance.
-
Quality of Service (QoS): Prioritizing network traffic to ensure that critical applications receive adequate bandwidth.
-
SDN (Software-Defined Networking): A network architecture that allows network control to be centrally managed.
-
Network Virtualization: Creating virtual networks on top of physical infrastructure.
-
Cloud Networking: Networking services provided in the cloud.
This cheatsheet provides a solid foundation for understanding network hardware. Further study and practical experience are essential for becoming a proficient network administrator or engineer.