Understanding OSPF Basics and Commands
Understanding OSPF Basics and Commands
Spring 2015
Basic OSPF
Types of Routing Protocols
Exterior
Gateway
Interior Gateway Protocols Protocols
Distance Vector Link State Path Vector
Distance Vector Routing Link State Routing Path Vector
Protocols Protocols
IPv4 RIPv2 EIGRP OSPFv2 IS-IS BGP-4
RIPng EIGRP for OSPFv3 * IS-IS for BGP-4 for
IPv6 IPv6 IPv6 IPv6 or
MP-BGP
* OSPFv3 supports routing both IPv4 and IPv6.
3
Link 2
• Network: [Link]/16
Link State Concepts •
•
IP address:
Type of network:
[Link]
Serial
• Cost of that link: 20
Link 1 • Neighbors: R2
• Network: [Link]/16
• IP address: [Link] Link 3
• Type of network: Ethernet • Network: [Link]/16
• Cost of that link: 2 • IP address: [Link]
• Neighbors: None • Type of network: Serial
• Cost of that link: 5
• Neighbors: R3
Link states - Information about the state of a router’s links
Link 4
This information includes interface’s: • Network: [Link]/16
IP address/mask • IP address: [Link]
Type of network • Type of network: Serial
Ethernet (broadcast) or serial point-to-point link • Cost of that link: 20
• Neighbors: R4
Cost of that link
Any neighbor routers on that link
4
Link State Concepts
5
R1 Processes the LSPs from R2
Red: New
information
for tree.
The SPF algorithm begins by processing the following LSP information from R2:
Connected to neighbor R1 on network [Link]/16, cost of 20
Connected to neighbor R5 on network [Link]/16, cost of 10
Has a network [Link]/16, cost of 2 6
SPF Tree
7
Network [Link]/16
Determining the via R2 Serial 0/0/0 2
Shortest Path at a cost of 22
20
8
Generating a Routing Table from the SPF Tree
SPF Tree for R1
These paths listed previously can now be added to the routing table.
The routing table will also include
Directly connected networks
Routes from any other sources, such as static routes.
Packets will now be forwarded according to these entries in the routing
table.
9
OSPF packet types
10
Hello [Link] [Link]
Establishing
Hello [Link]
Adjacencies Down
Init
2-way Down
Init
2-way
Hello [Link]
13
Basic OSPF Configuration
OSPF Reference Topology
15
Neighbor Hello, I’m
Establishment, R2
OSPF Hello and
Dead Intervals Hello, I’m
Hello, I’m
R3
R1
More later
Before an OSPF router can flood its link states, must discover neighbors.
Before two routers can form an OSPF neighbor adjacency, they must agree on three
values:
Hello interval
Dead interval
Network type
MTU
Both the interfaces must be part of the same network, including having the same subnet mask.16
Hello Intervals Hello, I’m
R2
Hello, I’m
Hello, I’m
R3
R1
Hello, I’m
Hello, I’m
R3
R1
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. 18
The router ospf Command
R1(config)# router ospf 10
R1(config-router)#
The process-id
Between 1 and 65,535
Chosen by the network administrator.
Locally significant:
Does not have to match other OSPF routers.
This differs from EIGRP.
We are using the same process ID simply for consistency.
19
OSPF Router ID
What’s my
Router ID?
What’s my
Router ID?
Cisco routers derive the router ID based on three criteria and with the following
precedence:
1. 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.
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.
21
Define the Router ID
Assign a specific router ID to the router.
Router(config)# router ospf process-id
Router(config-router)# router-id ip-address
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.
26
The network Command
Router(config-router)# network network-address wildcard-mask area area-id
[Link]
- [Link] Subtract the subnet mask
---------------
0. 0. 0. 15 Wildcard mask
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
mask format. 27
The network Command
Router(config-router)# network network-address wildcard-mask area area-id
28
Advertising
OSPF Networks
37
Configuring Passive
Interfaces on R1 & R2
[Link]
DROther DROther
DROthers only form full adjacencies with the DR and BDR in the network.
send their LSAs to the DR and BDR, multicast address [Link] (ALLDRouters)
R1 sends LSAs to the DR (The BDR listens, too.)
The DR is responsible for forwarding the LSAs from R1 to all other routers.
DR uses the multicast address [Link] (AllSPFRouters, all OSPF routers).
Only one router doing all the flooding. 43
44
45
46
DR/BDR Election
BDR
DROther DR
The following criteria are applied:
1. DR: Router with the highest OSPF interface priority.
2. BDR: Router with the second highest OSPF interface priority.
3. If OSPF interface priorities are equal, the highest router ID is used to break the
tie.
Default OSPF interface priority is 1.
Current configuration, the OSPF router ID is used to elect the DR and BDR. 47
Verifying Router States
RouterA# show ip ospf interface fastethernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address [Link]/24, Area 0
Process ID 1, Router ID [Link], Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DROTHER, Priority 1
Designated Router (ID) [Link], Interface address [Link]
Backup Designated router (ID) [Link], Interface address [Link]
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
<output omitted>
48
Router(config-if)# ip ospf priority {0 - 255}
Control the election of these routers with the ip ospf priority interface
command.
Priority (Highest priority wins):
0 = Cannot become DR or BDR
1 = Default
Therefore, the router ID determines the DR and BDR.
Priorities are an interface-specific value, they provide better control of the
OSPF multiaccess networks.
They also allow a router to be the DR in one network and a DROther in
another.
49
OSPF Interface Priority
RouterA# show ip ospf interface fastethernet 0/0
FastEthernet0/0 is up, line protocol is up
Internet Address [Link]/24, Area 0
Process ID 1, Router ID [Link], Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State DROTHER, Priority 1
Designated Router (ID) [Link], Interface address [Link]
Backup Designated router (ID) [Link], Interface address
[Link]
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
<output omitted>
The OSPF interface priority can be viewed using the show ip ospf
interface command.
50
After doing a shutdown and a
Highest priority wins no shutdown on the Fast
Ethernet 0/0 interfaces of all
Pri = 100
three routers, we see the result
of the change of OSPF
interface priorities.
Pri = 200
The OSPF metric is called cost. The following passage is from RFC 2328:
A cost is associated with the output side of each router interface. This cost is
configurable by the system administrator. The lower the cost, the more likely the
interface is to be used to forward data traffic.
RFC 2328 does not specify which values should be used to determine the cost.
54
OSPF Metric
In Mb/s
Cost = 647
Source Destination
1 2 3
IPv4
IPv4
IPv4 Packet Packet IPv4 Packet
Packet
IPv4
• IPv4 requires that every link have a IPv4
Packet
Packet
minimum MTU of 68 bytes.
IPv4
• Every internet destination must be able to IPv4
Packet
receive a packet of 576 bytes either in Packet
one piece or in fragments to be
reassembled.
IP MTU
Router(config)# interface fa 0/2
Router(config-if)# ip mtu 1400
Router(config-if)# ipv6 mtu 1400
66
Multi-Area OSPF
Internal: Routers with all their interfaces within the same area
Backbone: Routers with at least one interface connected to area 0
ASBR: (Autonomous System Boundary Router): Routers that have at least one
interface connected to an external internetwork (another autonomous system)
ABR: (Area Border Router): Routers with interfaces attached to multiple areas. 67
Single Area OSPF
In single area OSPF, all routers are in area 0.
Area 0 is also called the backbone area.
R1 R2
68
Issues With a Large OSPF Area
R1 R2
R1 R2
R1 R2
My SPF algorithm is
running too often for me to
route properly.
71
Multi-Area OSPF
Multiarea OSPF uses a two-layer area hierarchy using a
backbone area interconnecting regular areas.
Useful in larger network deployments to reduce processing
and memory overhead.
Area 1 Area 0 Area 51
R1 R2
All regular areas must interconnect to the backbone area (area 0).
Interconnecting routers are called Area Border Routers (ABR).
72
Backbone (Transit) Area
OSPF area whose primary function is the fast and efficient
movement of IP packets.
Backbone areas interconnect with other OSPF area types.
Generally, end users are not found within a backbone area.
R1 R2
R1 R2
74
Multiarea OSPF Advantages
Area 1 Area 0 Area 51
R1 R2
R1 R2
Link fails
Routers in areas 0 and 1 do not need the run the SPF algorithm.
76
Cisco OSPF Implementation Guidelines
R1 R2
This is a router that has all of its interfaces in the same area.
Internet
R1 R2
78
Backbone Routers
Backbone router have at least one interface in Area 0.
This is a router with an interface(s) in the backbone area.
Internet
R1 R2
79
Area Border Router (ABR)
Internet
R1 R2
ABRs:
Maintain separate LSDBs for each area it is connected to.
Are exit points for the area.
Distribute the routing information into the backbone and the
backbone routers then forward the information to the other ABRs. 80
Autonomous System Boundary Router (ASBR)
This is a router that has at least one interface attached to an
external non-OSPF network.
Internet
R1 R2
81
Configuring Basic Multi-Area
OSPF
OSPF Multiarea OSPF Topology
[Link]/24
Area 0
G0/0 .1
R2
.2 S0/0/0 S0/0/1 .5
[Link]/30 [Link]/30
.1 S0/0/0 S0/0/1 .6
R1 R3
.1 G0/0 G0/1 .1 .1 G0/0 G0/1 .1
[Link]/24 [Link]/24 [Link]/24 [Link]/24
Area 1 Area 2
83
Configuring Multiarea OSPF on R1
84
Configuring Multiarea OSPF on R2
85
Configuring Multiarea OSPF on R3
G0/0 :1
LLA: FE80::2
R2 :1 S0/0/1
:2 S0/0/0
[Link]/64 [Link]/64
:1 S0/0/0 :2 S0/0/1
LLA: FE80::1 LLA: FE80::3
Area 1 R1 R3
Area 2 G0/0 :1
G0/0 :1
[Link]/64 [Link]/64
87
Configuring Multiarea OSPFv3 on R1
*Apr 24 [Link].463:
%OSPFv3-4-NORTRID: Process
OSPFv3-10-IPv6 could not
pick a router-id, please
configure manually
eedd
iizz AA
aarr SS
mm LL
mm ee33
SSuu yypp
TT
eedd
iizz AA
aarr SS
mm LL
mm ee33
SSuu yypp
TT
Summarized
Summarized Summarized
Summarized
Type
Type 33 LSA
LSA Type
Type 33 LSA
LSA
Propagating a Summary Route
iz A
a S
ed
m 3L
r
e
Su yp
T
m
OSPF Route Summarization Topology
[Link]/24
Area 0
G0/0 .1 [Link]/27
.225 .226 EIGRP
R2 Lo0
([Link] /24
.2 S0/0/0 S0/0/1 .5 – [Link]/24)
[Link]/30 [Link]/30
.1 S0/0/0 S0/0/1 .6
R1 R3
.1 G0/0 G0/1 .1 .1 G0/0 G0/1 .1
[Link]/24 [Link]/24 [Link]/24 [Link]/24
Area 1 Area 2
94
Interarea Route Summarization
[Link]/24
Area 0
G0/0 .1 [Link]/27
.225 .226 EIGRP
S
y
an SA R2 Lo0
ro um
ut m
([Link] /24
m L .2 S0/0/0 S0/0/1 .5 es a – [Link]/24)
ize one
[Link]/30 in rize
[Link]/30
r to
a
m nto on ma
m i e ny
LS
Su tes A
u
ro .1 S0/0/0 S0/0/1 .6
R1 R3
.1 G0/0 G0/1 .1 .1 G0/0 G0/1 .1
[Link]/24 [Link]/24 [Link]/24 [Link]/24
Area 1 Area 2
95
External Route Summarization
[Link]/24
Area 0
G0/0 .1 [Link]/27
l .225 .226 EIGRP
r na A R2 Su ([Link] /24
te S Lo0 rou mm
ex e L .2 S0/0/0 S0/0/1 .5 tes ari – [Link]/24)
ze n
[Link]/30 ze
in192.168.10.4/30
ari to o to ext
on e
mm s in e rna
Su ute L
SA l
ro .1 S0/0/0 S0/0/1 .6
R1 R3
.1 G0/0 G0/1 .1 .1 G0/0 G0/1 .1
[Link]/24 [Link]/24 [Link]/24 [Link]/24
Area 1 Area 2
96
R1 Routing Table Before Summarization
[Link] 00001010.00000001.00000000.00000000
[Link] 11111111.11111111.11111100.00000000
/22
[Link]/22 or [Link] [Link] 99
Summarizing Area 1 Routes on R1
te
rou
y
ar 2
m 0/2
m .
su .1.0
d
n 10
Se
100
R1 Routing Table After Summarization
102
Summarizing Area 2 Routes on R3
Se
nd
19 sum
2.
16 ma
8. ry
0.
0 r ou
/2 te
2
103
Verifying OSPF Status on R1
R1# show ip protocols
*** IP Routing is NSF aware ***
105
Verifying OSPF Routes on R1
Spring 2015