Switch vs. Router

TitanMATRIX

In Runtime
Messages
202
Hey,

I'm still learning all of this as I'm teaching myself networking. I'm having trouble differentiating a switch and a router so let me see if I got this straight...

Routers are used to take in information and forward it to a specific IP while a switch simply passes along information arbitrarily. Which would explain why on my home's wirless router, up to 4 computers can be connected to the router but be doing different things and getting different info. If a switch were to be placed all the computers would get the same info.

And when would I use a router instead of a switch or vice versa?

thanks :)

Nick
 
Routers are used to take in information and forward it to a specific IP while a switch simply passes along information arbitrarily. Which would explain why on my home's wirless router, up to 4 computers can be connected to the router but be doing different things and getting different info. If a switch were to be placed all the computers would get the same info.
Almost, but not quite. Are you familiar with the OSI 7 layer model? A router is essentially there to connect more than one network together, it works on the network layer of the 7 layer model and hence acts as a gateway between different networks.

In contrast to this, a switch works on the data link layer, so it can't route between networks. It can however look inside packets and forward them on to only where they need to go within the same network, it doesn't just pass it on arbitrarily to all the ports it has. That would be what a hub does (or an unmanaged switch, which is basically just a glorified hub) it just copies all the data it receives to all of the other ports. It sounds like your view of a router is actually what a switch does, and your view of a switch is what a hub does :)

As an aside, a hub will still work fine but if you've got lots of traffic on your network it'll be considerably slower than a switch. This is because it's nature (forwarding everything onto everything and just letting each node deal with its own traffic) creates LOTS of collisions which destroys data packets. You don't notice things going wrong because it's all handled, corrected and resent for you in some of the lower levels of the OSI model - but the end result will be greatly reduced speed as more packets collide and have to be resent. This is why the proper corporate gigabit switches cost a lot more than the cheap home sort - chances are the cheap home sort are actually unmanaged switches (hubs) that won't give you anywhere near gigabit speed when there's lots of traffic flying around. Proper (managed) switches however should maintain their speed however many devices are connected.

To confuse things though, in a home environment, the router that you get given by your ISP to connect to the internet is in fact usually a multifunction box. The router part is the part that manages the connection between your LAN and the internet (acting as a gateway between the two different networks.) The switch part is the part that manages the traffic going from machine to machine in your LAN. And the wireless part is just a wireless access point built in!

So, you'd use a router when you had more than one type of network to connect together and a switch to manage traffic within the same network. You'd use a hub when you were too cheap to buy a proper switch and / or you understand the drawbacks of a hub and know that it won't affect you too much :)

Hope that helps, say if there's anything you want clarifying!
 
actually it does... looks like I needed to move everything up by definition lol. Thanks though for your help! I'm still teaching myself like I said earlier, but this absolutely helps.
 
yeah getting all these parts and pieces to networking straight. Its coming together now :D

An easy way to remember it (at least for me) is that a hub is the dumbest, router is the smartest with a switch being in the middle.
 
Hub -- receives data and send it out to all of it's ports (don't use them!)

Switch -- receives data and can determine which port to send it out (thus creating a faster and more reliable network). To be used in areas where only one cable is run and multiple computers are to be connected BUT a router is already in place.

Router -- a switch with advanced functions. It is capable of assigning IP addresses to devices thus creating a network. This allows it to share an internet connection and keep track of the network, making sure data gets where it's supposed to. However if you turn this feature off, a router will act as a switch and just forward the data that it receives to the correct port. They also are able to have wireless capabilities. To be used next to the modem (where the interent comes in) to allow the internet to be shared between multiple devices.

Again, listed in order of "smartness".
 
Hub -- receives data and send it out to all of it's ports (don't use them!)
Why not? Like most things in the computing world they have their place!
 
Why not? Like most things in the computing world they have their place!

and their place is in the trash. They just aren't reliable enough and you can get a switch for the same price. Hubs cause to many collisions and switches just make the network run better, faster, smoother, and just outperform hubs for the same price. Personally, I just have never used them, and just don't see them as worth-while equipment.
 
Back
Top Bottom