Infrastructure · Topic 6 of 13
Configuring OSPFv2 and OSPFv3
Configure OSPFv2 and OSPFv3 with multiple areas, network types, DR election, passive interfaces, ABR summaries and filters, and verify adjacency.
- 6 min
- The
networkcommand uses a wildcard mask, and it places interfaces in areas. - An ABR has interfaces in more than one area, and one of them is area 0.
- Neighbours must agree on area, timers, subnet and authentication.
What it is
OSPF configuration builds neighbour relationships inside areas and controls which routes cross area borders.
You choose which interfaces take part, which area each belongs to and which network type each uses. Then you add summaries and filters at the area border routers. OSPFv2 carries IPv4, and OSPFv3 carries IPv6, and both use the same ideas.
How it works
Start with the process and the areas, then adjust interface behaviour.
Basic OSPFv2 with multiple areas
R2(config)# router ospf 1
R2(config-router)# router-id 2.2.2.2
R2(config-router)# network 10.0.0.0 0.0.0.255 area 0
R2(config-router)# network 10.1.0.0 0.0.255.255 area 1
R2(config-router)# passive-interface GigabitEthernet0/2
The network command uses a wildcard mask. It enables OSPF on every interface whose address falls inside it, and places that interface in the area. A router with interfaces in two areas is an Area Border Router (ABR), and it must have an interface in area 0.
You can also enable OSPF directly on the interface, which avoids wildcard masks:
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ip ospf 1 area 1
The command passive-interface stops hello packets on an interface. The network is still advertised, but no neighbour forms. It is used on LAN ports that face users.
Adjacency and network types
Two routers become neighbours only when their settings agree. The area ID, hello and dead timers, subnet and authentication must match. Neighbours move through the states Down, Init, 2-Way, ExStart, Exchange, Loading and Full.
| Network type | DR and BDR | Default timers | Where used |
|---|---|---|---|
| Broadcast | Yes | Hello 10, dead 40 | Ethernet LANs |
| Point to point | No | Hello 10, dead 40 | Serial links, routed links |
On a broadcast network, routers elect a Designated Router (DR) and a Backup DR. The DR gathers and sends out the updates for the segment.
The election picks the highest priority, then the highest router ID. It is not pre-emptive, so a router joining later does not take over.
On a link that has only two routers, a DR is a waste. Set the network type to point to point, and the adjacency forms faster with no election.
R2(config-if)# ip ospf network point-to-point
R2(config-if)# ip ospf priority 0
A priority of 0 means the router never becomes the DR or BDR.
Verifying adjacency
R2# show ip ospf neighbor
R2# show ip ospf interface brief
R2# show ip route ospf
R2# show ip ospf database
show ip ospf neighbor should show FULL with a role of DR, BDR or - on point to point links. On a broadcast segment, two routers that are neither DR nor BDR stay in 2WAY with each other, which is normal.
Summarisation
OSPF summarises at area borders, so routers in other areas see one route instead of many.
R2(config)# router ospf 1
R2(config-router)# area 1 range 10.1.0.0 255.255.0.0
R2(config-router)# summary-address 172.16.0.0 255.255.0.0
The area range command runs on an ABR, and it summarises routes from that area into the others. The summary-address command runs on an ASBR, and it summarises external routes that the router redistributes. You can add not-advertise to an area range to hide the covered routes entirely.
Filtering
You can filter routes between areas on the ABR with a prefix list.
R2(config)# ip prefix-list BLOCK seq 5 deny 10.1.5.0/24
R2(config)# ip prefix-list BLOCK seq 10 permit 0.0.0.0/0 le 32
R2(config)# router ospf 1
R2(config-router)# area 1 filter-list prefix BLOCK out
The keyword out filters routes leaving area 1, as in this example, and in filters routes entering it. A distribute-list can also stop routes going into the routing table of one router, but the link state database stays unchanged, so other routers still learn them.
OSPFv3 for IPv6
OSPFv3 enables the protocol on interfaces. It still needs a 32 bit router ID in dotted form, which you set by hand if the router has no IPv4 address.
R2(config)# ipv6 unicast-routing
R2(config)# ipv6 router ospf 1
R2(config-rtr)# router-id 2.2.2.2
R2(config)# interface GigabitEthernet0/1
R2(config-if)# ipv6 ospf 1 area 1
On IOS XE, newer software also has the address family form, which starts with router ospfv3 1. It uses address-family ipv6 unicast and then the interface command ospfv3 1 ipv6 area 1. Neighbours in OSPFv3 use link local addresses.
R2# show ipv6 ospf neighbor
R2# show ipv6 route ospf
What to remember for the exam
Eight facts cover most questions on this topic.
- The
networkcommand uses a wildcard mask, and it places interfaces in areas. - An ABR has interfaces in more than one area, and one of them is area 0.
- Neighbours must agree on area, timers, subnet and authentication.
- Broadcast links elect a DR and BDR, and point to point links do not.
- The DR election uses priority first, then router ID, and it is not pre-emptive.
passive-interfacestops hellos, so no neighbour forms.area rangesummarises on an ABR.summary-addresssummarises external routes on an ASBR.- OSPFv3 uses
ipv6 ospf PROCESS area Non interfaces, and needs a router ID.
A neighbour stuck in 2WAY between two non DR routers on a LAN is normal. Look at the neighbour with the DR instead.
Common mistakes
These four mistakes appear often.
Using a subnet mask in the network command. It needs a wildcard mask.
Forgetting the area 0 link. Every area must reach the backbone, normally through an ABR.
Making an uplink passive. The neighbour will not form.
Filtering with a distribute list and expecting all routers to follow. It changes only the local routing table.
Mismatched hello or dead timers will stop an adjacency, so check them when a neighbour never reaches Full.
Check yourself
Work through these three questions.
What does an OSPF ABR need in its configuration?
It needs interfaces in at least two areas, and one of them must be area 0.
Which command summarises routes from area 1 into other areas on an ABR?
area 1 rangefollowed by the prefix and mask, entered underrouter ospf.What is the effect of
passive-interfacein OSPF?It stops hellos on the interface, so no neighbour forms, but the network is still advertised.
Topic 6 of 13 in Infrastructure
Test yourself on Infrastructure
The full Cisco CCNP 350-401 ENCOR question bank has 854 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.