Hubs, switches, and routers are all devices that let you connect from one computers to other computers, networked devices, or to other networks.

Each has two or more connectors called ports into which you plug in the cables to make the connection.

Hub :

A hub is a small, simple, inexpensive device that joins multiple computers together. Its job is very simple: anything that comes in one port is sent out to the others. That’s it. This is quick and easy ways to connect computers in small networks.

Hubs operate using a broadcast model



Switch :

A switch is a small hardware device that joins multiple computers together within one local area network (LAN). a switch generally contains more intelligence and a slightly higher price than a hub. switches are capable of inspecting data packets as they are received, determining the source and destination device of each packet, and forwarding them appropriately. For example, if it sees traffic from machine A coming in on port 2, it now knows that machine A is connected to that port and that traffic to machine A needs to only be sent to that port and not any of the others.

switches operate using a virtual circuit model.Switching involves moving packets between devices on the same network.Switches operate at layer 2 of the OSI Model.

A switch is able to determine where a packet should be sent by examining the MAC address within the data link header of the packet (the MAC address is the hardware address of a network adapter). A switch maintains a database of MAC addresses and what port they are connected to.

Router :

A router is a small hardware device that joins multiple networks together. These networks can include wired or wireless home networks, and the Internet.A simple way to think of a router is as a computer that can be programmed to understand, possibly manipulate, and route the data its being asked to handle.

Routing involves moving packets between different networks. Routers, on the other hand, operate at layer 3 of the OSI Model.

A router is able to determine where to send a packet using the Network ID within the Network layer header. It then uses the routing table to determine the route to the destination host.