how routers work

Abubakar Bello Adamu
Abubakar Bello Adamu used Ask the Experts™
i chose networking as my area of specialization and im just a beginner so i want to know the important of router in networking
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Patrick BogersDatacenter platform engineer Lindows
Routers are, basically, the only devices that can connect networks together (besides Switches with L3 capabillities)
Thats why in the OSI layer you find routing at layer three, where layer three is responsible for communicating to the world which basically lives at layer four.
Michael LinkInfrastructure Engineer
If you are starting to learn networking, these are the things to look into first:

  • TCP/IP and OSI Models
  • Cable Types
  • Networking Protocols
  • What a packet is?
  • The difference between layer 2 and layer 3 switches/devices
  • Routing protocols
  • What a collision domain is?
Top Expert 2014
There are many reasons why routers are important but the main reason is in the name... a router.  They route traffic.  The importance here though is that they route traffic that's destined for a network address which is different to that of the source device.

It's a bit crude, but think of routers as a sat-nav.  They have the capability to direct traffic (routing) to its destination based on a database of addresses (routes).  Without a router you can't get out of your street (network segment) because you don't know which turn to take.  If you only need to talk to your neighbour you're ok as you know number 10 is next door or across the street, for example (you just have to look at the door numbers if you don't know exactly which house), but if you want to go to your friend's house in a different part of town you need to know the address as well as the directions to get there.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Another feature that is often provided by a router is Network Address Translation (NAT).  In addition to other features, NAT allows multiple computers (with private IP addresses such as 192.168.x.x, 10.x.x.x, 172.x.x.x) to share a single connection (typically to the internet) through a single public IP address.  Without that, we'd have lost the ability to keep adding computers to the internet because of running out of IPv4 addresses.
in order to understand where routers fit into the grans scheme of things, perhaps these 2 articles on OSI (Open Systems Interconnection) model / OSI layers would be useful to you:
OSI reference model (Open Systems Interconnection)
Posted by: Margaret Rouse
Contributor(s): Daniel Kroon
OSI (Open Systems Interconnection) is reference model for how applications can communicate over a network. A reference model is a conceptual framework for understanding relationships. The purpose of the OSI reference model is to guide vendors and developers so the digital communication products and software programs they create will interoperate, and to facilitate clear comparisons among communications tools. Most vendors involved in telecommunications make an attempt to describe their products and services in relation to the OSI model. And although useful for guiding discussion and evaluation, OSI is rarely actually implemented, as few network products or standard tools keep all related functions together in well-defined layers as related to the model. The TCP/IP protocols, which define the Internet, do not map cleanly to the OSI model.

OSI model
From Wikipedia, the free encyclopedia
The Open Systems Interconnection model (OSI model) is a conceptual model that characterizes and standardizes the communication functions of a telecommunication or computing system without regard to their underlying internal structure and technology. Its goal is the interoperability of diverse communication systems with standard protocols. The model partitions a communication system into abstraction layers. The original version of the model defined seven layers.
In some respects, switches and routers do the same thing:
"I have received a packet, where should I send it?"
Contrast this with a "hub" where there are no smarts at all:
"I have received a packet, I'll just send it everywhere (e.g. "I received a packet on Port 1 so I'll send it out on Ports 2-8")

Most switches, these days, are "smart" in that they keep an ARP cache and will send a packet destined for a particular MAC address (i.e. device) out on a particular port.
Where a hub will cause collisions and re-transmits of packets, a smart switch can communicate between devices with no collisions and increase the effective bandwidth.
If there are 8 devices on an 8-port switch and they are communicating in pairs 1-2, 3-4, 5-6,7-8 ONLY then there will be no collisions and the packets will flow freely back and forth between 1-2, 3-4, 5-6,7-8  using the ARP cache to direct traffic. (Matching the MAC addresses of the devices and the switch ports).
HOWEVER, if one of the switch ports is an "upstream" connection that all traffic has to go through then the upstream traffic will collide and only downstream traffic will not (it already has done that in getting onto the link coming "down").

Routers incorporate switches like this.  So much of all this still applies.

Routers add the ability to *route* traffic.  
NAT is the most familiar application and has already been described.  
Sometimes this is called "GATEWAY" MODE.
There is a WAN port with an "outside" IP address and there are LAN ports which are reached through a single "inside" IP address on the LAN subnet.  
Packets destined for the router are dealt with.
Packets that aren't destined for the router are ignored.
The NAT function figures out and manages where packets go.
1) Open a browser on PC "A".  PC "A"sends packets to the router.  The router sends packets out onto the internet to connect PC "A" to a public web server.
2) Packets return to the router IP address from the web server.  The router knows that these are to go to the web browser application on PC "A".
Consider this:
What if the user on PC "A" opens Internet Explorer and Google Chrome at the same time?  How are all those packets kept separated?
A *port number* is appended to the outgoing packets that aligns with the application.
Also, a *port number* is appended to the packets departing the router toward the internet.  So now there are effectively 2 port numbers.
When the web server responds back, the port number is translated to PC "A"and the app:  IP Address for PC "A" and Port XXX   for either Internet Explorer or Google Chrome

Then there are variations on this simple theme such as port forwarding, etc.

A simpler mode is often called "ROUTER MODE" or "NO-NAT"or perhaps "BRIDGE MODE."
In this case the router (the BRIDGE) doesn't translate the addresses at all, it just forwards packets.

Imagine that you have two networks in your office because there used to be two separate companies.
Suppose that the subnets are different.
You want to connect the traffic between companies.
You add a router (the BRIDGE) that's connected on one side to one LAN and on the other side to the other LAN.
You assign an IP address on each side of the BRIDGE that includes the appropriate subnet mask.
Traffic destined for the "other" subnet will be directed (routed separately) to the BRIDGE.
The BRIDGE router will forward the packets received to the "other side".
No added ports.  No destination management.

PC "A" on LAN1 sends a packet destined for PC "B" on LAN2
PC "A", being on LAN1, doesn't know anything about LAN2 (unless it has a static route added for this) so it sends the packet to its "default" destination, the LAN gateway.
The LAN gateway (a router) recognizes LAN2 subnet as an address range in its routing table and sends the packet to the BRIDGE router's IP LAN1 IP address.
When packets return from PC "B" the same process occurs on LAN2.
When packets return from PC "B" on LAN2 and reach the LAN1 side of the BRIDGE, they are dumped out on the LAN1 wire and the destination PC "A" recognized that "this packet is for me".

So, the gateways are only used for outgoing packets on either LAN.  They aren't needed for return  packets at the receiving end.

There is much more but if you can follow these simple descriptions then you will have captured a great deal!
Natty GregIn Theory (IT)

In the above mention, I'm only going to add that you take your time or you'll be overwhelmed so start with the list Mention by Michael then slowly dive into the rest. know what they are ----- first then what they do then your understanding will be opened.
Top Expert 2014

NAT isn't really a routing function but more of a trick. Some routers can't do NAT at all, and only some layer3 switches can do it.
Craig Beck:  I guess you mean in an RFC sense or what?  NAT is certainly an important ingredient in router products.  Maybe this isn't the place (it's not a chat) but it would be nice to understand better what you mean.  Maybe in the context that Bello Adamu can benefit from?
Top Expert 2014

Access control lists are an important feature too but they're just a trick as well. I'd argue that NAT is only important at the network edge (or between networks). It certainly isn't a requirement inside a network in 99% of cases, hence people using layer3 switches rather than routers.

A router's primary purpose is to pass traffic based on its destination, not to manipulate the traffic. Anything other than routing the raw traffic is an added extra.
Network Trainee
Hi there,

I have recently been drilled in a little *cough* A LOT of cisco CCNA material, I can definitely recommend you to go into the various subjects written by Michael Link (listed above). I have some additions to build ontop of those, just to give you some ideas and some tips where to begin, don't know where you are networking wise - we're all learning, so bear with me please. These are more general and you WILL have to work with actual hardware, getting your hands dirty as they say.

The instructor I had told me to master the following 4 points. It really helped me A LOT to get started and to kind of find a red line through the cisco forest:

1. Master switching (and a few useful commands)
- Links -> "show ip int brief" / "show int status"
- VLAN -> "show vlan brief"
- Native VLAN, what does it mean and do?
- Trunking -> "show int trunk"
  VTP - VLAN Trunking Protocol - How does it work and do (server/client/transparent) ?
- STP - Spanning Tree Protocol - why it is important?
  "show spanning-tree"
  HiMac, Root Ports, Designated Ports, Hello Time, Max Age
- Access mode vs Trunking Mode
  Frame Tagging - 802.1Q, when is it used and for what?
  BPDU's = Bridge Packet Data Unit

2. Master routing
- NAT = easy to set up with a few commands (Inside / Outside)
- ACL's - Access Control Lists.
  Standard 1 to 99 (layer 3), Source addresses [Placed close to destination]
  Extended 100 to 199 (layer 3 - source addresses, destination addresses)
                  (layer 4 - port numbers, and protocols) [Placed close to source]

- Take some time digging into routing table and learn to read one "show ip route"
-- Gateway of Last Resort - is it set and what does it do?
-- Static routes
- Know what Adminitrative Distance mean relating to routing protocols.
- How to configure your interfaces.
- Why you need to use a gateway?

3. Master subnetting
- How to size your network?
- Classfull vs Classless (VLSM and how to calculate that - youtube can help you there).

4. Master vocabulary
- Take a few network words ie. What does LOOP mean and what is it connected to and why?

• TCP/IP and OSI Models
- OSI is your main focus, especially the lower 3-4 layers.
- Personally haven't really used the TCP/IP much, but you have to know it.
- Know what is encapsulated on which layer - (packets on network layer and how they travel / flow).
- Which devices reside on the each layer - (ie. switch/bridges on layer 2 - Datalink layer)

• Cable Types
- crossed, straight, console, when to use them and where.
- Know your fiber cables (single mode / multi mode). Are they using LED or Laser?
  Different stats, costs, usage and such.

• Networking Protocols
- Know your most basic ports, ie. SSL (22), POP3 (110) and so forth.

• Routing protocols vs Routed protocols.
- Routed protocols = allows packets to travel
-- IP, IPX, Appletalk protocols

- Routing protocols = allows routers to exchange information
-- Distance Vector = RIP (120) and EIGRP (90)
-- Link State = OSPF (110)
(xx number is the administrative distance = Reliability / "Best Path". Lower number is better.

• SuperNetting
- Route Summarization
- Route Aggregation
- Calculate route Summary

• What a collision domain is?
- What does collision mean?
- What does segment mean?
- What does broadcast mean?
- What does network mean?
- What does stub mean?
(hint: segment and collision = same.
       broadcast and network = same)

Find/make a network and count the various domains.

• What does DORA (DHCP) mean and how does it work?
- Unicast and broadcast, when and where?

• What does communication mean?
- Full and Half duplex, Simplex (fiber)
- Microsegmentation (heard of Split Horizon?)

• What does switching do?
- Cut-through store, forward switching, fragment free switching
- Link aggregation and bandwidth contention.

CCNA exam perhaps?
- If you plan on taking it, I would recommend you get into both EIGRP AND OSPF. However as of recent, Cisco decided
to remove OSPF from their teaching material. EIGRP being the proprietary protocol I can understand they would be using that only in their modules. However you need to know OSPF, Open Shortest Path First, as well since Cisco isn't the only vendor out there ;)

That said, I hope you have fun learning, I know I did. If you're just starting, install Packet Tracer / GNS3. Or visit amazon for some real gear. OR get a job at an ISP or google datacenter, and you'll definitely have your hands full.

I am truly sorry for the TL;DR wall of text, hope you're still with me. Everything written above is on a more general term. And it's my opinion, still learing, I hope you can make a sense of it. Again, I hope you have fun learning and good luck in your networking endeavours :)
Patrick BogersDatacenter platform engineer Lindows

Hi Sarah, this is good Reading and worth creating an article for, did you think of this?
Natty GregIn Theory (IT)

Hi Sarah it seems like you're still in school, with your suggestion everything come flooding back to mind. As mentioned by Patrick Article it please.

So it will be useful as a reminder and to those seeking this information.

Great write up
Sarah S.Network Trainee

Patrick and Natty,

I am really glad you found it interesting and worth reading. Thank you :)

To answer your questions regarding school, Natty, then no, I am not in "school" any longer. My current employer thought, it would be a splendid idea to bring in a network guru, as part of a 2-day teambuilding bootcamp thing, to kind of educate 4 "IT dumb" girls in networking. Yeap, I were/am? one of them. He however didn't count on the teaching skills of the instructor, so what started as a simple "what happens when you plug this cable into this box tthingy?", started an avalance of questions and a lightbulb being turned on IT wise.

Afterwards I insisted, he'd sign me up for a Cisco course, and well, what started up as somewhat fun/jokey (is that a word?) event, ended up with him close to loosing his PA to the IT World ;)

Speaking of an article, if you guys think it would be a good idea, I am all for it. Funny thing is, I haven't been on EE for almost 7-8 years, since a summer internship back in my younger school days. I am still trying to wrap my head around Cisco, EE and figuring out this whole new world. Funny how things go.

In retrospect, I probably need a raise now ;)
Natty GregIn Theory (IT)

Patrick BogersDatacenter platform engineer Lindows

Good explanations given.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial