Sr. No | Hub | Switch | Router |
---|---|---|---|
1. | Hub is a physical layer device i.e. layer 1. | Switch is a data link layer device i.e. layer 2. | Router is a network layer device i.e. layer 3. |
2. | A Hub works on the basis of broadcasting. | Switch works on the basis of MAC address. | A router works on the basis of IP address. |
3. | A Hub is a multiport repeater in which a signal introduced at the input of any port appears at the output of the all available ports. | A Switch is a tele-communication device which receives a message from any device connected to it and then transmits the message only to the device for which the message is intended. | A router reads the header of incoming packet and forward it to the port for which it is intended there by determines the route. It can also perform filtering and encapsulation. |
4. | Hub is not an intelligent device that may include amplifier on repeater. | A Switch is an intelligent device as it passes on the message to the selective device by inspecting the address. | A route is more sophisticated and intelligent device as it can read IP address and direct the packets to another network with specified IP address. Moreover routers can built address tables that helps in routing decisions. |
5. | At least single network is required to connect. | At least single network is required to connect. | Router needs at least two networks to connect. |
6. | Hub is cheaper as compared to switch and router. | Switch is an expensive device than hub. | Router is a relatively much more expensive device than hub and switch. |
An Ethernet hub acts as a multiport repeater that receives an incoming electrical signal (data) on a port. It then immediately forwards a regenerated signal out all other ports. Hubs use physical layer processing to forward data. They do not look at the source and destination MAC address of the Ethernet frame. Hubs connect the network into a star topology with the hub as the central connection point. When two or more end devices connected to a hub send data at the same time, an electrical collision takes place, corrupting the signals. All devices connected to a hub belong to the same collision domain. Only one device can transmit traffic at any given time on a collision domain. If a collision does occur, end devices use CSMA/CD logic to avoid transmission until the network is clear of traffic. Due to the low cost and superiority of Ethernet switching, hubs are seldom used today.
Bridges have two interfaces and are connected between hubs to divide the network into multiple collision domains. Each collision domain can have only one sender at a time. Collisions are isolated by the bridge to a single segment and do not impact devices on other segments. Just like a switch, a bridge makes forwarding decisions based on Ethernet MAC addresses. Bridges are seldom used in modern networks.
LAN switches are essentially multiport bridges that connect devices into a star topology. Like bridges, switches segment a LAN into separate collision domains, one for each switch port. A switch makes forwarding decisions based on Ethernet MAC addresses. The figure shows the Cisco series of 2960-X switches that are commonly used to connect end devices on a LAN.