Skip to content

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.

ConceptDescriptionDevice(s)
Collision DomainA network segment where devices compete for bandwidth and data collisions can occur.Hub
Broadcast DomainA network segment where a broadcast message is received by all devices.Hub, Switch
MAC AddressA unique hardware address assigned to a network interface card (NIC). Used by switches to learn device locations.Switch
IP AddressA logical address assigned to a device on a network. Used by routers to route traffic between networks.Router
Routing TableA table maintained by a router that contains information about network destinations and the best path to reach them.Router
ARPAddress 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
VLANVirtual Local Area Network. A logical grouping of devices that allows you to segment a network without requiring physical separation.Switch
SubnetA logical subdivision of an IP network.Router
Default GatewayThe IP address of the router that a device uses to send traffic to destinations outside its local network.Router
OSI ModelA 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
  1. A device sends a packet to the hub.
  2. The hub blindly broadcasts the packet to all connected devices.
  3. 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.
  1. A device (A) sends a packet to the switch for device (B).
  2. 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.
  3. 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.
  1. A device (A) sends a packet to the router, destined for a device (C) on a different network.
  2. The router examines the destination IP address of the packet.
  3. The router consults its routing table to determine the best path to reach the destination network.
  4. The router forwards the packet to the next hop router or the destination network directly.
  5. 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.
  6. 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.
  • Purpose: Resolves IP addresses to MAC addresses. A device needs to know the MAC address of the destination to send a frame.
  • Process:
    1. Device A wants to send a packet to IP address 192.168.1.10 (Device B).
    2. 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).”
    3. 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.”
    4. Device A caches the MAC address in its ARP cache and can now send the packet.
[ARP Request]
Hardware Type: Ethernet
Protocol Type: IPv4
Hardware Address Length: 6
Protocol Address Length: 4
Sender MAC Address: AA:BB:CC:DD:EE:FF
Sender IP Address: 192.168.1.1
Target MAC Address: 00:00:00:00:00:00 (Unknown)
Target IP Address: 192.168.1.10
[ARP Reply]
Hardware Type: Ethernet
Protocol Type: IPv4
Hardware Address Length: 6
Protocol Address Length: 4
Sender MAC Address: 00:11:22:33:44:55
Sender IP Address: 192.168.1.10
Target MAC Address: AA:BB:CC:DD:EE:FF
Target IP Address: 192.168.1.1
+-------------------+--------------------+-------------------+---------------------+-------+
| 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.
+---------+--------+--------+------------+--------+--------+-----------+------------+------+
| 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.

IssueDevice(s)TroubleshootingSolution
Network Congestion/Slow PerformanceHub, Switch, RouterCheck 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 ConflictsRouterCheck 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 LoopsRouterUse 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 StormsHub, SwitchIdentify 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/SpoofingSwitch, RouterUse 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 ErrorsSwitchCheck 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 UtilizationRouter, SwitchMonitor 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.

! Configure VLAN 10
configure terminal
vlan 10
name Employees
exit
! Configure VLAN 20
vlan 20
name Guests
exit
! Assign port Gi0/1 to VLAN 10
interface GigabitEthernet0/1
switchport mode access
switchport access vlan 10
exit
! Assign port Gi0/2 to VLAN 20
interface GigabitEthernet0/2
switchport mode access
switchport access vlan 20
exit
! Configure trunk port Gi0/24 for all VLANs
interface GigabitEthernet0/24
switchport mode trunk
switchport trunk encapsulation dot1q
switchport trunk allowed vlan all
exit
! Show VLAN information
show vlan brief

Router Configuration (Basic Static Routing)

Section titled “Router Configuration (Basic Static Routing)”
! Configure interface IP addresses
configure terminal
interface GigabitEthernet0/0
ip address 192.168.1.1 255.255.255.0
no shutdown
exit
interface GigabitEthernet0/1
ip address 10.0.0.1 255.255.255.0
no shutdown
exit
! Configure static route to network 192.168.2.0/24 via 10.0.0.2
ip route 192.168.2.0 255.255.255.0 10.0.0.2
! Show routing table
show ip route
configure terminal
ip dhcp pool LAN_POOL
network 192.168.1.0 255.255.255.0
default-router 192.168.1.1
dns-server 8.8.8.8 8.8.4.4
exit
! Exclude IP addresses from DHCP range
ip dhcp excluded-address 192.168.1.1 192.168.1.10
! Show DHCP bindings
show 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.
  • 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.