• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 136980
  • Last Modified:

Difference between a router, a hub, and a switch.

I can't seem to find a good, clear answer on this.  Can someone offer a distinction between the three?  

4 Solutions
A router works on the network layer. I determines the best route data should travel.

A switch works on the data link layer, but you can get Layer 3 switches that does routing also.

A hub works on the physical layer. It is basically a multiport repeater.
CraigSNYCAuthor Commented:

Can you tell me in what situation would each be used?
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

A hub is the most simple of the three. It allows multiple computer to communicate, but the downside is that is broadcasts a signal coming from a computer to all computers connected to it. If you have a small LAN, hubs are fine, but when the traffic and number of clients increase a switch is better suited.
A router is used to separate networks and to communicate between different networks.
I wouldn't ever use a hub.  Basic switches are pretty much as cheap as hubs now, anyway.  Whereas a hub will do what Soulja said, repeat incoming data from one port out of all other ports (and let the recipient computers sort out what is meant for them and what isn't), a switch maintains a table of addresses that allows it to send incoming data to only the port where the intended destination for the packet can be found.

In very simple terms, you use a switch for connections within a single subnet and a router to move data between different subnets.
Hi CraigSNYC,

The boundaries are a little blurred, but in essence:

You'd use a hub where you'd got a few machines and low network usage.
Example: 3 PCs wired together in a peer-to-peer arrangement

Switches are used where you have higher demands on the network - they're much more intelligent, and "managed" switches can let you control a lot more about what's happening on the LAN.  Switches are faster than hubs.
Example: 20 PCs connected to a couple of servers and a printer

Routers are used where you need to get data from one "network" to another.  Most commonly used where you've got to get data between sites.
Example: Connecting your office network to the Internet

The above is *very* simplistic, and there is a great deal of subtlety missing - but hopefully it gives you an idea.

Let me know if you need any clarification.
An example of the above:

All machines on my home network (server, four workstations, network printer) uses the subnet and are connected with a switch.  I also connect by VPN to a client's network (using subnet - these two subnets are connected by routers via the internet, but if they were in one physical location, we could use a single router between the two.
A hub is a multiport repeater.  You could build an Ethernet splitter out of a handful of diodes, and the only reason you'd need to add transistors is to add power to the signal.

A switch is a multiport bridge.  It looks at the datalink source address to build a table of what devices are on what port, and uses that table to forward frames only to the ports where their datalink destination address can be found.  Switches save bandwidth (hubs don't) but introduce latency (at least part of each frame must be buffered to collect the source and destination addresses).

A router is a host.  When a frame is received, the datalink addressing is stripped off and the packet that was encapsulated in the frame is examined.  If the network-layer address is not an address of this host (generally, hosts would discard the packet in this case), the router determines if it has an interface that can deliver the packet towards its destination -- if so, it is encapsulated in a new frame and forwarded via that interface.  Since a host can have interfaces on multiple networks, a router permits packets to flow from network to network to network as necessary to reach their destination.

I haven't seen these facts in the above posts, so I thought I'd throw my $.02 in...

A hub is shared medium. All ports on a hub share the same bandwidth. Example, an 8-port 10Mb hub. All 8 devices share the 10Mb total bandwidth. Since it is shared medium, only half-duplex connections are possible. Collisions are natural and expected. As such, bandwidth is really only up to 60% of the total throughput (more traffic, more collisions, less throughput), or 8Mb, or 1 Mb per host. More like a demolition derby with no road rules. The entire switch is one large broadcast and collision domain.

A switch is a bridge, giving each and every port the full bandwidth capability. If you have an 8-port 10/100 switch, then each port can be either 10 or 100Mb, and each port is full-duplex. This means there are no collisions, so no re-transmits, no backoffs, full speed ahead and because it is full-duplex you get full speed in both directions, or up to 200Mb throughput per port. Like a high-speed 16-lane highway where each device gets a full 2 lanes all to themselves, no speed limit. Each interface is its own collision domain, but the whole switch is one broadcast domain.

A router moves data between un-like physical media. From Ethernet to T1, From Ethernet to Token Ring, Ethernet to ATM, ATM to serial, Ethernet to serial, etc.. A router not only routes, but encapsulates based on the required medium. It is ALSO a traffic director between different networks and is required when routing from one network to another (either IPX networks, Appletalk network zones, or IP Subnets), regardless of the media. Routers create network boundaries. Routers form the boundaries between broadcast domains.
For whatever it's worth...

A Router is a device that forwards data packets along networks. A router is connected to at least two networks, commonly two LANs or WANs or a LAN and its ISP’s network. Routers are located at gateways, the places where two or more networks connect. Routers use headers and forwarding tables to determine the best path for forwarding the packets, and they use protocols such as ICMP to communicate with each other and configure the best route between any two hosts. Very little filtering of data is done through routers.

A Switch is a device that filters and forwards packets between LAN segments. Switches operate at the data link layer (layer 2) and sometimes the network layer (layer 3) of the OSI Reference Model and therefore support any packet protocol. LANs that use switches to join segments are called switched LANs or, in the case of Ethernet networks, switched Ethernet LANs.

A Hub is a common connection point for devices in a network. Hubs are commonly used to connect segments of a LAN. A hub contains multiple ports. When a packet arrives at one port, it is copied to the other ports so that all segments of the LAN can see all packets. A passive hub serves simply as a conduit for the data, enabling it to go from one device (or segment) to another. So-called intelligent hubs include additional features that enables an administrator to monitor the traffic passing through the hub and to configure each port in the hub. Intelligent hubs are also called manageable hubs. A third type of hub, called a switching hub, actually reads the destination address of each packet and then forwards the packet to the correct port. (AKA a "Switch" as described above)

Hi.  Thanks for the "A".  Glad I could help :-)
To simplify this:
If you are using a broadband internet connection (Cable, DSL, Sattelite) you should use a router.  These are relatively inexpensive and can be found at Walmart.  

Unless you have tons of simultaneous users on the network, a hub is as simple as you need.  If one of your computers is handling the incomming internet signal, you would not need a router.

Switches?  if you have tons of people using the network at the same time this is the way to go.  Can be a little more complicated.

Go to the Linksys, Dlink webistes and they can give you a lot of help in figuring out which ones to use.  
Check it out : http://www2.rad.com/networks/1997/nettut/hub.html
*The bottom of the networking food chain
*Connect device and create larger networks
*Small hubs 5-8 ports (workgroup hubs)
*Some hubs have more ports, up to 32 normally
*Direct data packets to all devices connected to the hub - shared bandwidth
*Scalability, Collision, inefficient

*Like hub, connectivity points of Ethernet network
*Forward only to the port that connects to the destination device
     -knows MAC address
      -Match the MAC address in the data it receives.
*Fully switched network, a dedicated segment for each device is connected to switch. *Expensive.
*Allow full duplex Ethernet
        -It was half duplex before – one device can transmit at one given time
         -Nodes only communicate with switch, never directly to each other
         -Use twisted pair or fiber optic cabling, using separate conductors for sending and      receiving data.
        - double the capacity, 100Mbps become 200Mbps
*Most LAN are mixed with hubs and switches.

                                                               Switch and Router

Different with router:
               -Typically switch works on lower level (Data link Layer)  while Router works in higher level (Network Layer)
             -Algorithms for router and switch about how to forward packers are different
For example, switch will forward broadcast, so does hub, not router- the address has to be specific.


*Divide larger networks into smaller sections
*Check MAC address, forward or block the data
*Learning bridge builds list of MAC address by watching the traffic on the network.
      Two issues to consider:
            Placement 80/20 rule
             Bridging loops
                        (IEEE 802.1d Spanning tree protocol)
*Types of bridges:
 -Transparent bridge
 -Source route bridge
 -Translational bridge

*Create larger networks by joining two networks segments.
*Dedicated hardware device or computer systems with more than one network interface and routing software.
*Routing table
 -Static routing
 -Dynamic routing
*Use special routing protocols to pass info to other routers.
   Distance Vector Routing (RIP)
  Link state routing (OSPF)



I see people are taking it out on the little hub. I am not 100% clear on the issues, but I have a feeling that they do have their place. Here are a couple of situations that I *think* they might have an advantage over the higher-end kin :

1) if you *want* to restrict bandwidth to certain computers, stick them on a 10Mbps/half hub - the only other way I can think of to restrict bandwidth is to use a managed switch or router, which are usually more expensive;
2) if you have one server broadcasting to every other computer - hubs will send the traffic to every other computer anyway, with little in the way of return traffic, so a hub maybe sufficient.

Of course, I could be completely wrong about this.


Router are normally used to connect to a cable modem/adsl and ROUTE packets from the internet into your local area network or LAN.
A router is what you would want to use if you have 1 internet connection and want to share it with several computers in your house (using NAT or network address translation).

Inside your house you may have several computers and printers you want to network to fully get the use of your internet.

Hubs are rather old and simply SHARE packets of information between the computers.  Lets say Computer A sends out a signal to Computer D - it would BROADCAST the message to all computers over the hub.. then Computer D would see it and respond.  Kinda a loosey system if you have 20 computers all broadcasting.

A switch is a more intelligent hub.. basically SWITCHING packets.. so when Computer A sends a signal to D it goes from A's port on the switch directly to D without the need to broadcast every single request between the two computers.
A Router is the device you use that connects you to the internet and is connected between the ethernet cable on the cable, DSL, or T1 ethernet connection of your internet connection and the switch.  It is usually a firewall, DHCP server, and sometimes wireless device in smaller networks.

A switch is what you plug in all your client computers into that switches the IP packets between the appropriate ports.  For example one computer and the internet connection from the router would both be plugged into the switch.  All data going from the computer to the internet and vice versa is addressed appropriately, and the switch bypasses all other computers on the switch and sends them to the right location.  

A Hub is a simple device that treats packets and ethernet cables as a series connection and broadcasts all IP packets to all ports on the hub.  It has no switching table and intelligence to route only to the appropriate port.  This device is older and can slow down a network.
ok now let me throw my two cents in.  As network devices get better and better all the time, the lines become blurred.  As has been mentioned in previous comments routers act on Layer 3 of the OSI model.  In otherwords they route packets and limit broadcast storms.  But as switching gets better and better we are seeing layer 3 switching.  Depends on the platform that one is using.  Cisco puts out alot of big gun platform where the lines now become blurred.  Now i am talking about the big gun router/switches that we use at work.

Your hubs are a shared medimum generally 10mb half dup. or they used to be pardon me.   Now they also go up to 100Mb and can be full dup.     The great thing about switches is they limit collison issues and each port has a dedicated bandwidth to the pc, desktop or whatever.  So that makes it great if you as a Network person is trying to monitoring exactly how much b/w is being used to the desktop.
This has got to be the longest thread that would not die... =) I assume the most recent posters realize the question has already been satisfactorily answered? And you are just being nice people and contributing more information out of the goodness of your hearts... =)

Router is intelligent enough to understand the ip header of the packet , ip header will have the source ip and destination ip, and routing options to determine the best path across the internet . Router has its own routing table and keep updating the routing table from the routing updates getting from other routers.  it checks the destination ip of the packet
and route that packet on to corresponding interface after checking the routing table.
Since IP protocol in N/w layer so routers works in N/w layer .
right now in the market there are layer2 ,3,4 and some layer 7 switches also available , it is based on the switch intelleigence Layer 2 switches will not be able to understand ip headers and it understands only datalink layer header that is frame , it reads the source and destination MAC Adresss of the frame , and switch has the mac table
it frowards the frame to the corresponding switch port after looking in to the mac table.

Layer 3,4,7 switches will be able to understand ip header  Layer 3  switches are used in a huge LAN segments ( IP VLAN Segments) , Layer 4 switches can understand the TCP Header of the packet and makes the decision based on the policies configured on layer 4 switches based on tcp ports.
Layer 7 switches will be able to understand the application header of the packet  ie HTTP header,SMTP header,FTP ..application protocols  Layer 7 switches used in ISP's to redirect the traffic to cache engine based the URL address in HTTP header.

Hubs only works in physical layer and bandwidth is shared between all the ports and all hub ports are in single collision and broadcast doamin. where as each port in switch its own collision domain .

Rama Dodda.
I am planning to buy what (LinkSys and others) are calling a 'wireless access point', in order to add wireless access for my laptop by connecting it to my router (which is connected to the cable modem - and I'm planning to leave my desktops connected to the wired router for security reasons...). Am I correct is assuming that the wireless 'access point' is the equivalent of a wireless hub?
the major diffrence between Hub ,switch and router see the following link

thank you

One problem I found using hubs is connecting a PC with A 10mb network card to my 100mb only hub which serves the internet (The router is single port and has to serve other PC's). The soloution was to use my dual speed hub which was able to connect to the 100mb hub and to the 10mb card effiectively bridging the connection.
routers connect subnetworks together. It breaks down large n/w's into smaller sub n/w's. routers introduce longer delays and have lower throughput rates than bridges. however mutiprotocol routers support ethernet , FDDI , token ring and a variety of LAN interfaces.

A hub is the central component (point) of a n/w. its responsible for * station configuration : reposition stations in any order and  connects new stations to the ring
* ring configuration : creates new rings , expands them etc.
* topology configuration : implements flat , structured or multitiered topologies with the aim of minimising the disruption to n/w operations.
the hub should therefore be reliable,fault tolerantand fully redundant system. the hub should be flexible enough to allow the n/w to grow gracefully.

a switch is responsible to manage control and links between verious nodes of a n/w. various examples are the crossbar switch , crosspoint switch etc.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now