The difference between a router and a switch?

m33pm33p

[H]ard|DCer of the Month - August 2013
Joined
Oct 10, 2010
Messages
4,345
I know its a newb question but what is the difference. I understand that a router connects multiple networks together, be it LAN's, WAN'S to Internet and a switch sorts and then distributes data. But for some reason my brain can't get wrapped around what exactly the difference is. Just getting started on knocking out my newb certs(sec+ net+) any help is appreciated.
 
Not sure if you've Google'd it already, but this website has it wrapped up in a nice tabulated form: http://www.diffen.com/difference/Router_vs_Switch

Hope that helps you grab the concept.

I certainly googled it haha. I just figured someone here could break it down in simpler terms. As in big picture differences. Say in a larger company, how would the two be used.

I'm assuming from what I've read. The switch would connect two 2 or more nodes in a network. The router would then connect multiple networks in the site?
 
in general a router runs at Layer 3 in the OSI model this means it runs at the IP level or it really cares about IP addresses

A standard switch is a Layer 2 device and only cares about MAC addresses and so doesn't even know that IP addresses exist.

The only way to find a MAC address is to send a broadcast to every single switch port until it gets a reply from the PC its looking for, this is fantastic for sub 500 devices but just think about what that would be like if the internet was run all at Layer 2? The internet would be maxed out at all times with ARP requests and there would be no space for the pron or torrents!

So...

Layer 2

PC to Switch--> "hi switch this is PC on port 1 I need to find the PC with the MAC address 00-00-00-00-00-00-00-E0" Switch to Network--> "Hi every single device on my network who has the MAC address 00-00-00-00-00-00-00-E0?"

Layer 3

PC to Router --> "Hi router who has the IP 111.111.111.111?" --> Router to PC Either says "Its that one over there or I dont know but I know a router that may be able to tell you, I will pass your request on to that router"
 
Last edited:
A switch basically replaced what we called a "hub"..it's commonly used to connect a bunch of computers to create a local network. So a hub..or more properly these days...a switch, in their basic form...is used to "connect computers" to create a local network.

A router, in its basic form...is used to "connect networks". often used in "gateway mode"..such as that Stinksys or Nutgear or DStink router you have at home connecting your home computers (one network) to the internet (another network). So in gateway mode, they are the gateway to the internet. They're also used in larger networks...business networks..where several "nodes" of the network are connecting together to create a wide area network. They "route" traffic from one network..to another network.
 
You could have a whole 50 user department connected to one switch, and then another 50 user department on another swtich.

Then you could have a router that connects those sets of users to the internet or another network.

A switch has the brains. Modern switches have some brains inside compared to the old hubs/switches, but it's not the same as routers.

Think of a switch as connecting devices to each other and a router connecting networks to each other.
 
Okay here is the real answer....

A router divides broadcast domains. It is designed to stop broadcast traffic from one broadcast domain from crossing into other broadcast domains. It is the control point and the gatekeeper to keeping broadcast traffic to a minimum between different networks.

Without routers your computer would be subjected to hundreds of billions of computers all broadcasting on the same TCP network. Try and get something done having to wait your turn in a global broadcast domain of 900 billion computers all trying to share the same GIGANTIC broadcast domain.

A switch is basically one "HUB" or collision domain per port with full line speed bandwidth at each port instead of shared across the whole of the switch like a old hub. Switches can break up broadcast domains by the use of VLANs but you still need a "Router" to allow the transportation of information from one b. domain to another b. domain.

A router reads the destination and source MAC address of each frame it receives and if the frame needs to be sent to a network that is not on the same subnet as the source then it will look at it's routing table and strip the certain information off/add necessary information and then send that packet to the network that the router knows where to send it based on it's routing table. It works in reverse when a host or router on another network tries to send data to your network but does not know where to send it. The remote network will reference it's router asking where to send the frame of data, that router will look at it's routing table, get the answer, do its strip off add on job it has to do, and send it to your router and your router will look at the destination and source mac and then strip and add if necessary and then forward the packet to your switch where your switch will strip off the routers crap and turn it into a frame and send that frame to the correct port which the destination PC is on...

and on and on and on and damn it happens so fast.

That is my crash course definition. Want to learn routing gotta study Cisco/Juniper/or one of the MAJOR vendors.

That is the real answer.

To better help define the role of routers and switches also its helpful to understand the terminology they use as well.

Remember the following simple answer -
-Computer operating systems send and receive data in segments
-Switches send and receive data in Frames
-Routers send and receive data in Packets

Each one is important because it defines what current stage your data is being handled at or OSI Layer. And it plays into the following to help define routing vs. switch :

Segments are OSI Layer 4 and up
Packets are OSI layer 3 aka Routing
Frames are OSI layer 2 aka switching
Bits are OSI layer 1 aka sending your crap over copper or fiber to some other place

Now there are switches that are called "layer 3 switches" well that is misnomer and lack of correct terminology honestly. What a layer 3 switch is, is really a Router, with a crap ton of ethernet interfaces that can smartly be told to operate in both layer 2 and 3. A L3 switch aka router is capable of routing to other networks/broadcast domains just like a standalone router can. And l3 switches are VERY VERY powerful at the striping and ripping of frames and converting them into packets and sending them off to who knows where out there in the internet.

Lastly to really define what a "TRUE" router is... a true router is a device that can convert between ethernet/frame relay/T1/T3/Docsis/3g/4g/ etc... it has the ability to communicate two completely different layer 1 mediums where as a switch or a home based router can only translate on the Ethernet mediums. So your home router in a sense is just a layer 3 switch and not really compared to what a real "between different layer 1 mediums" type router is unless you have a card slot in the back you can slap a cable modem in or an MPLS circuit or a frame relay connection etc.....

im out ....took me too long to figure out how to break this down.
 
Last edited:
Thanks guy's. Feel like I've got a much better grasp on it now. Don't know why I just couldn't visualize it in my head. appreciate your time!
 
Thanks guy's. Feel like I've got a much better grasp on it now. Don't know why I just couldn't visualize it in my head. appreciate your time!


Without training or studies its impossible to understand much less visualize in your head. Its like visualizing Chinese langauges, unless you know the langauge your vision of it is completely wrong.
 
The thing is, people tend to buy stuff for the task they want to accomplish, rather than their theoretical role in an abstract formal system (OSI). Similarly, corporations are usually in the business of selling stuff, not formal systems. As a result, we have lots of different names for things that theoretically do the same thing (repeater/hub, bridge/switch, gateway/router) and similar names for things that ought to theoretically do different things (L2 switch, L3 switch).

All this stuff is basically the fault of a crazy guy who realized that you could make network wire and encoding/decoding equipment REALLY, REALLY cheaply if only you could accept two limitations:
1)The size of the wire/network had to be stupidly small - about a mile.
2)Time on the wire was divided into brief moments. Any device on a segment of wire could talk at any moment. When two devices happened to talk at the same time, the wire would either "take a break" or just "break" (depending on who you talked to) and stop working for a little while.

The history of computer networking is mostly two separate but parallel storylines:
(1) The quirky history of trying to make the ethernet wire work on a large scale despite those limitations.
(2) The less quirky history of trying to make different many different kinds of wire work together.

It's not so much "how would bridges, switches, and routers be used together" as it is "the routers they had in 1980s were useless to for the purpose of making ethernet both cheap and good, so some dude invented the hub. Then another guy invented a better hub called a switch that did more or less exactly the same thing as a bridge and finally someone made a better switch called an L3 switch, which happened to do more or less exactly the same thing as a router."

A bridge is generally used to extend the maximum possible length of a network segment (one continuous piece of wire connecting two or more computers) or to connect two physically different network segments - say, one segment of coax wire and another segment of twisted pair (telephone wire). A switch is typically used in place of a hub, which is a central repeater that connects lots of different wires (usually one per computer), effectively turning them into one big wire. Could you theoretically use a switch in place of a bridge? Sure. Would you? Usually you wouldn't, because switches that connect coax and twisted pair aren't generally made. Or rather, when they are made, they are typically called bridges and they usually have two ports, one for coax and one for twisted pair.

As far as the OSI model is concerned, bridges and switches are different from routers because they are concerned with mapping physical segments of wire to network cards (ie, this wire goes to that network card) and because they decide where to send packets based on both source and destination address.

But when your old switch dies, you will probably be looking at either an L2 switch or an L3 switch to perform the same function. Your ISP is unlikely to consider replacing a bad "core router" with an L3 switch. A device fits a particular product category based on price and speed - it has to go fast enough, but it can't be too expensive. Ethernet is cheap. Other kinds of networks don't need so much smart hardware just to shoot bits across a wire; the smarts is already built into the network.
 
Last edited:
I think a bridge is what was put between hub networks to stop broadcast storms wasn't it?
 
The main difference between most network devices is what they can learn.

Hubs, which nobody really uses any more, are stupid, they don't learn anything, any information they recieve they send to all attached devices.

Switches learn MAC addresses, they know what MACs are down which interfaces and any data recieved is only sent down the appropriate interface to the destination MAC. Some layer 3 switches can do static routing but only because you tell them the routers, they can't learn it on their own.

Routers learn IP networks. Through the use of routing protocols to talk to other attached routers they learn what IP networks are connected to its interfaces and through a cost mechanism if a network is reachable through multiple interfaces, it can determine which is the best interface to send data across to reach the destination most efficiently. Routers also have switching functionality and learn MAC addresses for all directly attached devices.
 
A router sends packets between two different networks (eg. the Internet and your home network). A switch just sends packets between different systems on one network.
 
Back
Top