Hello Protocol Type: OSPF packet type: Hello Type 1, DBD Type 2, LS Request Type 3, LS Update Type 4, LS ACK Type 5 Router ID: ID of the originating router Area ID: Area from whi
Trang 1Chapter 11
OSPF
quangkien@gmail.com
Trang 2 For further explanation
and details, please read
Trang 3 The router ospf command
The network command
DR/BDR Election Process
OSPF Interface Priority
More OSPF Configuration
Redistributing an OSPF
Default Route
Fine-tuning OSPF
Trang 4Introduction to OSPF
Background of OSPF
OSPF Message Encapsulation
OSPF Packet Types
Trang 5Introduction to OSPF
OSPF is:
Classless
Link-state routing protocol
Uses the concept of areas for scalability
RFC 2328 defines the OSPF metric as an arbitrary value called cost
Cisco IOS software uses bandwidth to calculate the OSPF cost metric.
Trang 6Background of OSPF
1987 - Initial development by IETF OSPF Working Group.
1989 - OSPFv1 was published in RFC 1131.
1991 - OSPFv2 was introduced in RFC 1247 by John Moy
ISO was working IS-IS
IETF chose OSPF as its recommended IGP (interior gateway
protocol).
In 1998 - OSPFv2 specification was updated in RFC 2328 and is the
current RFC for OSPF.
Trang 7OSPF Message
Encapsulation
This data field can include one of five OSPF packet types
In the IP packet header:
Protocol field is set to 89 (OSPF)
Destination address is typically set to one of two multicast addresses:
Trang 8OSPF Packet
Types
Five types of OSPF LSPs (link-state packets).
Hello: Used to establish and maintain adjacency.
DBD (Database Description): Abbreviated list of the sending router’s
link-state database
LSR (Link-State Request) : Used by routers to request more information
about any entry in the DBD
LSU: (Link-State Update): Link-state information.
LSAck (LSA Acknowledgment): Router sends a link-state (LSAck) to
confirm receipt of the LSU
Figure includes CCNP information
Trang 9 Hello Interval, Dead Interval, Network Type
Elect the Designated Router and Backup Designated Router on
multiaccess networks such as Ethernet and Frame Relay
Hello packets :
More in later
Trang 10Hello
Protocol
Type: OSPF packet type: Hello (Type 1), DBD (Type 2), LS Request (Type
3), LS Update (Type 4), LS ACK (Type 5)
Router ID: ID of the originating router
Area ID: Area from which the packet originated
Network Mask: Subnet mask associated with the sending interface
Hello Interval: Number of seconds between the sending router’s Hellos
Router Priority: Used in DR/BDR election (discussed later)
Designated Router (DR): Router ID of the DR, if any
Backup Designated Router (BDR): Router ID of the BDR, if any
List of Neighbors: Lists the OSPF Router ID of the neighboring router(s)
These will be discussed
throughout this chapter.
Trang 11 Before an OSPF router can flood its link states, must discover neighbors
Includes the OSPF Router ID (later)
Receipt confirms there is another OSPF router on this link
Adjacency is now established
Routers are not considered fully adjacent, at this point each router is aware of the other OSPF router on the link
Neighbor
Establishment
Note: Full adjacency
happens after both
routers have exchanged
any necessary LSUs
and have identical
link-state databases
(CCNP)
More later
Trang 13Hello Intervals
By default, OSPF Hello packets are sent:
10 seconds on multiaccess and point-to-point segments
30 seconds on nonbroadcast multiaccess (NBMA) segments (Frame
Relay, X.25, ATM)
In most cases, OSPF Hello packets are sent as multicast to an address
reserved for ALLSPFRouters at 224.0.0.5.
Trang 14Dead Intervals
Dead interval - Period, expressed in seconds, that the router will wait to
receive a Hello packet before declaring the neighbor “down.”
Cisco uses a default of four times the Hello interval
40 seconds - Multiaccess and point-to-point segments
120 seconds - NBMA networks.
Dead interval expires
OSPF removes that neighbor from its link-state database
Floods the link-state information about the “down” neighbor out all OSPF-enabled interfaces
Network types are discussed later in the chapter.
Trang 15 Used to reduce the amount of OSPF traffic on multiaccess networks
DR is responsible for updating all other OSPF routers.
BDR is the backup if the current DR fails.
R1, R2, and R3 are connected through point-to-point links
No DR/BDR election occurs
Much more later
More later
Trang 17OSPF Algorithm
Each OSPF router maintains a link-state database containing the
LSAs received from all other routers
When a router has received all the LSAs and built its local link-state
database, OSPF uses Dijkstra’s shortest path first (SPF)
algorithm to create an SPF tree
The SPF tree is then used to populate the IP routing table with the
best paths to each network.
Trang 18Administrative Distance
Administrative distance (AD) is the
trustworthiness (or preference) of
the route source
OSPF has a default AD of 110.
Trang 19Authentication
OSPF can be configured for authentication
This practice ensures that routers will only accept routing information from other routers that have been configured with the same password or
authentication information
Trang 20Basic OSPF Configuration
Lab Topology
The router ospf command
The network command
OSPF Router ID
Verifying OSPF
Examining the Routing Table
Trang 21 Notice that the addressing scheme is discontiguous.
OSPF is a classless routing protocol
There are three serial links of various bandwidths and that each router
has multiple paths to each remote network
Topology
Trang 25 Does not have to match other OSPF routers
This differs from EIGRP
We are using the same process ID simply for consistency
R1(config)# router ospf 1
R1(config-router)#
Trang 26The network Command
The network command (same function as when used with other IGP
routing protocols):
Any interfaces on a router that match the network address in the
network command will be enabled to send and receive OSPF packets.
This network (or subnet) will be included in OSPF routing updates
Requires the wildcard mask
Used to specify the interface or range of interfaces that will be enabled for
OSPF
Router(config-router)# network network-address wildcard-mask area area-id
Trang 27The network Command
The wildcard mask can be configured as the inverse of a subnet mask
R1’s FastEthernet 0/0 interface is on the 172.16.1.16/28 network
The subnet mask for this interface is /28 or 255.255.255.240
The wildcard mask would be 0.0.0.15
Note:
Like EIGRP, some Cisco IOS software versions allow you to simply
enter the subnet mask instead of the wildcard mask
The Cisco IOS software then converts the subnet mask to the wildcard
Trang 28The network Command
The area area-id refers to the OSPF area
A group of OSPF routers that share link-state information
All OSPF routers in the same area must have the same
link-state information in their link-link-state databases
This is accomplished by routers flooding their individual link
states to all other routers in the area
In this chapter, we configure all the OSPF routers within a single
area
This is known as single-area OSPF.
The network commands must be configured with the same area ID
on all routers
Although any area ID can be used, it is good practice to use an area
ID of 0 with single-area OSPF
This convention makes it easier if the network is later configured as
multiple OSPF areas where area 0 becomes the backbone area.
Mult-Area OSPF is discussed in CCNP.
Router(config-router)# network network-address wildcard-mask area area-id
Trang 29The network Command
network commands for all three routers, enabling OSPF on all interfaces
At this point, all routers should be able to ping all networks
R1(config)# router ospf 1
R1(config-router)# network 172.16.1.16 0.0.0.15 area 0
R1(config-router)# network 192.168.10.0 0.0.0.3 area 0
R1(config-router)# network 192.168.10.4 0.0.0.3 area 0
R2(config)# router ospf 1
R2(config-router)# network 10.10.10.0 0.0.0.255 area 0
R2(config-router)# network 192.168.10.0 0.0.0.3 area 0
R2(config-router)# network 192.168.10.8 0.0.0.3 area 0
R3(config)# router ospf 1
R3(config-router)# network 172.16.1.32 0.0.0.7 area 0
R3(config-router)# network 192.168.10.4 0.0.0.3 area 0
R3(config-router)# network 192.168.10.8 0.0.0.3 area 0
Area-ID must be the same on all routers
Router-ID does NOT have to
be the same on all routers
Wildcard mask must
be used
Trang 30 OSPF Router ID is an IP address used to uniquely identify an OSPF router.
Also used in the DR and BDR process (later)
OSPF Router ID
Router ID?
Router ID?
Router ID?
Trang 31 Cisco routers derive the router ID based on three criteria and with the
following precedence:
1 Use the IP address configured with the OSPF router-id command.
2 If the router ID is not configured, the router chooses the highest IP
address of any of its loopback interfaces.
3 If no loopback interfaces are configured, the router chooses the highest
active IP address of any of its physical interfaces.
The interface does not need to be enabled for OSPF, i.e it does not
need to be included in one of the OSPF network commands.
Trang 32 R1: 192.168.10.5, which is higher than either 172.16.1.17 or 192.168.10.1
R2: 192.168.10.9, which is higher than either 10.10.10.1 or 192.168.10.2
R3: 192.168.10.10, which is higher than either 172.16.1.33 or 192.168.10.6
Trang 33Verifying the Router ID
R1# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.10.5
<output omitted>
R2# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.10.9
<output omitted>
R3# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Router ID 192.168.10.10
<output omitted>
show ip ospf can also be used (later)
Trang 34Loopback Address
The advantage of using a loopback interface is that, unlike physical
interfaces, it cannot fail
Because the OSPF router-id command, which is discussed next, is a fairly recent addition to Cisco IOS software, it is more common to find loopback addresses used for configuring OSPF router IDs
Router(config)# interface loopback number
Router(config-if)# ip address ip-address subnet-mask
R1(config)# interface loopback 0
Trang 351 Use the IP address configured with the OSPF router-id command.
2 Highest IP address of any of its loopback interfaces.
3 Highest active IP address of any of its physical interfaces.
Trang 36OSPF router-id Command
The OSPF router-id command was introduced in Cisco IOS Software
Release 12.0(T) and takes precedence over loopback and physical
interface IP addresses for determining the router ID
1 Use the IP address configured with the OSPF router-id command
2 Highest IP address of any of its loopback interfaces
3 Highest active IP address of any of its physical interfaces
Router(config)# router ospf process-id
Router(config-router)# router-id ip-address
Trang 37Modifying the Router ID (Extra)
The router ID is selected when OSPF is configured with its first OSPF
network command.
If the OSPF router-id command or the loopback address is configured
after the OSPF network command, the router ID is derived from the
interface with the highest active IP address
The router ID can be modified with the IP address from a subsequent OSPF
router-id command by reloading the router or by using the following
command:
Router# clear ip ospf process
Modifying a router ID with a new loopback or physical interface IP address may require reloading the router
Trang 38Duplicate Router IDs
When two routers have the same router ID in an OSPF domain, routing might not function properly
If the router ID is the same on two neighboring routers, the neighbor establishment might not occur
When duplicate OSPF router IDs occur, Cisco IOS software displays a message above
%OSPF-4-DUP_RTRID1: Detected router with duplicate router ID
Trang 39Verifying New Router IDs (Loopbacks)
R1# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 10.1.1.1
<output omitted>
R2# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 10.2.2.2
<output omitted>
R3# show ip protocols
Routing Protocol is “ospf 1”
Outgoing update filter list for all interfaces is not set Incoming update filter list for all interfaces is not set Router ID 10.3.3.3
<output omitted>
Trang 40Verifying OSPF
The show ip ospf neighbor command enables you to verify and
troubleshoot OSPF neighbor relationships
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 10.3.3.3 1 FULL/ - 00:00:30 192.168.10.6 Serial0/0/1 10.2.2.2 1 FULL/ - 00:00:33 192.168.10.2 Serial0/0/0
R2# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 10.3.3.3 1 FULL/ - 00:00:36 192.168.10.10 Serial0/0/1 10.1.1.1 1 FULL/ - 00:00:37 192.168.10.1 Serial0/0/0
R3# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 10.2.2.2 1 FULL/ - 00:00:34 192.168.10.9 Serial0/0/1 10.1.1.1 1 FULL/ - 00:00:38 192.168.10.5 Serial0/0/0
Trang 41Verifying OSPF
Neighbor ID: The router ID of the neighboring router.
Pri: The OSPF priority of the interface (later)
State: The OSPF state of the interface
FULL state means that the router’s interface is fully adjacent with its neighbor and they have identical OSPF link-state databases
OSPF states are discussed in CCNP.
Dead Time: The amount of time remaining that the router will wait to receive an
OSPF Hello packet from the neighbor before declaring the neighbor down
This value is reset when the interface receives a Hello packet.
Address: The IP address of the neighbor’s interface to which this router is
directly connected
Interface: The interface on which this router has formed adjacency with the
neighbor
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 10.3.3.3 1 FULL/ - 00:00:30 192.168.10.6 Serial0/0/1 10.2.2.2 1 FULL/ - 00:00:33 192.168.10.2 Serial0/0/0
Trang 42Verifying OSPF
Excellent command to begin troubleshooting
Routers must first form an adjacency before link-state information can be exchanged
Then routes will be added to the routing table
Note: On multiaccess networks such as Ethernet, two routers that are adjacent
may have their states displayed as 2WAY
This is discussed in a later section.
R1# show ip ospf neighbor
Neighbor ID Pri State Dead Time Address Interface 10.3.3.3 1 FULL/ - 00:00:30 192.168.10.6 Serial0/0/1 10.2.2.2 1 FULL/ - 00:00:33 192.168.10.2 Serial0/0/0