A Hub is a networking device that allows one to connect multiple PCs to a single network.
Hubs may be based on Ethernet, Firewire, or USB connections.
A switch is a control unit that turns the flow of electricity on or of in a circuit.
It may also be used to route information patterns in streaming electronic data sent over networks.
In the context of a network, a switch is a computer networking device that connects network segments.
7. Application Network process to computer programs
6. Presentation Data representation, security encryption, convert computer code to network formated code
5. Session Interhost communication, managing sessions between programs
4. Transport End-to-end connections, reliability and flow control
3. Network Path determination and logical addressing
2. Data link Physical addressing
1. Physical The physical infrastructure used to send and receive Signal_(electrical_engineering)
Hub and Switches are used over a Local Area Network (LAN).
They interconnect different machines on the same LAN.
The difference between them is that the hub "repeats" any message on the whole LAN,
besides the switches tries to separate the LAN into several "collision domains"
(each one on a single port of the switch), and sends the message only to the required machines.
A router is used to interconnect LANs.
A rooter between two LAN has two interfaces, one on each LAN.
The router is used as a gateway when a machine from the LAN 1 wants to communicate with a machine on the LAN 2.
A hub is typically the least expensive, least intelligent, and least complicated of the three.
Its job is very simple: anything that comes in one port is sent out to the others. That's it.
Every computer connected to the hub "sees" everything that every other computer on the hub sees.
The hub itself is blissfully ignorant of the data being transmitted.
For years, simple hubs have been quick and easy ways to connect computers in small networks.
A switch does essentially what a hub does but more efficiently.
By paying attention to the traffic that comes across it, it can "learn" where particular addresses are.
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.
The net result of using a switch over a hub is that most of the network traffic only goes where
it needs to rather than to every port. On busy networks this can make the network significantly faster.
A router is the smartest and most complicated of the bunch. Routers come in all shapes
and sizes from the small four-port broadband routers that are very popular right now to the
large industrial strength devices that drive the internet itself.
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. For example, broadband routers include the ability to "hide"
computers behind a type of firewall which involves slightly modifying the packets of network traffic as they
traverse the device. All routers include some kind of user interface for configuring how the router will treat traffic.
The really large routers include the equivalent of a full-blown programming language to
describe how they should operate as well as the ability to communicate with other routers to describe or
determine the best way to get network traffic from point A to point B.

