Vous êtes sur la page 1sur 16

5-7 Open Shortest Path First (OSPF)

Home/Study Guides/CCNA Routing & Switching 200-120/Chapter 5 Routing Protocols/5-7 Open


Shortest Path First (OSPF)

Open Shortest Path First (OSPF) is the first link-state protocol that you will learn about. Apart from
being a link-state protocol, it is also an open standard protocol. What this means is that you can run
OSPF in a network consisting of multivendor devices. You may have realized that you cannot run
EIGRP in a network that consists of non-Cisco devices. This makes OSPF a very important protocol
to learn.
Compared to EIGRP, OSPF is a more complex protocol and supports all features such as
VLSM/CIDR and more. A brief summary of OSPF features is given below:
1. Works on the concept of Areas and Autonomous systems
2. Highly Scalable
3. Supports VLSM/CIDR and dis-contiguous networks
4. Does not have a hop count limit
5. Works in multivendor environment
6. Minimizes updates between neighbors.
While the above list is a very basic overview of the features of OSPF and will be expanded on in
coming sections, it is a good time to take a step back and compare the four protocols detailed in this
chapter. Table 5-2 shows a comparison of the four protocols.
Table 5-2 Comparison of routing protocols.
Features OSPF EIGRP RIPv1 RIPv2
Protocol Type Link state Hybrid Distance Distance
Vector Vector
Classful Protocol No No Yes No
VLSM Support Yes Yes No Yes
Discontiguous Yes Yes No Yes
Network Support
Hop count limit None 255 15 15
Routing Updates Event Triggered Event Triggered Periodic Periodic
Complete Routing During new During new Periodic Periodic
table shared adjacencies adjacencies
Mechanism for Multicast Multicast and Multicast Broadcast
sharing updates unicast
Best Path Dijkstra DUAL Bellman-Form Bellman-Ford
computation
Metric used Bandwidth Bandwidth and Hop Count Hop Count
Delay (default)
Organization type Hierarchical Flat Flat Flat
Convergence Fast Very Fast Slow Slow
Auto Summarization No Yes Yes Yes
Manual Yes Yes No No
Summarization
Peer authentication Yes Yes Yes No
It should be noted here that OSPF has many more features that the ones listed in Table 5-2 and than
those covered in this book. One feature that really separates OSPF from other protocols is its
support of a hierarchical design. What this means is that you can divide a large internetwork into
smaller internetworks called areas. It should be noted that these areas, though separate, still lie
within a single OSPF autonomous system. This is distinctly different from the way EIGRP can be
divided into multiple autonomous systems. While in EIGRP each autonomous system functions
independent of others and a redistribution is required to share routes, in OSPF areas are dependent
on each other and routes are shared between them without redistribution.
You should also know that like EIGRP, OSPF could be divided into multiple Autonomous Systems.
Each autonomous system will be different from the rest and will require redistribution of routes.
The hierarchical design of OSPF provides the following benefits:
Decrease routing overhead and flow of updates
Limit network problems such as instability to an area
Speed up convergence.
One disadvantage of this is that planning and configuring OSPF is more difficult than other
protocols. Figure 5-5 shows a simple OSPF hierarchical setup. In the figure notice that Area 0 is the
central area and the other two areas connect to it.
Figure 5-5 OSPF hierarchical design

This is always true in an OSPF design. All areas need to connect to Area 0. Areas that cannot
connect to area 0 physically need a logical connection it using something known as virtual links.
Virtual links are out of the scope of the CCNA exam.
Another important thing to notice in the figure is that for each area, there is a router that connects to
area 0 as well. These routers are called Area Border Routers (ABRs). In Figure 5-5, RouterC and
RouterD are ABRs because they connect to area 0 as well as another area. The way ABRs connect
different areas, routers that connect different autonomous systems are called Autonomous System
Boundary Routers (ASBRs). In Figure 5-5, if RouterE connect to another OSPF AS or to an AS of
another protocol such as EIGRP, it would be called an ASBR.
From Figure 5-5, you learned about three OSPF terms Area, ABR and ASBR. Similarly there are
many other terms associated with OSPF that you need to be aware of before getting into how OSPF
actually works. The next section looks at some of these terms.
Building Blocks of OSPF
Each routing protocol has its own language and terminologies. In OSPF there are various terms that
you should be aware of. This section looks at the some of the important terminologies associated
with OSPF. In an attempt to make it easier to understand and remember, the terminologies are
broken into three parts here Router level, Area level and Internetwork level.
At the Router level, when OSPF is enabled, it becomes aware of the following first:
Router ID Router ID is the IP address that will represent the router throughout the OSPF
AS. Since a router may have multiple IP addresses (for its multiple interfaces), Cisco routers
choose the highest loopback interface IP address. (Do not worry if you do not know what
loopback interfaces are. They are covered later in the chapter). If loopback interfaces are not
present, OSPF chooses the highest physical IP address configured within the active
interfaces. Here highest literally means higher in number (Class C will be higher than Class
A because 192 is greater than 10).
Links Simply speaking a Link is a network to which a router interface belongs. When you
define the networks that OSPF will advertise, it will match interface addresses that belong to
those networks. Each interface that matches is called a link. Each link has a status (up or
down) and an IP address associated with it.
Lets take a simple test here. Look at Figure 5-6 and try to find the Router ID and links on each of
the routers.
Figure 5-6 RouterID and links

For RouterA, the RouterID will be 192.168.1.1 because it is the highest physical IP address present.
The three links present on RouterA are the networks 192.168.1.0/24, 10.0.0.0/8 and 172.16.0.0/16.
Similarly, the Router ID of RouterB is 172.30.1.1 since that is the highest physical IP address on the
router. The three links present on RouterB are 10.0.0.0/8, 172.20.0.0/16 and 172.30.0.0/16.
Once a router is aware of the above two things, it will try to find more about its network by seeking
out other OSPF speaking routers. At that stage the following terms come into use:
Hello Packets Similar to EIGRP hello packets, OSPF uses hello packets to discover
neighbors and maintain relationships. Hello packet contains information such as area
number that should match for a neighbor relation to be established. Hello packets are sent to
multicast address 224.0.0.5.
Neighbors Neighbors is the term used to define two or more OSPF speaking routers
connected to the same network and configured to be in the same OSPF area. Routers use
hello packets to discover neighbors.
Neighbor Table OSPF will maintain a list of all neighbors from which hello packets have
been received. For each neighbor various details such as RouterID and adjacency state are
stored.
Area An OSPF area is a grouping of networks and routers. Every router in the area shares
the same area id. Routers can belong to multiple areas; therefore, area id is linked to every
interface. Routers will not exchange routing updates with routers belonging to different
areas. Area 0 is called the backbone area and all other area must connect to it by having at
least one router that belongs to both areas.
Once OSPF has discovered neighbors it will look at the network type on which it is working. OSPF
classifies networks into the following types:
Broadcast (multi-access) Broadcast (multi-access) networks are those that allow multiple
devices to access (or connect to) the same network and also provide ability to broadcast. You
will remember that when a packet is destined to all devices in a network, it is termed as a
broadcast. Ethernet is an example of a broadcast multi-access network.
Non-Broadcast multi-access (NBMA) Networks that allow multi-access but do not have
broadcast ability are called NBMA networks. Frame Relay networks are usually NBMA.
Point-to-Point Point-to-Point networks consist of direct connection between two routers
and provide a single path of communication. When routers are connected back-to-back using
serial interfaces, a point-to-point network is created. Point-to-point networks can also exist
logically across geographical locations using various WAN technologies such as Frame
Relay and PPP.
Point-to-Multipoint Point-to-Multipoint networks consist of multiple connections
between a single interface of a router and multiple remote routers. All routers belong to the
same network but have to communicate via the central router, whose interface connects the
remote routers.
Depending on the network type that OSPF discovers on the router interfaces, it will need to form
Adjacencies. An adjacency is the relation between neighbors that allows direct exchange of routes.
Unlike EIGRP, OSPF will not form adjacency with all neighbors always. A router will form
adjacencies with a few or all neighbors depending on the network type that is discovered.
Adjacencies in each network type is discussed below:
Broadcast (multi-access) Since multiple routers can connect to such networks, OSPF
elects a Designated Router (DR) and a Backup Designated Router (BDR). All routers in
these networks, form adjacencies only with the DR and BDR. This also means that route
updates are only shared between the routers and the DR and BDR. It is the duty of the DR to
share routing updates with the rest of the routers in the network. If a DR loses connectivity
to the network, the BDR will take its place. The election process is discussed later in the
chapter.
NBMA Since NBMA is also a multi-access network, a DR and a BDR is elected and
routers form adjacencies only with them. The problem with NBMA networks is that since
broadcast capability and in turn multicast capability is not present, routers cannot discover
neighbors. So NBMA networks require you to manually tell OSPF about the neighbors
present in the network. Apart from this, OSPF functions as it does in a broadcast multi-
access network.
Point-to-Point Since there are only two routers present in a point-to-point network, there
is no need to elect a DR and BDR. Both routers form adjacency with each other and
exchange routing updates. Neighbors are discovered automatically in these networks.
Point-to-multipoint Point-to-multipoint interfaces are treat as special point-to-point
interfaces by OSPF and it does a little extra work on here that is out of scope of CCNA.
There is no DR/BDR election in such networks and neighbors are automatically discovered.

Exam Alert: It can get confusing to remember the network types, election and adjacency
requirements. A simple way to remember it is to associate multi-access with DR/BDR and Point-
to with no election. Also associate NBMA with manually specifying neighbors.
Once OSPF has formed adjacencies, it will start exchanging routing updates. The following two
terms come to use here:
Link State Advertisements Link State Advertisements (LSAs) are OSPF packets
containing link-state and routing information. These are exchanged between routers that
have formed adjacencies. The packets essentially tell routers in the networks about different
networks (links) that are present and how to reach them. Different types of LSAs are
discussed later in the chapter.
Topology Table The topology table contains information on every link the router learns
about (via LSAs). The information is the topology table is used to compute the best path to
remote networks.
At the area level, the only term that gets introduced is:
Area Border Routers (ABRs) Routers that connect an area to area 0 are called ABRs.
They have one interface belonging to area 0 and other interfaces belonging to one or more
areas. They are responsible for propagating routing updates between area 0 and other areas.
At the internetwork level another term that gets introduced is:
Autonomous System Boundary Router (ASBR) A router that connects an OSPF AS to
another OSPF AS or AS belonging to other routing protocols is called an Autonomous
System Boundary Router or ASBR. Route redistribution is setup between the two AS on
these routers and hence they become the gateway between the two AS.
Now that you are familiar with OSPF terminology, the rest of the sections will discuss the working
of OSPF in detail and help you better understand the terms discussed here.
Loopback Interfaces
Loopback interfaces are virtual, logical interfaces that exist in the software only. They are used for
administrative purposes such as providing a stable OSPF interface or diagnostics. Using loopback
interfaces with OSPF has the following benefits:
Provides an interface that is always active.
Provides an OSPF Router ID that is predictable and always same. Making is easier to
troubleshoot OSPF.
Router ID is a differentiator in DR/BDR election. Having a loopback interface with higher
order IP address can influence the election.
Configuring a loopback interface is easy You need to select an interface number and enter the
interface configuration mode using the interface command in global configuration mode as shown
below:

RouterA(config)#interface loopback 0
RouterA(config-if)#
The interface number can be any number starting from 0. Once in the interface configuration mode,
use the ip address command to configure an IP address as you would on a physical interface. An
example is shown below:

RouterA(config-if)#ip address 192.168.10.1 255.255.255.0


Thats it! The loopback interface is configured and will be listed as an active interface in the show
ip interface command.
The loopback interface can be important for OSPF because it will take the highest loopback IP
address as the Router ID. If a loopback interface is not present, the highest physical IP address will
be taken.
A loopback interface is logically equivalent to a physical address. The router is going to add an
entry into its routing table for the network that the loopback interface address belongs to. So you
can even configure a routing protocol to advertise the loopback network. Whether you choose to do
that or not depends on whether you want the loopback address to be reachable from the network or
not. Remember you will be using a subnet if you decide to advertise the loopback network.
DR/BDR Election and influencing it
As discussed earlier, in multi-access network types, DRs and BDRs are elected and routers in the
area only form adjacencies with them. So DRs and BDRs are an important part of OSPF and
usually determine how well OSPF will function. In this section you will learn about the process by
which DRs/BDRs are elected. Before learning about the process, it is important that you understand
the terms neighbors and adjacencies fully since they are central to functioning of OSPF and the
election process.
A router running OSPF will periodically send out Hello packets to multicast address 224.0.0.5.
These hello packets serve as a way to discover neighbors. When a router receives these packets, it
checks the following to ascertain that a neighborship can be established:
Area ID The Area ID received in a hello packet should match the area ID associated with
the interface the packet was received on. As mentioned earlier, OSPF associates an area ID
with each interface it is enabled on. The rationale behind comparing the area ID is that only
router having interface in the same area should form neighborship.
Hello and Dead intervals Hello packets exchanged by routers running OSPF contain
information such as area ID, hello interval and dead interval. Hello interval specifies the
time duration between hello packets and dead interval specifies the time duration after which
a router will be declared dead if hello packets have not been received from it.
For a neighborship to form, the hello and dead intervals should match between the routers.
Authentication OSPF allows you to set a password for an area. For neighborship to form,
the password must be same on the routers. Setting a password is optional.
If all the three above conditions match, the router will add the neighbor into the neighbor table and
form a neighborship. Even though a neighborship gets formed, OSPF unlike EIGRP will not share
routing updates, or link state advertisements in this case, with every neighbor.
For OSPF to share link state advertisements, an adjacency must be formed between the routers. As
discussed earlier, how adjacencies are formed depends on the network type. In a multi-access
network, a DR and BDR will be elected and all routers in the network will form adjacency with
them only. Each router will exchange LSAs with DR and BDR. DR in turn will relay the
information to the rest of the routers.
When routers realize that they are connected to a multi-access network, they will look at each Hello
packet received to find the priority and Router ID of each router. Then the priority is compared
and the router with the highest priority is selected the DR. The router with the second highest
priority becomes the BDR. By default the priority of each router is 1 and can be changed on a per-
interface basis.
If all routers have the default priority, then the router with the highest Router ID is elected the DR
while the router with the second highest Router ID is elected the BDR. If the priority of a router is
set to zero, it will not participate in the election process and will never be a DR or BDR.
As you know, the Router ID is the highest physical IP address present on a Router. This can be
overridden by using a loopback interface because a router will use the highest loopback address, if
one is present.
If you need to influence the DR/BDR election in a network segment, you can do one of the
following:
Manually increase the priority of a router interface to ensure that the router becomes the
DR/BDR.
Configure a loopback interface so that the Router ID becomes higher than that of the other
routers in the network segment.
SPF Tree Calculation
Once OSPF exchanges link state advertisements and populates the topology table, each router runs
a calculation on the information collected. These calculations use something known as the Shortest
Path First (SPF) algorithm. To do so, each router creates a tree putting itself at the root of the tree
and the other routers and networks form the branch and leaves. In effect the router puts itself at the
start and the area branches out from it. Figures 5-7 and 5-8 show an example of how the SPF tree is
created by a router. Figure 5-7 shows the SPF tree with RouterA as the origin while Figure 5-8
shows the SPF tree with RouterG as the origin. Notice how different the network looks from the
perspective of each router. The benefit of each router creating this tree is that the shortest path can
be found from each router to each destination and there is no routing by rumor as seen with distance
vector protocols.
Figure 5-7 SPF tree Example 1

Figure 5-8 SPF tree Example 2


It is important to understand that each router creates this tree only for the area it belongs to. If a
router belongs to multiple areas, it will create a separate tree for each area.
A big part of the tree is also the cost associated with each path. Cost is the metric used by OSPF is
the sum of the cost of the entire path from the router to the remote network. The OSPF RFC defines
cost as an arbitrary value, so Cisco calculates cost as 108/bandwidth. Bandwidth in this equation is
the bandwidth configured on the interface. Using this equation, an Ethernet interface with a
bandwidth of 10Mbps has a cost of 10 and a 100Mbps interface has a cost of 1. You may have
noticed that interfaces having a bandwidth of more than 100Mbps will have a cost in fraction but
Cisco does not use fractions and rounds of the value to 1 for such interfaces.
In Figure 5-8, if all interfaces are FastEthernet interfaces with a bandwidth of 100Mbps, each link
has a cost of 1. So for the path from RouterG to the 192.168.7.0/24, the total cost will be 5 and to
the network 192.168.3.0/24, the total cost will be 2.
The cost of each interface can be changed using the ip ospf cost command in the interface
configuration mode. It should be noted that since the OSPF RFC does not exactly define the metric
that makes up the cost, each vendor uses a different metric. When using OSPF in a multivendor
environment, you will need to adjust cost to ensure parity.
Link State Advertisements
The fundamental building blocks of OSPF are the link state advertisements that are sent from every
router to advertise links and their states. Given the complexity and scalability of OSPF, different
LSA types are used to keep the OSPF database updated. Out of the various LSAs, the first five are
most relevant to the limited OSPF discussion covered in this chapter and are discussed below:
Type 1 Router LSA Each router in the area sends this LSA to announce its presence and
list the links to other routers and networks along with metrics to them. These LSAs do not
cross the boundary of an area.
Type 2 Network LSA The DR in a multi-access network sends out this LSA. It contains
a list of routers that are present in the network segment. These LSAs also do not cross the
boundary of an area.
Type 3 Summary LSA The ABR takes the information learned in one area (and
optionally summarizes this information) and sends it out to another area it is attached to.
This information is contained in LSA type 3 and is responsible for propagation of Inter-area
routes.
Type 4 ASBR Summary LSA ASBRs originate external routes (redistributed routes)
and send them throughout the network. While the external routes are listed in type 5 LSA,
the details of the ASBR themselves in listed in type 4 LSAs. This LSA is originated by the
ABR of the area where the ASBR resides.
Type 5 External LSA This LSA lists routes redistributed into OSPF from another OSPF
process or another routing protocol. This LSA is originated by the ASBR and propagates
across the OSPF AS.
Configuring OSPF
In the previous section you learned about OSPF and how it works. While a lot a theory was covered
in that section, this one looks at configuring OSPF. The network shown in Figure 5-9 will be used
for this section.
Figure 5-9 OSPF Network

Just like EIGRP, OSPF configuration is divided into two parts the global configuration and the
interface level configuration. Globally, configuring OSPF includes enabling the process and adding
networks to be advertised. To enable the OSPF process use the router ospf process_id global
configuration command. In this command, process_id is a locally significant number and does not
represent the AS. Since multiple OSPF processes can run on a router, the process_id is used to keep
the processes separate. The process id can be different on every router. On entering the command,
you will arrive at the router configuration mode when the network command can be used to specify
the networks that will be advertised. In respect to OSPF, the network command actually identifies
the interfaces on which OSPF will be enabled and the network to which the interface belongs will
be advertised. The syntax of the command is:
network network_number wildcard_mask area area_id
In the above command, network_number and wildcard_mask combine to identify the interface on
which OSPF will be enabled. While network_number is a network address (example 192.168.1.0), a
wildcard_mask is the inverse of subnet mask. In a subnet mask a 255 is an octet means the
corresponding octet in the network number should match exactly while a 0 means it can be
anything. In a wildcard mask a 255 means the corresponding octet in a network number can be
anything and 0 means the corresponding octet should match exactly. Confusing? Table 5-3 shows a
few examples. The last component of the above command is the area_id to which the interface will
belong.
Table 5-3 Wildcard Mask examples
Network Wildcard Matches Explanation
192.168.1.1 0.0.0.0 192.168.1.1 Since each octet of the wildcard mask is a
zero, only an interface with an IP address
specified by the network number will be
matched.
192.168.1.0 0.0.0.255 192.168.1.0- Since the last octet is 255, the value of the
192.168.1.255 last octet of the network number does not
matter as long as the first three octets
match the given network number.
10.1.0.0 0.255.255.255 10.0.0.0- A wildcard mask of 0.255.255.255 means
10.255.255.255 that as long as the first octet matches, the
rest can be anything.
If you want to enable OSPF on each interface individually then you can use a wildcard mask of
0.0.0.0 with network numbers consisting of the IP address of each interface. This is the simplest and
easiest way to configure OSPF but you can also use wildcard mask to cover a range of addresses.
For example, In Figure 5-9, RouterF has two interfaces and OSPF can be enabled on them using
two network commands like:
network 192.168.6.0 0.0.0.255 area 2
network 192.168.7.0 0.0.0.255 area 2
Another way to configure OSPF on RouterF is to use a single network commands as shown below:

network 192.168.0.0 0.0.255.255 area 2


While the first method is precise and safe, the second method can introduce problems since it
covers a wide range of networks. Another method to use wildcard masks is to specify network
blocks. Wilcard masks can represent blocks of network just like network masks. You may recall that
network masks can represent only specific sizes of blocks 2, 4, 8, 16, 32, 64, 128 and 255. To
specify a block with wildcard mask simply deduct one from the block size. For example, in RouterF
networks 192.168.6.0 and 192.168.7.0 can be covered using any of the following:

192.168.6.0 0.0.1.255 (a block size of 2 starting with 192.168.6.0)


192.168.4.0 0.0.3.255 (a block size of 4 starting with 192.168.4.0)
192.168.0.0 0.0.7.255 (a block size of 8 starting with 192.168.0.0)
Now that you understand the network command, let us configure the OSPF in the network shown
in Figure 5-9. I will be using a mix of wildcard masks types discussed above to configure each
router. Make sure you pay attention to the area each interface should belong to. With OSPF, area 0
should be configured first, so we will start with routers belonging to area 0.
Area 0
RouterB has one interface in area 0 while RouterC has 2 interfaces in area 0. The best way to
configure them is to use a wildcard mask of 0.0.0.0 with the interfaces addresses.

RouterB(config)#router ospf 1
RouterB(config-router)#network 192.168.3.2 0.0.0.0 area 0
RouterC(config)#router ospf 1
RouterC(config-router)#network 192.168.3.3 0.0.0.0 area 0
RouterC(config-router)#network 192.168.4.3 0.0.0.0 area 0
Note that 192.168.3.0 and 192.168.4.0 cannot be configured as a single block since a block of 2 or 4
will not cover them and a block of 8 will cover 192.168.5.0, which is in area 2. So we had to use
two statements with a mask of 0.0.0.0.
Area 1
Now that area 0 has been configured, other areas can be configured. RouterA has two interfaces in
area 1 and RouterB has one interface in that area.

RouterA(config)#router ospf 1
RouterA(config-router)#network 0.0.0.0 255.255.255.255 area 1
RouterB(config)#router ospf 1
RouterB(config-router)#network 192.168.2.2 0.0.0.0 area 1
Notice that on RouterA a network number of 0.0.0.0 and a wildcard mask of 255.255.255.255 are
used. This mask essentially means all networks and can be used on RouterA since both the
interfaces belong to area 1.
Area 2
The final area spans across four routers. All interfaces of RouterD, RouterE and RouterF belong to
area 2.

RouterC(config)#router ospf 1
RouterC(config-router)#network 192.168.5.3 0.0.0.0 area 2
RouterD(config)#router ospf 1
RouterD(config-router)#network 0.0.0.0 255.255.255.255 area 2
RouterE(config)#router ospf 1
RouterE(config-router)#network 192.168.5.5 0.0.0.0 area 2
RouterE(config-router)#network 192.168.6.5 0.0.0.0 area 2
RouterF(config)#router ospf 1
RouterF(config-router)#network 192.168.6.0 0.0.1.255 area 2
In the above configuration notice the three different ways wildcard has been used on RouterD,
RouterE and RouterF.
Now that OSPF configuration is complete, let us take a look at the routing table on each router to
verify the configuration.

RouterA#sh ip route
output truncated
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/138] via 192.168.2.2, 00:04:35, Serial0/0
O IA 192.168.5.0/24 [110/138] via 192.168.2.2, 00:04:35, Serial0/0
O IA 192.168.6.0/24 [110/148] via 192.168.2.2, 00:03:50, Serial0/0
O IA 192.168.7.0/24 [110/158] via 192.168.2.2, 00:03:50, Serial0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
C 192.168.2.0/24 is directly connected, Serial0/0
O IA 192.168.3.0/24 [110/128] via 192.168.2.2, 00:04:35, Serial0/0
RouterB#sh ip route
output truncated
Gateway of last resort is not set
O 192.168.4.0/24 [110/74] via 192.168.3.3, 00:04:38, Serial0/1
O IA 192.168.5.0/24 [110/74] via 192.168.3.3, 00:04:38, Serial0/1
O IA 192.168.6.0/24 [110/84] via 192.168.3.3, 00:03:53, Serial0/1
O IA 192.168.7.0/24 [110/94] via 192.168.3.3, 00:03:53, Serial0/1
O 192.168.1.0/24 [110/74] via 192.168.2.1, 00:04:38, Serial0/0
C 192.168.2.0/24 is directly connected, Serial0/0
C 192.168.3.0/24 is directly connected, Serial0/1
RouterC#sh ip route
output truncated
Gateway of last resort is not set
C 192.168.4.0/24 is directly connected, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/1
O 192.168.6.0/24 [110/20] via 192.168.5.5, 00:03:55, FastEthernet0/1
[110/20] via 192.168.5.4, 00:03:55, FastEthernet0/1
O 192.168.7.0/24 [110/30] via 192.168.5.5, 00:03:55, FastEthernet0/1
[110/30] via 192.168.5.4, 00:03:55, FastEthernet0/1
O IA 192.168.1.0/24 [110/138] via 192.168.3.2, 00:04:40, Serial0/0
O IA 192.168.2.0/24 [110/128] via 192.168.3.2, 00:04:40, Serial0/0
C 192.168.3.0/24 is directly connected, Serial0/0
RouterD#sh ip route
output truncated
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/20] via 192.168.5.3, 00:03:57, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/1
O 192.168.7.0/24 [110/20] via 192.168.6.6, 00:03:57, FastEthernet0/1
O IA 192.168.1.0/24 [110/148] via 192.168.5.3, 00:03:57, FastEthernet0/0
O IA 192.168.2.0/24 [110/138] via 192.168.5.3, 00:03:57, FastEthernet0/0
O IA 192.168.3.0/24 [110/74] via 192.168.5.3, 00:03:57, FastEthernet0/0
RouterE#sh ip route
output truncated
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/20] via 192.168.5.3, 00:03:59, FastEthernet0/0
C 192.168.5.0/24 is directly connected, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/1
O 192.168.7.0/24 [110/20] via 192.168.6.6, 00:03:59, FastEthernet0/1
O IA 192.168.1.0/24 [110/148] via 192.168.5.3, 00:03:59, FastEthernet0/0
O IA 192.168.2.0/24 [110/138] via 192.168.5.3, 00:03:59, FastEthernet0/0
O IA 192.168.3.0/24 [110/74] via 192.168.5.3, 00:03:59, FastEthernet0/0
RouterF#sh ip route
output truncated
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/30] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/30] via 192.168.6.4, 00:03:51, FastEthernet0/0
O 192.168.5.0/24 [110/20] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/20] via 192.168.6.4, 00:03:51, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
O IA 192.168.1.0/24 [110/158] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/158] via 192.168.6.4, 00:03:51, FastEthernet0/0
O IA 192.168.2.0/24 [110/148] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/148] via 192.168.6.4, 00:03:51, FastEthernet0/0
O IA 192.168.3.0/24 [110/84] via 192.168.6.5, 00:04:01, FastEthernet0/0
[110/84] via 192.168.6.4, 00:03:51, FastEthernet0/0
The above outputs show that all networks are known across the internetwork. You should also
notice the following:
While an O precedes OSPF routes, inter-area routes are preceded with an IA also.
In the outputs from RouterC and RouterF notice that OSPF is load balancing across equal
cost paths.
Influencing path selection
As discussed in the earlier section, Cisco uses interface bandwidth as a metric for cost and the sum
of cost of the entire path is used to select the best route to a destination. The cost of an interface can
be manually changed using the ip ospf cost command in the interface configuration mode.
For example, in the network shown in Figure 5-9, traffic going from RouterF to 192.168.4.0/24 is
being load balanced between the paths going through RouterD and RouterE. RouterF can be made
to route traffic only through RouterD and use RouterE has a backup path by increasing the cost
associated with interface fa0/0 on RouterE. This will cause the cost of the entire path to increase
causing RouterF to not use that path along with the other path. The following commands will
increase the cost on RouterE:

RouterE(config)#int fa0/0
RouterE(config-if)#ip ospf cost 20
The effect of this change will almost immediately be seen on the routing table of RouterF:

RouterF#sh ip route
output truncated
Gateway of last resort is not set
O IA 192.168.4.0/24 [110/30] via 192.168.6.4, 00:04:15, FastEthernet0/0
O 192.168.5.0/24 [110/20] via 192.168.6.4, 00:03:04, FastEthernet0/0
C 192.168.6.0/24 is directly connected, FastEthernet0/0
C 192.168.7.0/24 is directly connected, FastEthernet0/1
O IA 192.168.1.0/24 [110/158] via 192.168.6.4, 00:04:15, FastEthernet0/0
O IA 192.168.2.0/24 [110/148] via 192.168.6.4, 00:04:15, FastEthernet0/0
O IA 192.168.3.0/24 [110/84] via 192.168.6.4, 00:04:15, FastEthernet0/0
In the output above, notice that RouterF is no longer load balancing the traffic across the two paths.
Influencing DR/BDR election
In the previous section you learned that OSPF routes do not form adjacencies with all neighbors in a
multi-access network. A DR and a BDR are elected and all other routers form adjacencies with
them. This election takes into consideration the OSPF priority and in case of a tie, the Router ID.
For example, in the network shown in Figure 5-9, RouterE will be the DR and RouterD will be the
BDR in the Ethernet network 192.168.5.0/24 because RouterE has the highest router ID
(192.168.6.5) and RouterD has the second highest router ID (192.168.6.4). RouterC has a router ID
of 192.168.6.3. If you wanted RouterC to always be the DR, either the priority or the Router ID
would have to be increased. The easiest way to do this is to increase the priority on interface fa0/1
of RouterC as shown below:

RouterC(config)#int fa0/1
RouterC(config-if)#ip ospf priority 10
The show ip ospf interface interface command can be used as shown below:

RouterC#sh ip ospf interface fa0/1


FastEthernet0/1 is up, line protocol is up
Internet Address 192.168.5.3/24, Area 2
Process ID 1, Router ID 192.168.5.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DROTHER, Priority 10
Designated Router (ID) 192.168.6.5, Interface address 192.168.5.5
Backup Designated router (ID) 192.168.6.4, Interface address 192.168.5.4
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:05
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 1, maximum is 1
Last flood scan time is 0 msec, maximum is 0 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.6.4 (Backup Designated Router)
Adjacent with neighbor 192.168.6.5 (Designated Router)
Suppress hello for 0 neighbor(s)
While the entire output is discussed in the next section, notice that the third line shows the state as
DOTHER. DOTHER means that the router is not a DR or BDR. So why did the new priority not
cause RouterC to become the DR or BDR?
That is because a DR/BDR election does not take place till the existing DR/BDR leaves the
network. One way to force a reelection is to restart the OSPF process on the current DR and BDR.
A reset will cause the OSPF process to restart and the network will think that the DR and BDR are
lost and will force an election. You can rest the process using clear ip ospf process command. To
force an election in the network, lets reset the OSPF process on RouterD and RouterE as shown
below:

RouterE#clear ip ospf process


Reset ALL OSPF processes? [no]: yes
RouterD#clear ip ospf process
Reset ALL OSPF processes? [no]: yes
Once the adjacencies are reestablished, the output of show ip ospf interface on RouterC looks like
the following:

RouterC#show ip ospf interface fa0/1


FastEthernet0/1 is up, line protocol is up
Internet Address 192.168.5.3/24, Area 2
Process ID 1, Router ID 192.168.5.3, Network Type BROADCAST, Cost: 10
Transmit Delay is 1 sec, State DR, Priority 10
Designated Router (ID) 192.168.5.3, Interface address 192.168.5.3
Backup Designated router (ID) 192.168.6.5, Interface address 192.168.5.5
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
oob-resync timeout 40
Hello due in 00:00:04
Supports Link-local Signaling (LLS)
Cisco NSF helper support enabled
IETF NSF helper support enabled
Index 1/3, flood queue length 0
Next 0x0(0)/0x0(0)
Last flood scan length is 0, maximum is 2
Last flood scan time is 0 msec, maximum is 4 msec
Neighbor Count is 2, Adjacent neighbor count is 2
Adjacent with neighbor 192.168.6.4
Adjacent with neighbor 192.168.6.5 (Backup Designated Router)
Suppress hello for 0 neighbor(s)
Notice that RouterC is now the DR. Another way to influence the election would have been to
create a loop back interface on RouterC with a high IP address as shown below:
RouterC(config)#interface loopback 0
RouterC(config)#ip address 192.168.100.1 255.255.255.0
This would cause the router ID of RouterC to be higher than the rest.

Vous aimerez peut-être aussi