# Hub vs Switch vs Router

|  | Hub | Switch | Router |
| --- | --- | --- | --- |
| **Function** | Connects devices within a LAN in a simple broadcast manner | Connects devices within a LAN | Connects networks and allows devices to communicate across them |
| **OSI layer** | Layer 1 (physical) | Layer 2 (data-link) | Layer 3 (network) |
| **Data transmission** | Unicast and multicast | Unicast and multicast | Broadcast |
| **Addressing** | None | MAC addresses, switch table | IP addresses, routing tables |
| **Cost** | Low | Moderate | High |
