Your configured routers only have information about directly connected networks in each routing table.. If you type in the wrong next-hop address, or the interface to that router is down
Trang 162 Chapter 2 Implementation & Operation
Lab_A(config)#line console 0
Lab_A(config-line)#password todd
Lab_A(config-line)#login
Lab_A(config-line)#line aux 0
Lab_A(config-line)#password todd
Lab_A(config-line)#login
Lab_A(config-line)#line vty 0 4
Lab_A(config-line)#password todd
Lab_A(config-line)#login
Lab_A(config-line)#exit
Lab_A(config)#banner motd #
This is the Lab_A router
#
Lab_A(config-line)#^z
Lab_A#copy running-config startup-config
Lab_A#
To view the IP routing tables created on a Cisco router, use the privileged mode command showiproute The command output follows momentarily Notice that only the configured,
directly connected networks are shown in the routing table This means the router only knows
how to get to networks 192.168.10.0 and 192.168.20.0
Lab_A#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP,
M mobile, B – BGP D EIGRP, EX EIGRP external, O
OSPF, IA - OSPF inter area N1 - OSPF NSSternal type
1, N2 - OSPF NSSA external type 2 E1 - OSPF external
type 1, E2 - OSPF external type 2, E – EGP i - IS-IS,
L1 - IS-IS level-1, L2 - IS-IS level-2, * - candidate
default, U peruser static route, o ODR, P
periodic downloaded static route, T - traffic
engineered route
Trang 2Gateway of last resort is not set
C 192.168.10.0/24 is directly connected, FastEthernet0/0
C 192.168.20.0/24 is directly connected, Serial 0/0
Lab_A#
Did you notice the C? When you see it, it means that the network is directly connected The codes for each type of connection are listed at the top of the show ip route command with their abbreviations
In the interest of brevity, the codes will be cut in the rest of this chapter.
Lab_B Configuration
It’s now time to configure the next router To configure Lab_B, you have three interfaces to deal with: FastEthernet 0/0, Serial 0/0 and Serial 0/1 Both serial interfaces are data communication equipment (DCE) What that means to you is that you’ll have to add the clock rate command
to each interface And make sure you don’t forget to add your passwords, interface descriptions, and banner to the router configuration!
Trang 3Lab_B#copy running-config startup-config
Destination filename [startup-config]? Enter
Lab_B#
These commands configured Serial 0/0 into network 192.168.20.0, Serial 0/1 into network 192.168.40.0, and FastEthernet 0/0 into network 192.168.30.0 The show ip route command displays the following:
Lab_B#sh ip route
[output cut]
Gateway of last resort is not set
C 192.168.20.0/24 is directly connected, Serial0/0
C 192.168.40.0/24 is directly connected, Serial0/1
C 192.168.30.0 is directly connected FastEthernet 0/0
Trang 4Lab_C#copy running-config startup-config
Destination filename [startup-config]? Enter
C 192.168.50.0/24 is directly connected, FastEthernet0/0
C 192.168.40.0/24 is directly connected, Serial0/0
lab_C#
Routers Lab_A and Lab_B can communicate because they’re on the same WAN network Lab_B and Lab_C can also communicate because they’re connected with a WAN link But Router Lab_A can’t communicate with the Lab_C router because it does not know about net-work 172.16.40.0 and 192.168.50.0—at least not yet
Trang 5Configuring IP Routing in Your Network
Okay—cool Your network is good to go—right? After all, it’s been correctly configured with
IP addressing! But wait… how does a router send packets to remote networks? They can only send packets by looking at the routing table to find out how to get to the remote networks Your configured routers only have information about directly connected networks in each routing table And what happens when a router receives a packet with a network that isn’t listed in the routing table? It doesn’t send a broadcast looking for the remote network—the router just dis-cards it Period
So you’re not exactly ready to rock yet after all But no worries—you still have several ways
to configure the routing tables to include all the networks in your little internetwork so that packets will be forwarded However, what’s best for one network isn’t necessarily what’s best for another Understanding the different types of routing will really help you come up with the best solution for your specific environment and business requirements
Once again, the different types of routing you’ll configure in this section are as follows:
Static routing
Default routing
Dynamic routing
I’m going to start off by describing and implementing static routing on your network because
if you can implement static routing, and make it work, it means you have a solid understanding
of the internetwork! So let’s get started…
Here’s the command you use to add a static route to a routing table:
ip route [destination_network] [mask] [next-hop_address
or exitinterface] [administrative_distance] [permanent]
This list describes each command in the string:
ip route The command used to create the static route
destination network The network you’re placing in the routing table
mask The subnet mask being used on the network
next-hop address The address of the next-hop router that will receive the packet and forward it to the remote network This is a router interface that’s on a directly connected network You must be able to ping the router interface before you add the route If you type
in the wrong next-hop address, or the interface to that router is down, the static route shows
up in the router’s configuration, but not in the routing table
exitinterface You can use this in place of the next-hop address if you want, but it’s got to
be on a point-to-point link, like a WAN This command won’t work on a LAN like Ethernet
administrative_distance By default, static routes have an administrative distance of 1 You can change the default value by adding an administrative weight at the end of the com-mand This is a subject I’ll talk a lot more about later in the chapter when I get to the section
on dynamic routing
Trang 6permanent If the interface is shut down or the router can’t communicate to the next-hop router, the route is automatically discarded from the routing table Choosing the permanent option keeps the entry in the routing table no matter what happens.
To help you understand how static routes work, I’ll demonstrate the configuration on the internetwork shown previously in Figure 2.1
Lab_A
Each routing table automatically includes directly connected networks To be able to route to all networks in the internetwork, the routing table must include information that describes where these other networks are located and how to get there
The Lab_A router is connected to networks 192.168.10.0 and 192.168.20.0 For the Lab_A router to be able to route to all networks, the following networks have to be configured in its routing table:
to send the packets Notice that each static route sends the packets to 192.168.20.2, which is the Lab_A router’s next hop
Lab_A#sh ip route
[output cut]S 192.168.50.0 [1/0] via 192.168.20.2
S 192.168.40.0 [1/0] via 192.168.20.2
S 192.168.30.0 [1/0] via 192.168.20.2
C 192.168.20.0 is directly connected, Serial 0/0
C 192.168.10.0 is directly connected, FastEthernet0/0
Lab_A#
Trang 7The S in the routing table entries means that the network is a static entry The [1/0] is the administrative distance and metric (which I’ll talk about soon) to the remote network Here it’s
0 indicating that it’s directly connected
The Lab_A router now has all the information it needs to communicate with the other remote networks However, if the Lab_B and Lab_C routers are not configured with all the same information, the packets will be discarded at Lab_B and at Lab_C You need to fix this
C 192.168.40.0 is directly connected, Serial0/1
C 192.168.30.0 is directly connected, FastEthernet 0/0
C 192.168.20.0 is directly connected, Serial0/0
The Lab_C router is directly connected to networks 192.168.40.0 and 192.168.50.0 You need
to add three routes: 192.168.30.0, 192.168.20.0, and 192.168.10.0
Trang 8The following output shows the routing table on the Lab_C router.
Lab_C#sh ip route
[output cut]
C 192.168.50.0 is directly connected, FastEthernet0/0
C 192.168.40.0 is directly connected, Serial0/0
if you’re dealing with a large internetwork
Verifying Your Configuration
Once you have configured all the routers’ routing tables, you need to verify them The best way to do this, besides using the show ip route command, is with the Ping program By pinging from routers Lab_A and Lab_C, you can test the whole internetwork end-to-end Really, the best test would be to use the Telnet program from one host to another, but for now, ping is king!
Here is the output of a ping to network 192.168.50.0 from the Lab_A router:
Lab_A#ping 192.168.50.1
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.50.1, timeout is
Trang 9From Router Lab_C, a ping to 192.168.10.0 will test for good IP connectivity Here is the router output:
Lab_C#ping 192.168.10.1
Type escape sequence to abort
Sending 5, 100-byte ICMP Echos to 172.16.10.1, timeout
is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max
= 64/67/72 ms
Since you can ping from end-to-end without a problem, your static route configuration was
a success! Let’s do it again, this time with 50 routers—not!
Default Routing
You use default routing to send packets with a remote destination network not in the routing
table to the next-hop router You can only use default routing on stub networks—those with
only one exit port out of the network
In the internetworking example used in the previous section, the only routers that are sidered to be in a stub network are Lab_A and Lab_C If you tried to put a default route on router Lab_B, packets wouldn’t be forwarded to the correct networks because they have more than one interface routing to other routers Even though router Lab_C has two connections, it doesn’t have a router on the 192.168.50.0 network that needs packets sent to it Lab_C will only send packets to 192.168.40.1, which is the Serial 0/0 interface of Lab_B Router Lab_A will only send packets to the 192.168.20.2 interface of Lab_A
con-To configure a default route, you use wildcards in the network address and mask locations
of a static route In fact, you can just think of a default route as a static route that uses wildcards instead of network and mask information In this section, you’ll create a default route on the Lab_C router
Router Lab_C is directly connected to networks 192.168.40.0 and 192.168.50.0 The routing table needs to know about networks 192.168.10.0, 192.168.20.0, and 192.168.30.0
To configure the router to route to the other three networks, I placed three static routes in the routing table By using a default route, you can create just one static route entry instead First, you must delete the existing static routes from the router, and then you should add the default route
Lab_C(config)#no ip route 192.168.10.0 255.255.255.0
192.168.40.1
Lab_C(config)#no ip route 192.168.20.0 255.255.255.0
192.168.40.1
Trang 10C 192.168.50.0 is directly connected, FastEthernet0/0
C 192.168.40.0 is directly connected, Serial0/0
S* 0.0.0.0/0 [1/0] via 192.168.40.1
Lab_C#
Notice also in the routing table that the gateway of last resort is now set Even so, there’s one more command you must be aware of when using default routes: the ip classless command
All Cisco routers are classful routers, meaning they expect a default subnet mask on each interface of the router When a router receives a packet for a destination subnet that’s not in the routing table, it drops the packet by default If you’re using default routing, you’ve got to use the ip classless command because no remote subnets will be in the routing table
Since I have version 12.x of the Internetwork Operating System (IOS) on my routers, the ip
classless command is on by default If you’re using default routing and this command isn’t
in your configuration, you’d need to add it if you had subnetted networks on your routers (which you don’t at this time) The command is shown here:
Lab_C(config)#ip classless
Notice that it’s a global configuration mode command The interesting part of the ip classless command is that default routing sometimes works without it, but sometimes it doesn’t So just to be on the safe side, you should always turn on the ip classless command when you use default routing
Configuring RIP Routing
Configuring RIP is actually simpler than configuring static or default routing To configure RIP routing, just turn on the protocol with the router rip command and tell the RIP routing pro-tocol which networks to advertise That’s it Let’s configure your three-router internetwork (shown again in Figure 2.2) with RIP routing and practice that
Trang 11F I G U R E 2 2 IP RIP routing example
Lab_A
RIP has an administrative distance of 120 Static routes have an administrative distance of 1 by default and, since you currently have static routes configured, the routing tables won’t be propagated with RIP information So, the first thing you need to do is delete the static routes off of each router.You can do this with the no ip route command Notice that in the following Lab_A router output, you must type the whole ip route command to delete the entry
Look at the next router configuration Note the fact that you’ve got to type in every directly connected network that you want RIP to advertise But you’re going to leave out networks 30,
40, and 50 because it’s RIP’s job to find them and populate the routing table
1900
Lab_A
F0/27
F0/26 F0/0
DCE
S0/1 DCE
2950
Lab_B
F0/3 F0/2
F0/1 F0/0
F0/4 F0/5
S0/0 2950
Lab_C
F0/3 F0/2
F0/1 F0/0 F0/4 F0/5
Trang 12RIP and IGRP use the classful address when they configure the network address Because of this, all subnet masks must be the same on all devices in the network classful routing) To clarify this, say you’re using a class B network address of 172.16.0.0/24 with subnets 172.16.10.0, 172.16.20.0, and 172.16.30.0 In this case, you’d only type in the classful network address of 172.16.0.0 and let RIP find the subnets and place them in the routing table
Understand that RIP is configured with classful routing network addresses!
Lab_B
To configure RIP on the Lab_B router, you need to remove the two static routes you added from the earlier example Once you make sure no routes are in the routing table with a better admin-istrative distance than 120, you can add RIP The Lab_B router has three directly connected net-works and you want RIP to advertise them all, so you will add three network statements.Again, if you don’t remove the static routes, the RIP routes will never be found in the routing table even though RIP will still be running in the background causing a bunch of CPU processing
on the routers and gobbling up precious bandwidth! So, let’s get rid of them, then add in RIP
Lab_C#config t
Enter configuration commands, one per line End with CNTL/Z
Lab_C(config)#no ip route 0.0.0.0 0.0.0.0 192.168.40.1
Lab_C(config)#router rip
Trang 13adminis-if you hear a rumor (advertised route), it just has to be true without exception That pretty much sums up how RIP behaves on an internetwork—rumor mill as protocol!
Verifying the RIP Routing Tables
Each routing table should now have the routers’ directly connected routes as well as RIP-injected routes received from neighboring routers
This output shows the contents of the Lab_A routing table:
C 192.168.20.0 is directly connected, Serial0/0
C 192.168.10.0 is directly connected, FastEthernet0/0
Lab_A#
Looking at this, you can see that the routing table has the same entries that it had when you were using static routes—except for that R, that is This means that networks were added dynamically using RIP The [120/1] is the administrative distance of the route (120) along with the number of hops to that remote network (1)
This output displays Lab_B’s routing table:
Lab_B#sh ip route
[output cut]
R 192.168.50.0 [120/2] via 172.16.40.2, 00:00:11, Serial0/1
C 192.168.40.0 is directly connected, Serial0/1
C 192.168.30.0 is directly connected, FastEthernet0/0
C 192.168.20.0 is directly connected, Serial0/0
R 192.168.10.0 [120/1] via 172.16.20.1, 00:00:21, Serial0/0
Lab_B#
Again notice that the same networks are in the routing table here and they weren’t added manually
Trang 14Let’s check out Lab_C’s routing table:
Lab_C#sh ip route
[output cut]
Gateway of last resort is not set
C 192.168.50.0 is directly connected, FastEthernet0/0
C 192.168.40.0 is directly connected, Serial0/0
solu-RIP Problem!
I have one more thing I want to show you about RIP routing tables and the parameters used
to advertise remote networks Notice, as an example, that the following routing table shows [120/15] in the 192.168.10.0 network metric This means that the administrative distance
is 120, the default for RIP, but the hop count is 15 Remember that each time a router receives
an update from another router, it increments the hop count by one for each route
Lab_C#sh ip route
[output cut]
Gateway of last resort is not set
C 192.168.50.0 is directly connected, FastEthernet0/0
C 192.168.40.0 is directly connected, Serial0/0
be 16, which is invalid I know that you don’t have another router connected to the right of Lab_
C in this example, but hopefully you get my point here
Holding Down RIP Propagations
You probably don’t want your RIP network advertised everywhere on your LAN and WAN—you can’t gain a whole lot by advertising your RIP network to the Internet, now can you?
Trang 15No worries—you can stop unwanted RIP updates from propagating across your LANs and WANs a few different ways The easiest one is by using the passive-interface command This command prevents RIP update broadcasts from being sent out a defined interface, but that same interface can still receive RIP updates.
Here’s an example of how to configure a passive-interface on a router:
Configuring IGRP Routing
The command you use to configure IGRP is the same as the one you use to configure RIP routing, with one important difference: you use an autonomous system (AS) number All routers within an
AS must use the same AS number or they won’t communicate with routing information Here’s how to turn on IGRP routing:
You absolutely must remember that you type a classful network number in
when you configure IGRP!
IGRP can load-balance up to six unequal links RIP networks must have the same hop count to load-balance, whereas IGRP uses bandwidth to determine how to load-balance To load-balance over unequal-cost links, you must use the variance command, which controls the load balancing between the best metric and the worst acceptable metric
Load balancing and traffic sharing are covered more in depth in the CCNP:
Building Scaleable Cisco Internetworks Study Guide, by Carl Timm and Wade
Edwards (Sybex, 2004).
Trang 16Configuring IGRP is pretty straightforward and not much different from configuring RIP However, you do need to decide on an AS number before you configure your routers Remember that all routers in your internetwork must use the same AS number if you want them to share routing information.
In the sample internetwork I’ve been using throughout this chapter, you’ll use AS 10 to figure the routers
con-Okay, let’s configure your internetwork with IGRP routing
Lab_A
The AS number, as shown in the following router output, can be any number from 1 to 65535
A router can be a member of as many ASes as you need it to be
The router igrp command turns IGRP routing on in the router As with RIP, you still need
to add the network numbers you want to advertise IGRP uses classful routing, which means that subnet mask information isn’t sent along with the routing protocol updates
If you’re using the 172.16.0.0/24 network, know that if you did type in the subnet 172.16.10.0, the router would accept it and then change the configuration to a classful entry of 172.16.0.0 But don’t do that—at least not on the exam! The exam system is definitely not so forgiving and it will simply mark your answer wrong if you type the wrong network number I cannot stress this enough: think classful if you are using subnets!
Trang 17Verifying the IGRP Routing Tables
Once the routers are configured, you need to verify the configuration with the show ip route command
In all of the router outputs coming up, notice that the only routes to networks are either directly connected or IGRP-injected routes Since you didn’t turn off RIP, it’s still running in the background, munching router CPU cycles and bandwidth What’s more, the routing tables will never use a RIP-found route because IGRP has a better administrative distance than RIP does.Check out this output from the Lab_A router Notice that all routes are in the routing table:
C 192.168.20.0 is directly connected Serial0/0
C 192.168.10.0 is directly connected, FastEthernet0/0
The I means IGRP-injected routes The 100 in [100/160360] is the administrative distance of IGRP The 160360 is the composite metric The lower the composite metric, the better the route
Remember that the composite metric is calculated by using the bandwidth and delay of the line by default The delay of the line can also be referred to as the cumulative interface delay.
Trang 18This is Lab_B’s routing table:
Lab_B#sh ip route
[output cut]
I 192.168.50.0 [100/8576] via 192.168.40.2, 00:01:11, Serial0/1
C 192.168.40.0 is directly connected, Serial0/1
C 192.168.30.0 is directly connected, FastEthernet0/0
C 192.168.20.0 is directly connected, Serial0/0
C 192.168.50.0 is directly connected, FastEthernet 0/0
C 192.168.40.0 is directly connected, Serial0/0
Net-You can enter EIGRP commands from two modes: router configuration mode and interface
configuration mode Router configuration mode enables the protocol, determines which works will run EIGRP, and sets global characteristics Interface configuration mode allows cus-
net-tomization of summaries, metrics, timers, and bandwidth This book, like the CCNA objectives, focus on the global characteristics only
To start an EIGRP session on a router, use the router eigrp command followed by the AS number of your network Then enter the network numbers connected to the router using the network command followed by the network number
Let’s look at an example of enabling EIGRP for AS 20 on a router connected to two networks, with the network numbers being 10.3.1.0/24 and 172.16.10.0/24:
Router#config t
Router(config)#router eigrp 20
Router(config-router)#network 172.16.0.0
Router(config-router)#network 10.0.0.0
Trang 19Remember, as with IGRP, you use the classful network address, which has subnet and host bits turned off
Say you need to stop EIGRP from working on a specific interface, like a BRI interface, or a serial connection to the Internet To do that, you need to flag the interface as passive The fol-lowing command shows you how to make interface Serial 0/1 a passive interface:
pro-OK, let’s configure that same network that you configured in the last section with RIP and IGRP It doesn’t matter that RIP and IGRP are already running—unless you’re worried about bandwidth consumption and CPU cycles, of course, because EIGRP has an administrative dis-tance of 90 (Remember that IGRP is 100 and RIP is 120, so only EIGRP routes will populate the routing tables, even if all three routing protocols are enabled.)
Figure 2.3 shows the network that you’ve been working with—the same one you’re going to use to configure with EIGRP:
F I G U R E 2 3 Our Internetwork example
It’s actually really easy to add EIGRP to your internetwork I’ll be using the same commands
as I did with IGRP, only I’ll add the “e”
1900
Lab_A
F0/27
F0/26 F0/0
DCE
S0/1 DCE
2950
Lab_B
F0/3 F0/2
F0/1 F0/0
F0/4 F0/5
S0/0 2950
Lab_C
F0/3 F0/2
F0/1 F0/0 F0/4 F0/5