Going back to our previous example of a router learning network 10.0.0.0/8 from
RIP and IGRP, since RIP has a value of 120 and IGRP, 100, the router will use the
IGRP route, since this protocol has as a better (lower) administrative distance value.
Static Routes
A static route is a manually configured route on your router. Static routes are typically
used in smaller networks. With a network that has hundreds of routes, static routes are
not scalable, since you would have to configure each route, and any redundant paths
for that route, on each router. This section covers the configuration of static routes
and some of the issues associated with them.
Static Route Configuration
To configure a static route for IP, use one of these two commands:
Router(config)# ip route
destination_network_#
[
subnet_mask
]
IP_address_of_next_hop_neighbor
[
administrative_distance
] [permanent]
-or-
Router(config)# ip route
destination_network_#
[
subnet_mask
]
interface_to_exit
[
administrative_distance
] [permanent]
The first parameter that you must specify is the destination network number. If you
omit the subnet mask for the network number, it defaults to the Class A (255.0.0.0),
Static Routes
5
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
Administrative Distance Route Type
0 Connected interface
0 or 1 Static route
90 Internal EIGRP route (within the same AS)
100 IGRP route
110 OSPF route
120 RIP route
170 External EIGRP (from another AS)
255 Unknown route (is considered an invalid route
and will not be used)
TABLE 9-2
Administrative
Distance Values
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:35 PM
Color profile: Generic CMYK printer profile
Composite Default screen
B (255.255.0.0), or C (255.255.255.0) default subnet mask, depending on the network
number of the destination.
After the subnet mask parameter, you have two ways to specify how to reach
the destination network: you can tell the router either the next hop neighbor’s IP
address or the interface the router should exit to reach the destination network. You
should use the former method if the link is a multiaccess link (the link has more
than two devices on it, three routers, for instance). You can use the latter method
if it is a point-to-point link. In this instance, you must specify the name of the
interface on the router, like serial0.
Optionally, you can change the administrative distance of a static route. If you
omit this value, it will have one of two defaults, depending on the configuration of
the previous parameter. If you specified the next hop neighbor’s IP address, then the
administrative distance defaults to 1. If you specified the interface on the router
it should use to reach the destination, the router treats the route as a connected
route and assigns an administrative distance of 0 to it. Please note that you can
create multiple static routes to the same destination. For instance, you might have
primary and backup paths to the destination. For the primary path, use the default
administrative distance value. For the backup path, use a number higher than this,
such as 2. Once you have configured a backup path, the router will use the primary
path, and if the interface on the router fails for the primary path, the router will
use the backup route.
The permanent parameter will keep the
static route in the routing table even when the
interface the router uses for the static route fails.
If you omit this parameter, and the interface fails
that the static route uses, the router will remove
this route from its routing table and attempt to
find an alternative path to place in the routing table. You might want to use this
parameter if you never want packets to use another path to a destination, perhaps
because of security reasons.
Default Route Configuration
A default route is a special type of static route. Where a static route specifies a path a router
should use to reach a specific destination, a default route specifies a path the router should
use if it doesn’t know how to reach the destination.
Note that if a router does not have any path in its routing table telling it how to reach
a destination, and the router receives a packet destined for this network, the router will
6
Chapter 9: Routing Introduction
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
Know the syntax for
creating a static IP route.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:35 PM
Color profile: Generic CMYK printer profile
Composite Default screen
drop the packet. This is different from a switch, which will flood unknown destinations.
Therefore, a default route can serve as a catch-all: if there is no specific path to the
destination, the router will use the default route to reach it.
To set up a default route, use the following syntax for a static route:
Router(config)# ip route 0.0.0.0 0.0.0.0
IP_address_of_next_hop_neighbor
[
administrative_distance
] [permanent]
-or-
Router(config)# ip route 0.0.0.0 0.0.0.0
interface_to_exit
[
administrative_distance
] [permanent]
The network number of 0.0.0.0/0 at first
appears a bit strange. Recall from Chapter 3,
however, that network 0.0.0.0 represents all
networks, and a mask of all 0’s in the bit
position represents all hosts in the specified
network.
Default Routes and Distance Vector Protocols
A default route sometimes causes problems for certain routing protocols. There are
two additional categories that a routing protocol can fall under: classful and classless.
Examples of classful protocols include RIPv1 and IGRP. Examples of classless protocols
include RIPv2, OSPF, EIGRP, IS-IS, and BGP.
A classful routing protocol understands only class subnets. For instance, if
you have 192.168.1.0/23 in a routing update, a classful routing protocol wouldn’t
understand it, since a Class C network requires 24 bits of network numbers. This
creates a problem with a default route, which has a /0 mask.
Also, when a classful router advertises a route out its interface, it does not include the
subnet mask. For example, you might have 192.168.1.1/26 configured on your router’s
interface, and the router receives a routing updated with 192.168.1.0. With a classful
routing protocol, the router will comprehend subnet masks only for network numbers
configured on its interfaces. In this example, the router assumes that for 192.168.1.0,
the only valid mask is /26. Therefore, if the routers sees the 192.168.1.0/26 as the
network number, but the network is really 192.168.1.027, this can create a lot of
routing confusion.
Classless protocols, on the other hand, do not have any issues accepting routing
updates with any bit value for a subnet mask. However, for classful protocols, you
Static Routes
7
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
A default route has a
network number of 0.0.0.0 and a subnet
mask of 0.0.0.0.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:35 PM
Color profile: Generic CMYK printer profile
Composite Default screen
must configure the following command to accept nonconforming subnet masks, such
as a default route:
Router(config)# ip classless
This command is also used to deal with discontiguous subnets in a network that is
using a classful protocol: subnets separated by a different class network. For example,
let’s assume that you have networks 172.16.1.0/24, 172.16.2.0/24, and 172.16.3.0/24.
However, a different class network, 192.168.1.0/24, sits between the first two Class B
subnets and 172.16.3.0/24. In this situation, the router connected to 172.16.1.0/24 and
172.16.2.0/24, when it receives 172.16.0.0 from the side of the network connected to
the discontiguous subnet, will ignore this routing entry.
Remember that when routes cross a class boundary in a classful protocol, the network
number is sent as its classful number. Therefore, the router connected to 192.168.1.0/24
and 172.16.3.0/24, when it advertises updates across the 192.168.1.0/24 subnet, will
advertise 172.16.0.0—not the actual subnet number. Since the router connected to
172.16.1.0/24 and 172.16.2.0/24 ignores the 172.16.0.0 routing information, it will
not be able to reach 172.16.3.0. On top of this problem, even if you have a default
route configured, since the router is connected to the 172.16.0.0 subnets, it assumes
that 172.16.3.0 must also be connected; and if it isn’t in the routing table, then the
route cannot be reached.
By using the ip classless command, you are overriding this behavior; you’re
allowing your classful router to use a default route to reach discontiguous subnets.
Not that this is a recommended design practice, but it does allow you to solve
reachability problems for discontiguous subnets.
Verifying Static Route Configuration
To verify the configuration of static and default routes on your router, use the show
ip route command:
Router# show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP,
8
Chapter 9: Routing Introduction
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
Classful protocols, such as
IP RIPv1 and IGRP, understand only class
subnets—you can apply only one subnet
mask to a class address. Classless protocols,
such as RIPv2, EIGRP, OSPF, and IS-IS, do
not have this restriction.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
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,
E - EGP, i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
* - candidate default, U - per-user static route, o - ODR,
T - traffic engineered route
Gateway of last resort is not set
172.16.0.0/24 is subnetted, 3 subnets
C 172.16.1.0 is directly connected, Ethernet0
C 172.16.2.0 is directly connected, Serial0
S 172.16.3.0 is directly connected, Serial0
The top portion of the display for this
command has a table of codes. These codes,
which describe a type of route that may appear
in the routing table, are shown in the first
column at the bottom part of the display. In this
example, there are two connected routes, and
one static route— the static route is treated as
a directly connected route, since it was created by specifying the interface to exit
the router. This command is discussed in depth in Chapters 10 and 11.
9.01. The CD contains a multimedia demonstration of setting up static
routes on a router.
EXERCISE 9-1
ON THE CD
Static Route Configuration
These last few sections dealt with static routes and their configuration. This exercise
will help you reinforce this material for the configuration of static routes. You’ll
perform this lab using Boson’s NetSim™ simulator. This exercise has you set static
routes on the two routers (2600 and 2500). You can find a picture of the network
diagram for Boson’s NetSim™ simulator in the Introduction of this book. After
starting up the simulator, click on the LabNavigator button. Next, double-click on
Exercise 9-1 and click on the Load Lab button. This will load the lab configuration
based on Chapter 5’s and 7’s exercises.
1. On the 2600, verify that the fa0/0 and s0 interfaces are up. If not, bring
them up. Examine the IP addresses configured on the 2600 and look at its
routing table.
Static Routes
9
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
Be familiar with the
output of the
show ip route
command.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
At the top of the simulator in the menu bar, click on the eRouters icon and
choose 2600. On the 2600, Use the show interfaces command to verify
your configuration. If fa0/0 and s0 are not up, go into the interfaces (fa0/0
and s0) and enable them: no shutdown. Use the show interfaces
command to verify that the IP addresses you configured in Chapter 5 are still
there. Use the show ip route command. You should have two connected
networks: 192.168.1.0 connected to fa0/0 and 192.168.2.0 connected to s0.
2. On the 2500, verify that the e0 and s0 interfaces are up. If not, bring them
up. Examine the IP addresses configured on the 2500 and look at its routing
table.
At the top of the simulator in the menu bar, click on the eRouters icon and
choose 2500. On the 2500, Use the show interfaces command to verify
your configuration. If e0 and s0 are not up, go into the interfaces (e0 and s0)
and enable them: no shutdown. Use the show interfaces command to
verify your configuration. Also use the show interfaces command to verify
that the IP addresses you configured on Chapter 5 are still there. Use the show
ip route command. You should have two connected networks: 192.168.3.0
connected to e0 and 192.168.2.0 connected to s0.
3. Test connectivity between Host1 and the 2600. Test connectivity between
Host3 and the 2500. Test connectivity between Host3 and Host1.
At the top of the simulator in the menu bar, click on the eStations icon and
choose Host1. From Host1, ping the 2600: ping 192.168.1.1. The ping
should be successful. If it is not, then you may have used the configuration from
the VLAN lab in Chapter 8 and have a VLAN configuration problem. At the
top of the simulator in the menu bar, click on the eStations icon and choose
Host3. From Host3, ping the 2500 router: ping 192.168.3.1. The ping
should be successful. Also from Host3, ping Host1: ping 192.168.1.10.
The ping should fail: there is no route from the 2500 to this destination. Look
at the 2500’s routing table: it doesn’t list 192.168.1.0/24: show ip route.
4. On the 2500, configure a static route to 192.168.1.0/24, which is connected
to the 2600. View the routing table.
At the top of the simulator in the menu bar, click on the eRouters icon
and choose 2500. Configure the static route: ip route 192.168.1.0
255.255.255.0 192.168.2.1. View the static route: show ip
route. Make sure that 192.168.1.0/24 shows up in the routing table
as a static route (S).
5. On the 2600, configure a static route to 192.168.3.0/24, which is connected
to the 2500. View the routing table.
10
Chapter 9: Routing Introduction
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
At the top of the simulator in the menu bar, click on the eRouters icon
and choose 2600. Configure the static route: ip route 192.168.3.0
255.255.255.0 192.168.2.2. View the static route: show ip
route. Make sure that 192.168.3.0/24 shows up in the routing table
as a static route (S).
6. From Host3, ping the fa0/0 interface of the 2600. From Host3, ping Host1.
At the top of the simulator in the menu bar, click on the eStations icon
and choose Host3. Access Host3 and ping the fa0/0 interface of the 2600
router: ping 192.168.1.1. The ping should be successful. Ping Host1
ping 192.168.1.10. The ping should be successful.
Now you should be more comfortable with configuring static routes. In the
next section, you will grow acquainted with routing between VLANs by using
a router-on-a-stick.
Router-on-a-Stick
Typically, we think of routing as traffic coming in one interface and leaving another
interface. As you learned in Chapter 8, however, trunks can be used to support multiple
broadcast domains, where each broadcast domain
has a unique layer-3 network or subnet number.
Certain router models, like the 2600 series, support
trunk connections. A router-on-a-stick is a router
that has a single trunk connection to a switch
and that routes between the VLANs on this trunk
connection. You could easily do this without a
trunk (access-link connections), but each VLAN
would require a separate access-link (physical) connection on the router, and this would
increase the price of the router solution.
For instance, if you had five VLANs, and your router didn’t support trunking, you
would need five physical LAN interfaces on your router in order to route between
the five VLANs. However, with a trunk connection, you can route between all five
VLANs on a single interface. Because of cost and scalability, most administrators
prefer using a router-on-a-stick approach to solve their routing problems in switched
networks.
Router-on-a-Stick
11
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
A router-on-a-stick is a
router that has a single trunk connection
to a switch and that routes between
different VLANs on this trunk.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
Subinterface Configuration
In order to set up a router-on-a-stick, you need to break up your router’s physical interface
into multiple logical interfaces, called subinterfaces. Cisco supports up to 300 interfaces on a
router, which includes both physical and logical interfaces. Once you create a subinterface,
a router will treat this logical interface just like a physical interface: you can assign layer-3
addressing to it, enable, it, disable it, and many other things.
To create a subinterface, use the following command:
Router(config)# interface
type port_#
.
subinterface_#
[point|multipoint]
Router(config-subif)#
After entering the physical interface type and port identifier, follow this with a “.”
and a subinterface number. This number can range 0–4,294,967,295. The number
that you use for the subinterface number is only for reference purposes within the
IOS, and the only requirement is that when creating a subinterface, you use a unique
number. Many administrators prefer to use the VLAN number that the subinterface
will handle for the subinterface number; however, this is not a requirement.
At the end of the statement, you must
specify the type of connection if the interface
is of type serial; otherwise, you can omit it.
The point parameter is used for point-to-point
serial connections, and multipoint is used
for multipoint connections. The multipoint
parameter is used for connections that have
more than one device connected to them (physically or logically). Prior to IOS 12.0,
if you omitted the connection type, it defaulted to multipoint. In 12.0 and
higher, however, you must specify the type—there is no default. (This point is
covered in more depth in Chapter 16.) For a router-on-a-stick configuration, omit
the connection type, since it isn’t used.
Interface Encapsulation
Once you create a subinterface, you’ll notice that your CLI prompt has changed and
that you are now in Subinterface Configuration mode. If you are routing between VLANs,
you’ll need an interface that supports trunking. There are some things configured on
the major interface and some things configured on the subinterface. Configurations like
duplexing and speed are done on the major (or physical) interface. Most other tasks are
done on the subinterface, including which VLAN the subinterface belongs to and its IP
addressing information.
12
Chapter 9: Routing Introduction
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
Be familiar with how to
create a subinterface with the
interface
command.
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
When setting up your subinterface for a router-on-a-stick, one thing that you must
configure is the type of trunking—ISL or 802.1Q—and the VLAN the subinterface is
associated with, like this:
Router(config)# interface
type port_#
.
subinterface_#
Router(config-subif)# encapsulation isl|dot1q
VLAN_#
Use the encapsulation command to specify the trunk type and the VLAN
associated with the subinterface. The VLAN number you specify here must correspond
to the correct VLAN number in your switched network. You must also set up a trunk
connection on the switch for the port that the router is connected to. Once you
do this, the switch will send tagged frames to the router, and the router, using your
encapsulation, will understand how to read the tags. The router will be able to see
which VLAN the frame came from and match it up with the appropriate subinterface
that will process it.
Example Configuration
Let’s look at an example to see how a router-on-a-stick is configured. I’ll use Figure 9-1
for this configuration. I’ll assume that this is a 3600 router, that the Fast Ethernet
interface is the first interface in the first slot, and that the switch is using ISL trunking.
Here’s the code example for this router:
Router(config)# interface fastethernet 0/0
Router(config-if)# duplex full
Router(config-if)# no shutdown
Router(config-if)# exit
Router(config)# interface fastethernet 0/0.10
Router(config-subif)# encapsulation isl 1
Router(config-subif)# ip address 172.16.1.1 255.255.255.0
Router(config-subif)# exit
Router(config)# interface fastethernet 0/0.20
Router(config-subif)# encapsulation isl 2
Router(config-subif)# ip address 172.16.2.1 255.255.255.0
Router(config-subif)# exit
Notice in this example that the subinterface numbers (10 and 20) do not match
the VLAN numbers in the encapsulation (1 and 2)—remember that the subinterface
numbers are used by the IOS only to reference the particular subinterface and do not
have to match any configuration on the subinterface.
Router-on-a-Stick
13
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:36 PM
Color profile: Generic CMYK printer profile
Composite Default screen
If you are configuring static routes and want to route traffic out of a
particular subinterface, specify the major interface along with the
subinterface number, like
fastethernet0/0.20
.
9.02. The CD contains a multimedia demonstration of setting up a router-on-
a-stick.
Dynamic Routing Protocols
Unlike static routes that require manual configuration to tell the router where destination
networks are, dynamic routing protocols learn about destination networks from neighboring
routers. Dynamic routing protocols fall under one of three categories: distance vector, link
state, and hybrid. Each of these routing protocol types takes a different approach in sharing
routing information with neighboring routers and choosing the best path to a destination.
Because of the differences between the various routing protocol types, each has
advantages and disadvantages. One choice you’ll have to make will be which routing
protocol you’ll run on the routers in your network. There are various factors that
you’ll have to examine when choosing a routing protocol:
■
Routing metrics used to choose paths
■
How routing information is shared
■
Convergence speed of the routing protocol
■
How routers process routing information
■
Overhead of the routing protocol
Routing Metrics
As mentioned in the section “Administrative Distance,” if your router has two types
of routes, such as RIP and IGRP, for the same network number, the router uses the
14
Chapter 9: Routing Introduction
CertPrs8 / CCNA Cisco Certified Network Associate Study Guide / Deal / 222934-9 / Chapter 9
FIGURE 9-1
Router-on-a-stick
example
D:\omh\CertPrs8\934-9\ch09.vp
Monday, August 04, 2003 12:12:37 PM
Color profile: Generic CMYK printer profile
Composite Default screen
Không có nhận xét nào:
Đăng nhận xét