All of them are different types of network equipments to connect devices and networks. First of all I’ll tell you the short definitions of all these terms.
Hub: Hub is a type of junction or connection point for devices connected in network. Basically hub is used to connect the segment or devices of a LAN (Local Area Network). A hub has several ports to connect multiple segments.
A hub performs broadcasting of a packet or message in such a manner that when a message arrives at a port, it simply copies and send these copies to the number of devices connected to the network so that all the segments can see that broadcast message.
Switch: Switch is used when broadcasting of packet is not required.A switch is a device in the LAN network that filters the message and forward to the LAN segments. Actually switches operates on data link layer and sometimes on network layer of OSI (Open System Interconnection) model.
Router: Its name indicates its work,means it provides a suitable route to the packets for forward them along network. A router is connected between two networks like LANs or WANs not between the segments of network.It routes a packet until the packet reached to its destination.A router placed at a place where two networks are connected known as Gateways.
Difference between Hub, Switch and Router
There all three devices are quit different to each other. As we read above, the switch and hub devices play similar role of transferring frames or packets between devices.But here is actually a quit difference between them.
A hub broadcast a packet to its every port weather the packet is only for one one port. The hub can not filter the packet to send packet to the intended device.
Whereas a switch keeps the MAC (Media Access Control) addresses of all devices, so that switch can distinguish packet to send it to appropriate destination without broadcasting. So, when a switch receive a frame or packet,it sends it to exactly one port without increasing the traffic on the network.
And routers are completely different from both switches and hubs in such a manner that it is concentrated for providing a route to the frames, not concentrated for transferring frame like hub and switch.
Another difference between router and hub or switch is that router is a device connected between two networks like LANs or WANs whereas switches and hubs are connected between multiple devices in any individual network for transferring frames.