To route or not to route a day in the life of a router
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

To route or not to route a day in the life of a router

on

  • 684 views

To Route or Not to Route A Day in the Life of a Router. More DETAILS...

To Route or Not to Route A Day in the Life of a Router. More DETAILS...

Statistics

Views

Total Views
684
Views on SlideShare
684
Embed Views
0

Actions

Likes
1
Downloads
20
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft Word

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

To route or not to route a day in the life of a router Document Transcript

  • 1. To Route or Not to Route: A Day in the Life of a Router“To route or not to route, that is the question.” ---Signed, the RouterHow many decisions must a router make each day? The answer: millions! A lot goesinto the decision process regarding routing, and it happens long before a packet,being sent by a customer, arrives at the router for its turn to be forwarded. Join meas we take a close look at a day in the life of the router.Planning AheadA common theme in success strategies is to plan ahead and be prepared, so thatwhen a circumstance presents itself, we already know what we should do. The sameis true for an IP router. Consider the router below, with 4 interfaces.Figure 1When a packet arrives at Ethernet interface 1/0, the router has a decision to make.Options for the router seem fairly simple; discard the packet or route it out of one ofits interfaces. Long before a packet shows up to be routed, the router should betrained on what to do and which interfaces to use. This training process is called the“control plane” of the router, and is how the router learns where networks are(similar to us knowing where various cities are), and the best path to reach thosenetworks (similar to us knowing which onramps or surface streets to use to reachthose cities).The Learning ProcessThe control plane for the router only has four ways of learning about networks, that’sit! They are:http://blog.router-switch.com/
  • 2. 1. Directly connected networks 2. Statically learned networks 3. Dynamically learned networks 4. Default routesLet’s look at each of these options, and learn what impact they have on the router’sdecision process.Directly Connected NetworksOn a brand new router right out of the shipping box and plugged in, it doesn’t knowabout any IP networks, because it has no IP addresses configured. The first time weadd an IP address with an associated mask to an interface, and bring that interfaceout of shutdown state, “POOF!” the router now knows about its first network, whichis the directly connected network we just configured. Even if this interface isconnected to a switch with no other devices on it, the router still believes it canreach this local network, due to the IP address configured on the local interface.In the example below, the new router has no IP addresses configured, and thereforenothing in his routing table.Figure 2After configuring an IP address on an interface and bring up the interface, the singledirectly connected network is now in the routing table. The new network in therouting table below is 10.0.0.0/24.http://blog.router-switch.com/
  • 3. Figure 3Statically Configured NetworksAs long as the router is directly connected to at least one IP network, we can trainthe router about using that connection to reach other networks as well (via otherrouters who are also on that same connected network). Manually telling the routerabout a non-local network is what the static route is all about. It is also an issue offaith for the router. For example, if we tell the router that to reach the network of23.1.2.0/24, it should send those packets to R2 at 10.0.0.2, and our router wouldnow believe it knows how to forward packets to the 23.1.2.0/24 network. In reality,the router would hope (if routers had feelings) that the device at 10.0.0.2 knows howto reach the remote network of 23.1.2.0/24. R1 would not really know, for sure, if R2could reach it or not. In the example below, a static route has been added to R1informing R1 that to reach 23.1.2.0/24 it should pass the packets to the router at theIP address of 10.0.0.2Figure 4Dynamically Learned NetworksManually configuring individual static routes can be tedious, especially in largerorganizations with many routers and many networks. A solution to avoid having touse static routes everywhere is dynamic routing. It really should be called dynamiclearning, because that is what is going on. Using a set of rules called a RoutingProtocol, each of the routers dynamically shares the routes is knows or has learnedwith other routers. This way, when a new network is added directly to R2, or whenhttp://blog.router-switch.com/
  • 4. R2 learns about a new network, this information can be shared with R1 so that R1will have dynamically learned the route. The routing protocols inside of anorganization fall into a category called Interior Gateway Protocols (IGPs); examplesinclude RIP, EIGRP, OSPF, and IS-IS. In the example below, R1 and R2 are running theOSPF routing protocol, and exchanging routing information.Figure 5R1 has learned routing information from R2, and the network 23.0.0.0/24 shows upin R1’s routing table. In the example below, we are confirming that R1 knows aboutR2 via the OSPF routing protocol, and verifying that R1 has learned a route, via OSPF,for the network 23.0.0.0/24Figure 6The Default RouteThe last method is also a sort of last resort when it comes to routing: the defaultroute. It is what the router should do when it needs to forward a packet and doesn’thave an entry in its routing table for any part of the destination address in the IPheader of the packet. For example, we could have a route that says forward packets(when you don’t know what else to do with them) to the router at 10.0.0.2; thiswould be an example of a default route. Routers may learn a default route from aneighbor using a routing protocol, or a default route may be statically configured. Inthe example below, R1 is using a manually configured static route that instructs it touse R2’s (the IP address of R2 is 10.0.0.2) as the next hop (router) for any packetsthat don’t match a more specific route in R1’s routing table.http://blog.router-switch.com/
  • 5. Figure 7Putting Useful Knowledge to WorkAs the router is being trained about reaching networks, which is the control plane wetalked about earlier, it places the information about how to reach those networks(such as the next router’s IP address, and which exit interface to use) in the routingtable. There are a few extra processes going on in the background, but by and large,the routing table is the winning route’s #1 podium position at the Olympics. Only thebest routes (best path, in the router’s mind, regarding how to reach the remotenetworks) go into the routing table. If there are two equal cost (in the router’s mind)paths to the same remote network, then the router can place both of those routes inthe routing table and use them both to forward packets to the remote network. It isthe metric (sometimes referred to as cost) that the router considers to determinewhich of several routes it knows about (for the same remote network) would be the“best” route to use. Using the metric, lower is considered better.What about conflicting information?In a situation where the same network is being learned via two different methods,for example a static route for the 3.3.3.0/24 network and a dynamically learned routefor the 3.3.3.0/24 network (learned from a neighbor), the router will consider aspecial value called AD (Administrative Distance) that is associated with each methodof learning it does, and if there are two exact routes from different sources, therouter will choose a single winner (for that route) based on the method that has thelowest AD (lower is better). AD has defaults on a Cisco Router, which can be changed.http://blog.router-switch.com/
  • 6. Some of the defaults are listed in Table 1.Table 1How the Route was Learned AD (default Administrative Distance)Directly Connected Interface 0Static Route 1Internal EIGRP (Dynamic IGP) 70OSPF (Dynamic IGP) 110ISIS (Dynamic IGP) 115RIP (Dynamic IGP) 120Here we can see the route for network 3.3.3.0/24 in the routing table of R1. Thenumbers in brackets show the [AD/METRIC]. In this example, the route was learnedvia OSPF, which has an AD of 110, and the OSPF metric for that route is 145.Figure 8So if the router learned about the network 3.3.3.0/24 via OSPF and had that route inthe routing table, and later we added a static route for the same network, the newstatic route with an AD of 1, would be better (in the mind of the router) than theroute from OSPF with a metric of 110, and the static route would replace the OSPFlearned route on the winner’s podium in the routing table. We can see this with thedebug running for IP routing. In the example below, we add the static route, whichdue to a better AD than OSPF is now placed in the routing table.Figure 9Forwarding Customer PacketsThe learning of routes is called the control plane, and is the process where the routerlearns and decides the best routes to use. This control plane is like going to class,where the router does the learning of routes and how to forward packets. Theapplication of this learning, where the router actually forwards real packets (usingthe information it previously learned about routes) is called the Data Plane, andoften referred to as the transit path or packet switching.http://blog.router-switch.com/
  • 7. When a router receives a frame of data from a switch, the router looks at the Layer 2destination address (in the frame of data) and asks itself, “Do I care about this frameof data? Is it relevant to me? What is my motivation to continue working with thisframe?” Regarding IP version 4, if the L2 destination MAC address is the MAC addresson the router, or the L2 address is a broadcast address, or the L2 address is theaddress of a multicast group that this router has joined, then YES, this frame of datais interesting or possibly relevant to the router. As a result, the router will lookfurther into the packet to see what else is inside. In an Ethernet L2 header, itspecifies what the payload is (the protocol being carried), which could be dot1q,MPLS or even IP. For this example of IP routers, let’s say the L3 information was IPversion 4. In the packet analysis below, it shows a L2 frame with a destination MACaddress of R2, and a destination L3 address of 3.3.3.3 which is not local to R1 or R2.Figure 10When receiving this frame and because the L2 destination address was relevant to R2(00:64:40:22:22:22 is R2’s MAC address), R2 continues to dive into the packet andthen looks at the L3 destination address, and asks, “Do I care about this packet (at L3)of data? Is it relevant to me?” If the destination IP address in the L3 header matchesan IP address of the router, the router would realize this packet was specifically forhim, and would continue to look deeper into the packet to see what the packet wasall about. An example of traffic destined to R2 could be a packet carrying part of aTCP based SSH session between the router R2 and the administrator.What if the L3 Destination Address doesn’t belong to the Router?If the L3 destination IP address is NOT one of the router’s IP addresses, the routerrealizes the packet is not for the router personally, but the router is willing to forwardhttp://blog.router-switch.com/
  • 8. (or route) this IP packet (it is a router, after all). The router consults the routing tableto determine if any of its routes/networks in the routing table match the destinationIP address in the packet. If a packet has the destination IP address of 3.3.3.3, therouter would look for the longest match (if there were multiple different lengthentries in the routing table), and use that route to forward the packet. In the outputbelow, the routing table lists that it knows one subnet from the Class A network of3.0.0.0, that it is subnetted down to a /24, and that 24 bit network is 3.3.3.0.Figure 11Because the first 24 bits of this route/network in our routing are an exact match ofthe first 24 bits of the packet we need to forward, this is our longest match. R2 willforward the packet on the L2 address of 23.0.0.3 (based on the routing table above)and will use Ethernet 1/0 to forward the packet. The device at 23.0.0.3 will then gothrough the similar process of opening up the packet, and making a routing decisionabout that packet. This is a story that happens millions of times per day, in networksall around the world.If a router doesn’t have an exact match based on its routing table, it will then use itsdefault route for forwarding, and if there isn’t a default route either learned orconfigured on the router (with no other more specific routes in the routing table),the router will drop the packet, and send a message to the source IP from the packet,letting that device know that the packet was dropped. (This isn’t really an apology fordropping the packet, but more for just notification that it happened).There is an entire fascinating world happening within our networks, and I hope youhave enjoyed looking into the concept of routing from the router’s perspective.More Networking Tips:‘What Happens in the VLAN Stays in the VLAN?Understanding Static Multicast Routeshttp://blog.router-switch.com/