Monday, February 18, 2013

What's the difference between a hub, a switch, and a router?




Hubs, switches, and routers are all devices that let you connect one or more computers to other computers, networked devices, or even other networks. Each has two or more connectors called ports into which you plug in the cables to make the connection. Varying degrees of magic happen inside the device and therein lies the difference. I often see the terms misused, so let's clarify what each one really means.

Hubs

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.
If a message comes in for computer "A", that message is sent out all the other ports, regardless of which one computer "A" is on:
Message coming into a hub
And when computer "A" responds, its response also goes out to every other port on the hub:
Response being sent through a hub
Every computer connected to the hub "sees" everything that every other computer on the hub sees. The computers themselves decide if they are the targeted recipient of the message and when a message should be paid attention to or not.
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.

Switches

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.
Initially, a switch knows nothing and simply sends on incoming messages to all ports:
The initial contact through a switch
Even accepting that first message, however, the switch has learned something - it knows on which connection the sender of the message is located. Thus, when machine "A" responds to the message, the switches only need to send that message out to the one connection:
Response being processed through a switch
In addition to sending the response through to the originator, the switch has now learned something else - it now knows on which connection machine "A" is located.
That means that subsequent messages destined for machine "A" need only be sent to that one port:
Switch sending an incoming message to the machine who's location it is aware of.
Switches learn the location of the devices that they are connected to almost instantaneously. The net result is that most network traffic only goes where it needs to rather than to every port. On busy networks, this can make the network significantly faster.

Routers

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 that it's being asked to handle. Many routers today are, in fact, little computers dedicated to the task of routing network traffic.
As far as simple traffic routing is concerned, a router operates exactly as a switch, learning the location of the computers on its connections and routing traffic only to those computers.
Consumer grade routers perform at minimum two additional and important tasks: DHCP and NAT.

DHCP - Dynamic Host Configuration Protocol - is the way dynamic IP addresses are assigned. A device asks for an IP address to be assigned to it from "upstream" and a DHCP server responds with an IP address assignment. A router connected to your ISP-provided internet connection will typically ask your ISP's server for an IP address; this will be your IP address on the internet. Your local computers, on the other hand, will ask the router for an IP address and these addresses are local to your network.
Router reciving an IP address from ISP, and itself handing out IP addresses to local computers
NAT - Network Address Translation - is the way that the router translates the IP addresses of packets that cross the internet/local network boundary. When computer "A" sends a packet out, the IP address that it's "from" is that of computer "A" - 192.168.1.2 in the example above. When the router passes that on to the internet, it replaces the local IP address with the internet IP address assigned by the ISP. It also keeps track, so that if a response comes back from somewhere on the internet, the router knows to do the translation in reverse - replace the internet IP address with the local IP address for machine "A" and then send that response packet on to machine "A".
A side effect of NAT is that machines on the internet cannot initiate communications to local machines - they can only respond to communications initiated by those local machines.
The net effect is that the router then also acts as a firewall:
Router acting as a firewall
What that means is that malware that might spread by trying to independently connect to your computer over the network cannot.
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.

A note about speed

A quick note on one other thing that you'll often see mentioned with these devices and that's network speed. Most devices now are capable of both 10mpps (10 mega-bits, or million bits, per second) as well as 100mbps and will automatically detect the speed.
More and more devices are now capable of handling 1000mbps or a billion bits per second (1gpbs).
Similarly, many devices are now also wireless transmitters that simply act like additional ports on the device.


Thanks
R.karthikeyan

1 comment:

  1. First time I read a really clear explanation about this subject. Thanks

    ReplyDelete

Share this

Labels

WINDOWS SERVER (22) Windows (20) IIS (15) Interview questions (10) TFS (9) Troubleshooting Tips (9) Fortigate Firewall (8) SQL (8) Backup (6) Team Foundation Server (6) Webserver (6) Windows Administration Task (6) Microsoft certification (5) Virtualization (5) ADDS (4) Active Directory (4) FTP (4) PHP (4) SQL 2012 (4) SQL Server (4) server (4) DBA (3) MSSQL (3) Networking (3) Offer (3) Webhosting (3) Windows 8 (3) 74-409 (2) Agile Methodology (2) Apache (2) CLI Commands (2) DNS (2) Dedicated server (2) Difference between Active and Passive Connection Mode (2) Fortinet (2) GPO (2) IIS8 (2) IPAddress (2) IPV6 (2) MVA (2) Microsoft News (2) NAT (2) Software Development (2) TFS2013 (2) Uncategorized Post (2) XAMPP (2) firewall Administration. (2) powershell (2) .htaccess (1) ALM (1) Agile vs Scrum Difference (1) Blogging TIPS (1) CPanel (1) Command for Administrator (1) DC (1) DHCP (1) Domain joining nano server (1) Exam 74-409 (1) Excel TIps (1) File server (1) Fortigate Firewall HA (1) Fortigate Firmware Upgrade (1) Free Exam 70-740 (1) Free Voucher (1) Generation2 VM (1) Group Policy (1) HP (1) HP ILO IP CHange (1) HP OA IP Change (1) HP Proliant Servers (1) HTTP to HTTPS (1) Hyper-V (1) IAS (1) IIS Server hardening (1) ILO (1) Install dll (1) MCSA 2016 (1) Microsoft Virtual Academy (1) Microsoft file sharing Port (1) Migration (1) MySQL (1) NPS (1) Nano server (1) Network Drive (1) OA (1) Plesk Panel (1) Ports (1) Ports for windows file sharing (1) RADIUS (1) RDP (1) Remote Desktop Connection (1) SCRUM (1) SQL ErrorLog (1) SQL TEMPDB (1) Second Shot (1) Server 2012 (1) Startup Parameters (1) TEMPDB Movement (1) TIPS (1) Team Foundation Server 2013 (1) Temp profile. (1) Troubleshooting DNS (1) URL Rewriting (1) VDOM (1) VPS (1) VSS (1) Virtual Labs (1) Visual Studio (1) Visual Studio 2012 (1) Visual Studio 2013 (1) Visual source safe (1) Waterfall Model vs Agile Methodology (1) Windows 2016 (1) Windows 7 (1) Windows Server 2012 (1) Windows command line (1) XP (1) certification path (1) exam (1) free online courses (1) protocols/ports for windows file sharing on a firewall (1) sql error (1) what features has been installed in your SQL Server (1) windows 2012 (1) windows Time Service (1) work item types difference (1)

E-Books

Blogger Gadgets