Convention Listings
                                                                                                                        About Us | Donate! | Contribute! | Report Problems
   
Raiden's Realm is always in need of good, community generated articles and content for our site. So if you have a Linux, Open Source or Media Freedom related article, review, tutorial, or editorial you want to contribute, by all means please submit it to admin@raiden.net. Your contributions are always appreciated and will help us out immensely. Thanks.
   
An Introduction to Routers, Switches, and Hubs (Page 1 of 1)

Written by Steve Lake
Posted on: May 12, 2008 at 01:40pm
Section: Tutorials
Printer Friendly Version
Legacy URL

Understanding and knowing about routers, switches and hubs is important for any computer user because they are the backbone of every network in the world, from the littlest home network, to the biggest public networks.  It's these three simple devices that make all of them work, and make the miracle of the internet possible.  So let's look at each of these devices and see what roll they play in networks the world over.

Hub

A hub is the oldest, and simplest form of passive network device still in use today.   The number of people using them though is rapidly dwindling as hubs are systematically being replaced by switches.  There are two basic reasons for this.   The first involves the functionality of a hub.  Just as it's name implies, a hub is a device that acts as the central hub of a network, connecting together machines of every type into one physical network.  It routes traffic from anything to everything that is connected to it.  A good way to imagine this is to picture a room full of people.  In this room, everyone can hear everyone else.  

So if one person speaks, even if the message is directed to only one person, everyone hears it.  But if more than one person tries to talk at the same time, the words collide and communication is hindered.  Hubs work just like that.  They share one message with everyone regardless of the destination.  If more than one computer on the network tries to talk at the same time, something called a "collision" occurs and the two signals cancel each other out, resulting in the two machines having to resend their respective messages over and over again until they are successful. 

The more traffic that flows across a network using a hub, the more likely it is that collisions will occur, and the slower the network will become.  These digital traffic jams have the potential to bring a network to its knees, or slow communications to a crawl.  This is reason one why hubs are being abandoned for switches these days.  I.e., the lack of reliable network performance.

The second reason is because of security.  As mentioned above, a hub sends everything to everybody regardless of the destination, just like a digital parrot of sorts.  This creates mountains of security issues for which there's no easy solution.  This stems from the fact that if I wanted to listen in on every ounce of network communication you made, record it, and possibly use it against you at a later date, and you'd never know I did it, nor could you stop me.

This is made possible by switching your network card to a state called "promiscuous mode".  As the name implies, it receives any and all data passing across the network, and not just data intended for the address it was assigned.   So since hubs present such a monumental security risk, it is no longer advisable to run a hub in any environment.  Back in the days when you pretty much had to be a network hacker in order to have the tools to snoop on a network, this wasn't an issue.   But these days anybody can download the tools needed to spy on a hub centered network.

Switches

The switch is the king of all passive network appliances.  I say appliances and not devices because a switch, unlike a hub, can be managed.  Switches come in two forms.  A level 2 "dumb" switch, and a level 3 "smart" or "managed" switch.  (see our tutorial on the 7 layer OSI model for more details on network layers)  A level 2 dumb switch is, in some ways, similar to a hub.  It takes data in and sends it out.  It is also completely transparent on the network.   But the similarities end there.  Unlike a hub, a switch acts just like it's name implies by taking incoming data and "switching" or sending it only to its intended destination, just like the track switches in a train yard, or the valves on a series of pipes.  This has many huge benefits, such as improved network speed, security, manageability and more.  

A level 3 smart switch allows you to do a lot of interesting things you can't do with a level 2 switch, and most especially a hub.  Depending on the manufacturer and the feature list, a managed switch can divide up the network into separate parts (vlans), turn on and off different ports, limit or control speeds on the entire switch or on individual ports, control duplex settings, limit what MAC addresses are allowed to connect, set bandwidth limits, give some ports higher priority than others, monitor and log port traffic and a lot more.

For a passive network appliance, the switch is king when it comes to data transfer.   No other device, including a router, can do the things for your network that a switch can.  And they're so easy to use.  Just plug in the power, connect your network cable, and you're done.  Obviously the management features of level 3 switches aren't quite that easy, but for the average person using a level 2 switch at home, using them is as easy as breathing.

Routers

Where switches may be the king of all passive network appliances, the router is the king of all active network appliances.  Even firewalls are subjugate to the mighty router.  Without routers, all data would be confined individual local area networks, with no hope of reaching anybody else in the world.   Routers are important because they connect together hundreds of thousands of separate, distinct networks into one cohesive and dynamic web.

A router is similar to a switch in that it routes data from a specific source to a specific destination.  It can also do many of the same management features a managed switch can.  But that's where the similarities end.  A router is more like a traffic cop and a gate keeper in that it takes in data, and then, using a pre-defined set of rules, determines what data should or shouldn't be sent, and where it must travel to next.  Router configuration rules can be as simple as "allow data from this ip to go only to this ip".  If NAT is being used on a router to connect an internal private lan to the external public internet, port management also comes into play.

This is similar in some ways to how a firewall handles ports and IP's.  But while a router's rules are fairly black and white, a firewall can dynamically handle data based on type, source, destination and so much more.  This is done through a system called "stateful" packet filtering.  There are also ways in which firewalls can be protocol aware and take filtering to a whole new level. (Read our tutorial about "understanding firewalls" for more details)  But routers can't do that.  At least not to that level.  There are some very dynamic and powerful routers out there that have many firewall like abilities, but overall the primary job of a router is simply to route and control traffic.

One example of this is can be seen in a system used by a former employer of mine.   Because they were having regular problems with ping floods and ICMP based DDos attacks, they put together a ruleset that allowed only 1/3rd of all ICMP packets from any host to pass through the router.  If the host sent more than a pre-specified amount of packets over a five minute window, the host was blocked from sending ALL ICMP traffic until the timer reset.  It proved to be a very useful and effective way to keep attackers from flooding and overloading their network.

But even if data, packet and port management is one of the strong points of a router, their ultimate purpose is to route traffic.  One of the ways they do this is through two different protocols: RIP and OSPF.   Routing Information Protocol, or RIP for short, is the older of the two routing protocols and is what is known as a "distance-vector protocol" which uses a hop count as its metric for determining routes.  A "hop" is one stop along a network segment.  This "hop" is usually another router through which the data has to pass. 

OSPF on the other hand is a "link state" based protocol.  In other words, OSPF looks for what the status of a connection is, and if the connection is down, it chooses a different route to send data through.  It also looks at connection metrics, including the "cost" of the connection, and uses that to determine which route is optimal.  Connection cost is a pre-set metric that network administrators use to tell other routers which connection or route they would prefer you used first, on down to which should be used last.

Between the two protocols, OSPF is typically preferred over RIP, because RIP sends the entire routing table to every other router it's connected to every thirty seconds, whereas OSPF only sends out updates when changes are made, and only transmits the changes, not the entire table, which can sometimes be very big.  This creates less "noise" on the network, and thus doesn't interfere with normal network traffic or cause slowdowns.  OSPF also tends to update much faster than RIP does when troubles occur on the internet or your local network. 

That's why if a router goes down and blocks your route to a host, unless there's no way around that router, you'll see the connection return in as little as five minutes as a different pathway to the host is chosen automatically by OSPF.  This dynamic shifting of routes and pathways is part of what makes the internet so resilient and durable.

Routers also can be used to connect separate Tier 1 Tier 1 (top level) networks together to make them part of the global network known as the internet.  To do this they need something a little more specialized than just OSPF or RIP.  This is where Border Gateway Protocol, or BGP for short, comes into its own.  BGP is a protocol used to connect major Tier 1 networks together on the internet.  It allows dissimilar networks to "peer" with each other and share data effectively. 

But even if this isn't something you'll use on your home or office network, it is still something that affects you and your internet experience immensely.  Especially since failure of a BGP connection typically breaks the communication between border routers, rendering your access to a server on the other network impossible.   As for what a border router is, it's nothing more than a regular router that sits at the edge or "border" of a Tier 1 network and controls what data is allowed to come in or leave a given network.  They're an ordinary router that acts like a sentinal of sorts.

Conclusion

Well, that's it for this general overview of Routers, Switches and Hubs.  I've only touched on the basics and covered the most important points of each device in order to give you a grass roots understanding of the importance of each of these network devices and how they affect your network or internet experience.  I encourage you to do more research on your own and learn all you can about these amazing devices, because there's so much out there you can learn, and that knowledge may come in handy some day..

Discuss this!  ( 1 comments )

Raiden's Realm Social Bookmarking
If you have any problems with any of these links, please let us know.  Thanks.

Digg it! Slashdot It! Del.icio.us Add to StumbleUpon Add to Technorati Reddit! Add to Google Bookmarks Add to FaceBook Share Add to Twitter

Average vistor rating: 4.6 out of 5 (9 total votes)

Community Image Gallery

More Images
Submit new images to gallery

Upcoming Shows and Cons

 1.  LinuxCon 2010
 2.  OpenSource World 2010
 3.  Ohio Linux Fest 2010
 4.  Atlanta Linux Fest 2010
 5.  ESC Boston 2010
More

Announcements

This is just a reminder to everyone that we're always looking for articles for posting on our site.  So if you have a Linux, Open Source or Media related article, review, tutorial, or editorial you want to post, by all means please send it to admin@raiden.net and we'll be glad to post it.  Thanks.

Have you ever bought a PC or laptop preloaded with Linux?

Yes
No
Considering it
Other ( Please specify )

More Polls
Latest Releases
(courtesy of Distrowatch)

1. Clonezilla Live 1.2.5-38...
Released: 07/29
2. RIPLinuX 10.6
Released: 07/29
3. Mint 9-rc (Fluxbox)
Released: 07/29
4. Nexenta 3.0-rc3
Released: 07/29
5. Salix 13.0.1
Released: 07/29
6. AUSTRUMI 2.1.6
Released: 07/28

More
All original content on this site is copyright of Raiden's Realm via the Creative Commons license. All rights reserved.

Any non original content is the sole property of the respective owners.