How do Routing Protocols work

what is routing protocol with example and how routing information protocol works
HartJohnson Profile Pic
HartJohnson,United States,Professional
Published Date:02-08-2017
Your Website URL(Optional)
Comment
7 routing protocols It’s a Matter of Protocol I have a really high hop-count. I wonder what my protocol should be? To build big networks, you need to use routers and they have to talk to each other. Routers need to exchange routes with each other. They use various routing protocols to exchange routes. In the chapter, you will first see how to manually enter a route, then you will learn how to implement the simple RIP routing protocol. Finally you will learn how to setup EIGRP, an advanced routing protocol. this is a new chapter 243 Download at aMoonbase 1 back to the moon Houston, we have a problem... So far, you’ve successfully hooked up the Moonbase network so that it can communicate with the ISS. There’s just one problem: there are actually 20 bases on the moon, and all the different moonbases need to keep in contact with each other through their network links in case they get into trouble. So is this possible? When the international community started building the moonbases, they wisely decided to run fiber optic cables to all of the different moonbases. Each moonbase is directly connected to at least one other moonbase, and indirectly connected to all the others through the web of fiber optic cables. As an example, Moonbase 1 is directly connected to three other moonbases, and indirectly connected to all 20 others. The Moonbase 1 router is able to send packets to the moonbases it’s directly connected to, but it can’t communicate with any of the other 18 moonbases it’s only connected to indirectly. So how do we get routers to communicate with each other when they’re not directly connected? 244 Chapter 7 Download at a Moonbase 1 is indirectly connected to this router via another router. Direct network connectionsrouting protocols Routing tables tell routers where to send packets When two routers share a common IP network space or network address, they can automatically route packets to each other. But what about when routers aren’t connected to each other directly? When routers aren’t directly connected to each other, they need to know how to send packets to the other router. They get this information from routing tables, tables which are stored in the memory of the router. We can see routes in the table using the show command To see the route table on a router, you need to use the show command. On a typical router such as a Cisco, you would run the show ip route command. File Edit Window Help TheAngelsHaveThePhoneBox router1show ip route Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, - candidate default, U - per-user static route o - ODR, P - periodic downloaded static route Gateway of last resort is 209.137.230.1 to network 0.0.0.0 D 204.62.205.0/24 90/30720 via 209.137.230.124, 2d18h, FastEthernet0/0 209.137.230.0/25 is subnetted, 1 subnets C 209.137.230.0 is directly connected, FastEthernet0/0 C 204.62.201.0/24 is directly connected, FastEthernet0/1 C 172.17.0.0/16 is directly connected, FastEthernet0/1 D 172.16.0.0/16 90/30720 via 209.137.230.3, 2d19h, FastEthernet0/0 D 172.19.0.0/16 90/30720 via 209.137.230.124, 2d18h, FastEthernet0/0 D 204.62.203.0/24 90/30720 via 209.137.230.3, 2d19h, FastEthernet0/0 S 0.0.0.0/0 1/0 via 209.137.230.1 router1 Let’s take a look at what the contents of the routing table actually mean. you are here 4 245 Download at a These codes tell you how the router knows about the routes.The destination IP network How the router got the route The address of the interface, or the other router where are you going? Each line represents a different route The route table is a type of address book for the router. It looks at a packet’s destination IP address, then looks that up in its routing table. Based on that lookup, it sends the packet to the right place. Each line in the routing table has two parts. The first part is a letter which tells how the route was established. The second part tells the router how to get to the route. The route table is constantly kept up-to-date by the router so it knows where to send packets. D 204.62.204.0/24 90/30720 via 209.137.230.22, 09:52:06, FastEthernet0/0 D 204.62.205.0/24 90/30720 via 209.137.230.124, 4d12h, FastEthernet0/0 C 209.137.230.0 is directly connected, FastEthernet0/0 C 204.62.201.0/24 is directly connected, FastEthernet0/1 C 172.17.0.0/16 is directly connected, FastEthernet0/1 D 172.16.0.0/16 90/30720 via 209.137.230.3, 7w0d, FastEthernet0/0 D 172.19.0.0/16 90/30720 via 209.137.230.124, 4d12h, FastEthernet0/0 D 172.18.0.0/16 90/30720 via 209.137.230.22, 09:52:06, FastEthernet0/0 D 204.62.203.0/24 90/30720 via 209.137.230.3, 7w0d, FastEthernet0/0 S 0.0.0.0/0 1/0 via 209.137.230.1 How does a router learn about routes if they are not entered or directly connected? 246 Chapter 7 Download at a Whether the network is directly connected, or accessed indirectly via another routerRoute table routing protocols The letter tells you how they get in there, but what do the letters mean? Routes in a table come from The simplest several sources. When you assign an IP address to an way to get routes interface, this automatically places an entry in the routing table for that IP network. into a table is These are the routes that are directly connected and have a C in the front of just type them in. their table entry. Routes that are entered by hand are static and have a S in front of Those are called them. Finally routes that are learned have different letters based on how the route was static routes learned. because they don’t change unless you change them. D 204.62.204.0/24 90/30720 via 209.137.230.22, D 204.62.205.0/24 90/30720 via 209.137.230.124 C 209.137.230.0 is directly connected, FastEther C 204.62.201.0/24 is directly connected, FastEth C 172.17.0.0/16 is directly connected, FastEther D 172.16.0.0/16 90/30720 via 209.137.230.3, 7w D 172.19.0.0/16 90/30720 via 209.137.230.124, D 172.18.0.0/16 90/30720 via 209.137.230.22, 0 D 204.62.203.0/24 90/30720 via 209.137.230.3, 7w0d, FastEthernet0/0 S 0.0.0.0/0 1/0 via 209.137.230.1 you are here4 247 Download at a These letters tell you how the particular network route got into the table.take control of your routes So how do we enter routes? The first thing you need to do is get a connection to the router. You can either ssh into the router via the network or connect with a serial cable. You did this in Chapter 6. At the router’s console, issue the command enable 1 This puts the router into the privileged mode. You will probably need a password. At the router’s console, issue the command config t 2 This puts the router into configuration mode. Type ip route 192.168.102.0 255.255.255.0 eth0/1 192.168.101.1 3 This command enters a static route for the 192.168.102.0 network into the route table. This network is reached via the eth0/1 interface, and the router that can deal with that network is 192.168.101.1. Type exit 4 This exits the router from configuration mode. Type write memory 5 This saves our new configuration to memory. 248 Chapter 7 Download at aInterface FE 0/1 Interface FE 0/0 You can’t possibly enter all the networks of the world into your router’s table. You have to set a default gateway. This is the location, another router, where your router sends all the traffic it does not know where to send. routing protocols Routes help routers figure out where to send network traffic So you need to enter all the network addresses that you want your router to be able to send traffic to. Here are three routers. See if you can fill in the two missing IP addresses on the lines in the routing tables below to get the packets flowing between the computers via the routers. Router 1’s Routing Table C 192.168.100.0/24 is directly connected, FastEthernet0/0 C 192.168.101.0/24 is directly connected, FastEthernet0/1 S ________________ via 192.168.101.1 Router 2’s Routing Table C 192.168.101.0/24 is directly connected, FastEthernet0/0 C 192.168.102.0/24 is directly connected, FastEthernet0/1 Router 3’s Routing Table C 192.168.102.0/24 is directly connected, FastEthernet0/0 C 192.168.103.0/24 is directly connected, FastEthernet0/1 S 192.168.100.0/24 via ___________________ you are here 4 249 Download at a Interface FE 0/1 Interface FE 0/0 Interface FE 0/1 Interface FE 0/0Interface FE 0/1 Computers are not generally connected directly to a router. Usually there is a switch or hub in-between them. Interface FE 0/0 For the client connected to this router to send traffic to the other client, this router needs to know how to send traffic to the 192.168.100.0 network. what’s missing? Here are three routers. See if you can fill in the two missing IP addresses on the lines in the routing tables below to get the packets flowing between the routers. Router 1’s Routing Table C 192.168.100.0/24 is directly connected, FastEthernet0/0 C 192.168.101.0/24 is directly connected, FastEthernet0/1 192.168.102.0/24 S ________________ via 192.168.101.1 Router 2’s Routing Table C 192.168.101.0/24 is directly connected, FastEthernet0/0 C 192.168.102.0/24 is directly connected, FastEthernet0/1 Router 3’s Routing Table C 192.168.102.0/24 is directly connected, FastEthernet0/0 C 192.168.103.0/24 is directly connected, FastEthernet0/1 S 192.168.100.0/24 via ___________________ 192.168.102.1 250 Chapter 7 Download at a For the client connected to this router to send traffic to the other client, this router needs to know how to send traffic to the 192.168.102.0 network. Interface FE 0/1 Interface FE 0/0 Interface FE 0/1 Interface FE 0/0routing protocols Create routing tables from scratch for each router in the network below. Router 1’s Routing Table C ________________ is directly connected, FastEthernet0/0 C ________________ is directly connected, FastEthernet0/1 S ________________ via 192.168.1.2 S ________________ via 192.168.1.2 Router 2’s Routing Table C ________________ is directly connected, FastEthernet0/0 192.168.4.2 C ________________ is directly connected, FastEthernet0/1 192.168.1.1 S ________________ via 192.168.1.1 S ________________ via 192.168.1.2 192.168.1.2 192.168.2.1 192.168.4.1 192.168.3.2 Router 4’s Routing Table 192.168.2.2 C ________________ is directly connected, FastEthernet0/0 C ________________ is directly connected, FastEthernet0/1 192.168.3.1 S ________________ via 192.168.4.2 S ________________ via 192.168.3.1 Router 3’s Routing Table C ________________ is directly connected, FastEthernet0/0 C ________________ is directly connected, FastEthernet0/1 S ________________ via 192.168.3.2 S ________________ via 192.168.2.1 you are here 4 251 Download at atake control Create routing tables from scratch for each router in the network below. Router 1’s Routing Table 192.168.4.0/24 C ________________ is directly connected, FastEthernet0/0 192.168.1.0/24 C ________________ is directly connected, FastEthernet0/1 192.168.2.0/24 S ________________ via 192.168.1.2 192.168.3.0/24 S ________________ via 192.168.1.2 Router 2’s Routing Table C ________________ is directly connected, FastEthernet0/0 192.168.1.0/24 192.168.2.0/24 C ________________ is directly connected, FastEthernet0/1 192.168.4.2 192.168.4.0/24 192.168.1.1 S ________________ via 192.168.1.1 192.168.3.0/24 S ________________ via 192.168.1.2 192.168.1.2 192.168.2.1 192.168.4.1 192.168.3.2 Router 4’s Routing Table 192.168.2.2 192.168.4.0/24 C ________________ is directly connected, FastEthernet0/0 192.168.3.0/24 192.168.3.1 C ________________ is directly connected, FastEthernet0/1 192.168.1.0/24 S ________________ via 192.168.4.2 192.168.2.0/24 Router 3’s Routing Table S ________________ via 192.168.3.1 C ________________ is directly connected, FastEthernet0/0 192.168.2.0/24 192.168.3.0/24 C ________________ is directly connected, FastEthernet0/1 192.168.1.0/24 S ________________ via 192.168.3.2 192.168.4.0/24 S ________________ via 192.168.2.1 252 Chapter 7 Download at aThese routers share a common network address space routing protocols So are the moonbases now connected? Let’s try sending a message from a computer at Moonbase 1 to a computer on Moonbase 3 and see what happens. The computer on the Moonbase 1 network sends a 1 packet destined for a device on a different network. 192.168.1.0/24 The Moonbase 1 router looks up destination network 2 address in its table. It forwards the packet on to the router responsible for that network, or a router that knows about that network. 192.168.2.0/24 This other router looks in its route table and sees that the 3 packet needs to go to a further router. It’s not directly responsible for that network, so it sends it along. 192.168.3.0/24 This router responsible for the 4 network sends the packet to the correct node on its network. 192.168.4.0/24 you are here 4 253 Download at a Network address space Network address space These routers share a common network address space Network address space Network address spacewhat questions do you have? Q: Q: What do you mean by interface? In the “via” bit, do I need to specify something that the router’s directly linked to? A:Interfaces are the physical network connections that a router has installed. These can be Ethernet RJ-45 type connectors, serial A: When you enter a static route, you need to specify the connectors, or even fiber optic connectors. IP address of the router that will handle that network route. It is optional to enter the interface number as well. Q: What is the 0/0 and 0/1 in the interface name? Q: Does the routing table just contain IP addresses of routers? What about other devices? A: The first 0 represents the interface card in a router. Many routers support multiple interface cards, and each card can have multiple connections. So the second number represents that actual A: Yes, it contains only IP addresses of other routers. Remember, interface on a given interface card. So 0/1 refers to the number 1 the route table tells the router where to send network traffic to interface on the number 0 card installed in the router. If the router another network. So it is saying “to send network traffic to network has other cards, you could see interface numbers like 1/1. X, you have to send it via router V, which knows how to send traffic to network X. No other device addresses are entered into a route table. 254 Chapter 7 Download at aconnecting networks with routers routing protocols Back on the moon... Moonbase 1 calling Moonbase 16, can you hear me? Hello? Anybody there? Hellooooooo Moonbase 1 still has problems The Moonbase 1 routing table has been populated with all the static routes to the other moonbases, but unfortunately, network traffic isn’t getting through to one particular moon base. So what’s wrong? How do we troubleshoot routes if the data isn’t getting through? you are here 4 255 Download at aThis tells you how long it took to get a reply. ping and traceroute So how do we troubleshoot bad routes? If there’s a problem on an interface, the router can tell you whether The ping the interface is up or down. But there isn’t really much it can tell you about a static route. It doesn’t know if the route is up or down; all it command knows is that it can’t send traffic via it when it is down. Fortunately, tells you if there’s something that can help you—the ping command. the network We can start with the ping command and host are The ping command is a great command line utility that can help reachable. you troubleshoot bad routes. It basically tells you whether or not the network and host are reachable. To use the ping command, type ping at a command prompt, followed by the IP address you want to check. Here’s an example: File Edit Window Help AreYouThere? ping 204.62.201.1 PING 204.62.201.1 (204.62.201.1): 56 data bytes 64 bytes from 204.62.201.1: icmp_seq=0 ttl=248 time=96.559 ms 64 bytes from 204.62.201.1: icmp_seq=1 ttl=248 time=94.576 ms 64 bytes from 204.62.201.1: icmp_seq=2 ttl=248 time=72.130 ms 64 bytes from 204.62.201.1: icmp_seq=3 ttl=248 time=101.589 ms 64 bytes from 204.62.201.1: icmp_seq=4 ttl=248 time=79.381 ms So how does the ping command work? 1 The ping command sends ICMP packets to the specified IP address. 2 It waits for a reply, and then outputs how long the response took. 256 Chapter 7 Download at a ICMP Request 204.62.201.1 ICMP ReplyICMP Replies routing protocols The traceroute command is useful too The traceroute command traces the route that the packets take to get to the destination IP address. This route is represented by the IP addresses of the routers in-between the sending host and the destination IP address. Here’s an example: File Edit Window Help WhereDidItGo? traceroute 204.62.201.70 traceroute to 204.62.201.1 (204.62.201.1), 64 hops max, 40 byte packets 1 204.62.203.254 1.318 ms 0.750 ms 0.688 ms 2 209.137.230.2 1.460 ms 1.243 ms 1.153 ms 3 204.62.201.70 0.890 ms 10 0.832 ms 10 0.833 ms 10 1 Traceroute from client A sends a block of three packets with a value of 1 in their time-to-live (TTL) field to client D. 2 Router B responds with a ICMP packet back to the client A because the packets have a TTL of 1. 3 Traceroute from client A then sends a second block of three packets with a value of 2 in their time-to-live (TTL) field to client D. Router B changes the packets TTL to 1 and sends them on the Router C. 4 Router C responds with a ICMP packet back to the client A because the packets have a TTL of 1. 5 Traceroute from client A then sends a third block of three packets with a value of 3 in their time-to-live (TTL) field to client D. Router B changes the packets’ TTL to 2 and sends them on the Router C, which changes the packets’ TTL to 1 and sends them on to client D. Client D sends an IMCP packet back to client A. 5 3 1 D A B C 2 4 5 Let’s see if we can use these tools to help us troubleshoot the Moonbase 1 routes. you are here 4 257 Download at a ICMP Requests The traceroute command hows you the route your packets take to get to an IP address. swhat about... Q: Can I ping any IP address on the Internet? Q: Isn’t traceroute a fancy ping? A: Yes, you can. Whether you get a reply is another question. A: Well traceroute sends ICMP packets just like ping does, but it Many times firewalls block ping packets. So you will not see any reply is doing something totally different in that it sends out those series in that case. of packets to get the routers to respond in-between you and the destination. Q: When I ping some of the example addresses in the book, Q: sometimes I get a response, and sometimes I don’t. Sometimes my traceroutes seem to hang up then all of a sudden start going again. What is that all about? A: Remember private IP addresess back in Chapter 6? Well most of the addresses we use in the book are private IP addresses. On A: If you are having traceroute look up the DNS names of the your home network, some of these might be used by your local router, routers, sometimes those routers don’t have DNS entries, so your or your ISP might be using them as well. ping command has to wait for the DNS request to timeout. This can take a bit. Plus, if it is doing this on a number of routers, it can really take some time. Run the traceroute command with the -n flag to turn Q: It seems like you could write a program to constantly ping off DNS lookups. some devices on the network and alert you when the pings fail. Would this be a cool tool or what Q: Sometimes I see a little star when I run the traceroute command. Does the little star mean that the router is down? A: There are many tools like this. Nmap is one such tool. Nagio is another. Nmap is a network scanner. You enter in a range of IP addresses to scan, and it lets you know if there is a machine there or A: No, often it means that the routers is configured to not respond not. Nagios is more of a monitoring tool like you described above. It to ICMP packets. This is done as a security measure. can alert you when devices go off line. Q: So each router along the path to the destination has to Q: Can I control how many ping packets I send? respond for my command to work? A: Good question. Yes, you can. Many ping program have A: No, traceroute will just timeout the packets going to that device different options that control how many packets you send or even and move on to the next one until it gets to the destination. what information is inside the ping packets. Type ping help or ping /h to find out more. Q: How does it know when it gets to the destination? Q: Are those times on the return ping packets very A: Simple, it just keeps incrementing the TTL of the ICMP packets important? until it gets a response from the destination IP address. A: A good network engineer learns what the various ping times around her network are. We are not saying you should memorize them, but you should have a good feel for what the times should be roughly. That way, when things go out of whack, with some simple pinging, you can tell what is and isn’t behaving properly. 258 Chapter 7 Download at aTraceroute running on this client A star means a node did not respond. routing protocols Based on the traceroute output, circle the routers or hosts which are not responding. traceroute 10.0.3.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.460 ms 1.243 ms 1.153 ms 3 10.0.2.2 1.590 ms 1.243 ms 1.153 ms 10.0.0.2 4 traceroute 10.0.5.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.460 ms 1.243 ms 1.153 ms 10.0.0.1 3 10.0.4.2 1.580 ms 1.243 ms 1.153 ms 4 10.0.5.2 1.840 ms 1.243 ms 1.153 ms 10.0.1.1 traceroute 10.0.7.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.520 ms 1.243 ms 1.153 ms 3 10.0.4.2 1.630 ms 1.243 ms 1.153 ms 10.0.1.2 4 10.0.2.1 10.0.4.1 10.0.6.2 10.0.6.1 10.0.7.1 10.0.4.2 10.0.5.1 10.0.2.2 10.0.7.2 10.0.3.1 10.0.5.2 10.0.3.2 you are here 4 259 Download at aThis host did not respond. what routers are down? Based on the traceroute output, circle the routers or hosts which are not responding. traceroute 10.0.3.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.460 ms 1.243 ms 1.153 ms 3 10.0.2.2 1.590 ms 1.243 ms 1.153 ms 10.0.0.2 4 traceroute 10.0.5.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.460 ms 1.243 ms 1.153 ms 10.0.0.1 3 10.0.4.2 1.580 ms 1.243 ms 1.153 ms 4 10.0.5.2 1.840 ms 1.243 ms 1.153 ms 10.0.1.1 traceroute 10.0.7.2 traceroute to 10.0.3.2 (204.62.201.1), 64 hops max, 40 byte packets 1 10.0.0.1 1.318 ms 0.750 ms 0.688 ms 2 10.0.1.2 1.520 ms 1.243 ms 1.153 ms 3 10.0.4.2 1.630 ms 1.243 ms 1.153 ms 10.0.1.2 4 10.0.2.1 10.0.4.1 10.0.6.2 10.0.6.1 10.0.7.1 10.0.4.2 10.0.5.1 10.0.2.2 10.0.7.2 10.0.3.1 10.0.5.2 10.0.3.2 260 Chapter 7 Download at a This router did not respond.routing protocols So what’s the problem with the When there network connection? are changes to Unfortunately for Moonbase 1, it looks like Moonbase 16 and routes, you have Moonbase 17 changed the network address their routers were using. As the Moonbase 1 router only had the old network addresses in the to modify those routing table as a static route, this meant that the router no longer knew where to send network traffic destined for these two networks. routes in your So how do we fix this? router’s route table to keep it current. Well, that’s easy. All we have to do is change the route in the routing table for the changed network addresses. Static routes don’t change automatically. This means that if you have static routes in your routing table, you need to change them manually What sorts of problems do you anticipate with this? you are here 4 261 Download at aMoonbase 1 Network changes Moonbase 19 Just to let you know that we’re now routing 10.1.67.0/24 instead of 10.0.28.0/24. Moonbase 1 Network changes Moonbase 12 Just to let you know that we’re now routing 10.1.126.0/24 instead of 10.34.3.0/24. Moonbase 1 Network changes Moonbase 6 Just to let you know that we’re now routing 10.89.4.0/24 instead of 10.1.3.0/24. Moonbase 1 Network changes Moonbase 10 Just to let you know that we’re now routing 10.0.84.0/24 instead of 10.0.5.0/24. manual entry isn’t the answer The network address changes keep on coming... Unfortunately, they aren’t the only moonbases to change their network addresses. With all the growth on the moon, other moonbases are changing their network configurations too. Before too long, Moonbase 1 is swamped with notifications from other moonbases that their network addresses have changed too. These are all static routes. How on earth can I keep up with making all these changes? Isn’t there a better way? 262 Chapter 7 Download at a Moonbase 1 Network changes Moonbase 13 Just to let you know that we’re now routing 10.1.132.0/24 instead of 10.0.104.0/24. Moonbase 1 Network changes Moonbase 2 Just to let you know that we’re now routing 10.0.4.0/24 instead of 10.0.3.0/24. Moonbase 1 Network changes Moonbase 8 Just to let you know that we’re now routing 10.32.12.0/24 instead of 10.32.55.0/24.