Difference Between Hub, Switch, and Router | Explained With Examples

Hub Vs Switch Vs Router

Layered Communications:

Network communication models are defined in layers. The OSI model consists of seven layers, each performing a specific function based on protocols. These protocols govern end-to-end communication between two devices. As data traverses from lower layers to upper layers, each layer adds a header containing protocol information. These headers are referred to as Protocol Data Units (PDUs), and the addition of these PDUs is called encapsulation. Network devices are associated with the OSI layers. For example, Hub Vs Switch Vs Router, switches operate on Layer 2 and store information in the form of frames, such as MAC addresses. Routers operate on Layer 3 and store information in the form of packets, such as IP addresses.

Layer-1 Device is Hub

Hubs operate on Layer 1 of the OSI model and are also known as repeaters, extending signals over long distances. They are non-intelligent devices that do not route data based on frames and packets; instead, they transfer data in any form, whether at Layer 2 or Layer 3. Hubs forward data to all ports of the device except the originating one.

Hub Vs Switch Vs Router

Layer-2 Device is Switch

Layer 2 devices, such as switches, maintain hardware address tables containing addresses for hosts and each associated port. Switches use frame headers to intelligently route data to selected ports, unlike hubs that flood data to all ports. Switches employ ASICs (Application Specific Integrated Circuits) for efficient traffic forwarding. Half-duplex communication occurs in hubs, while switches enable full-duplex communication, with each port having its own collision domain, reducing collisions. The three main differentiators between hubs and switches are:

  • Hardware address table management
  • Intelligent forwarding of frames
  • Loop avoidance, based on STP (Spanning Tree Protocol)
Hub Vs Switch Vs Router

Layer-3 Device is Router

Layer 3 routing transfers packets between networks based on network layer protocols. Routers maintain routing tables comprising:

  • Destination network and subnet mask
  • Next hop router for reaching the destination network
  • Routing metrics and administrative distances

Layer 3 forwards packets based on the destination network, not the destination host, unlike switches.
Two types of routing protocols exist

  • Routed Protocols: Assign logical addresses to network devices and route packets between them, such as IP and IPX.
  • Routing Protocols: Dynamically assign addresses after building routing tables, examples include RIP, EIGRP, and OSPF.

Each packet undergoes buffer location determination and route table lookup, consuming CPU cycles and potentially increasing latency.

Hub Vs Switch Vs Router

Leave a Reply