I’m so excited to talk about Routing today! How many times have you heard a friend say “I just brought a new router” or “Just reset the router when it freezes”. I hear it all the time. People brazenly bandy the term around like a tennis ball but very few people really know (or care) what it means.
What exactly does it mean to route internet traffic anyway? That’s what I’ll address today.
But before we get going I need to warning you: Routing is a convoluted topic. There are a myriad of protocols which each have their particular way of doing things. So instead of focusing on the details of each protocol I tried to give you a big picture overview of how it works. In this guide I just want you to be familiar with the terms and theory. Consider it the appetizer before the main meal.
- Define routing
- Describe the 3 ways router get routing information
- Dive into Directly Connected Routes
Oh, and on a side note: I just want to remind you that if you find some of the topics confusing today you should check out my beginners series on how networks work and the lowdown on TCP/IP layers. You might also want to check my juicy series on IP addressing. It’ll really give you the confidence to tackle this stuff.
Okay, let’s get right to it!
A routing protocol is just a language.
I speak English. My wife speaks English, Korean and Spanish. My son speaks baby. Just as people who know the same language can understand each other so routers who “speak” the same language can make sense of the data.
OSPF is one language. RIP is another language. EIGRP is another language. If two routers are speaking the same language, the first router can tell the second router about all the routes it knows about. Likewise, the second router can tell the first router about all its routes. Then the first router can say: “Hey Router 2, since you told me about that route I’m going to use you to get there”. Router 2 says the same thing about Router 1 and that’s it.
You can stop reading now because that’s how it works haha. But if you want a little more details (and a little more Vonnie) keep reading
This post will answer one question and one question only: how does a router determine where to forward packets? How does it know where the remote network is?
What is Routing anyway?
Think about your home. Think about your bed and how much you wish you were there right now. hahaah nah, just kidding – but seriously think about your home.
Your home probably a sidewalk that leads directly from the front door to the street. Let’s say you you’re a rich chick and live on Madison Avenue in New York City. If someone asked you: “Hey, do you know how to get to Madison Avenue?” you would immediately say: “Ha! Duh, I’m directly connected to Madison Avenue. That’s obvious. It’s right out my front door”
This is what happens with a a router and its directly connected interfaces. As far as a router is concerned, each network interface card (NIC) is a completely different network.
Each NIC represents a different street.
So let me get artsy fartsy on you for a second.
So let’s say your co-worker is sitting at the laptop in the graphic above. He try to bring up imsoboredandhavenolife.com which resolves to 22.214.171.124.
The packet zooms through the Ethernet twisted pair copper wires at the speed of light. When Router 2 gets the bits on the physical layer, it looks in the Layer 2 Ethernet header and sees the destination MAC address matches its own MAC address.
Intrigued, the router peels back the Layer 2 packaging and exposes the warm gooey center: the Network Layer. Mmmmm delicious like a freshly baked Twinkie.
The destination IP address is 126.96.36.199. Since this doesn’t match his own IP address he says something like this:
Hey I know how to get packets to the 10.45.0.0/24 and 10.1.0.0/24 networks but I have no idea what to do with 188.8.131.52 so… I’m freggin’ dropping this packet
This is why we need routing.
The secret to router intelligence
Routing is the process that allows routers to learn about networks. There are only three ways a router can learn about a network:
- Directly Connected Routes
- Static Routes
- Dynamic Routes
A directly connected route is like walking out your front door and seeing that you live on Madison Ave. A static route is like driving to the market and then writing down the path you took to get there. And a Dynamic Route is like having an alert automatically sent to your iPhone whenever a construction project creates detours and road closures.
If you explicitly told the router how to get to a specific network that would be a static route. For example, you could tell R2 that to get to the server at 184.108.40.206, he needs to forward the packet out his gi0/0 interface toward 10.1.0.0/24. Then, based on our little diagram we would also have to manually tell R1 that access the host at 220.127.116.11, he needs to forward the packet out his s/0 interface.
With Dynamic Routing we just tell all the routers to take what they know and share it with everyone else. R2 would tell R1, “Hey, here are all the directly connected routes I know about, add them to your routing table” and R1 would say the same thing to R2. All the routers would share their routing tables with every other router so that all routers know how to get to any network in the topology. The router also periodically checks in with all the other routers to make sure everything is cool. If a router dies or blows up all the other routers need to know about it so the network traffic doesn’t get lost.
Let’s take a closer look at each of these learning methods on my Cisco 3725 router.
A closer look at Directly Connected routes
Let’s connect a console cable to the router and check out the routing table.
show ip route
The first part shows a bunch of letter codes. Difference letters simply indicate the way the routes were learned. For example, routes wit ha C prefix are directly connected to the router. Routes with the S prefix are static manually configured routes. The rest indicate routes that were learned through a dynamic routing protocol.
The last part of the output shows you the two networks that are directly attached to the router. Notice it says 10.0.0.0/24 is subnetted, 2 subnets. It says that because we have a class A network with a non-class A mask. In other words, we’re using classless routing. Classful routing would use a default class A Mass of 255.0.0.0 (/8) but since we’re using a slash 24 mask on the class A network the router is simply telling you that the network is subnetted.
Also notice that my router knows nothing of the other routers in the topology. It’s completely clueless! It has no idea that there are even other routers out there!
The import thing to notice is that the router knows if it needs to reach the 10.1.0.0 network it knows to forward the packet out it’s FastEthernet0/0 (fa0/0) interface. And if the router needs to forward a packet with a destination address in the 10.45.0.0 network it knows to forward it out FastEthernet0/1 (fa0/1)
Here’s what this looks like up close:
Let’s say a user sends a packet to 18.104.22.168 through R2’s fa0/1 interface. R2 looks at the layer 2 info and says, “Yo, what’s the destination MAC address? Ah! it’s the MAC address of my fa0/1 interface! Okay I’ll take a closer look at this frame”.
Then R2 de-encapsulates the frame and looks at the layer 3 addressing information. “What’s the destination IP address? 22.214.171.124. Hmm, my IP address is 10.45.0.1 but let me see if I know someone who knows something about the 126.96.36.199 network. ”
So R2 looks at the info in the show ip route table and says “Ahh! I have no idea I have no routes to that network” and it drops the packet. The result is the user gets an error of some kind and the communication breaks down.
The Bottom Line
Now you know what routing is: it’s just a bunch of friendly routers telling other friendly routers what’s going on in the ‘hood. You also learned about the three methods routers learn routes and we described the basics of Directly Connected routes.
In the next article we’ll explore the nuances of Static Routes, RIP, Administrative Distances and Metrics. It just keeps getting better baby!
Check back on the site tomorrow. I’ve got you covered!