Open Shortest Path First (OSPF) is a link-state routing protocol. Instead of sending routes to its neighbors, each router describes its own links in link-state advertisements (LSAs) and floods them to every router in the area. As a result, every router in an area has an identical link-state database (LSDB), and each router runs the shortest path first (SPF) algorithm on that database to calculate its own best paths. OSPF uses IP protocol 89 and sends hellos to 224.0.0.5. On multi-access networks, the designated router (DR) and backup designated router (BDR) also listen on 224.0.0.6. OSPFv2 (RFC 2328) carries IPv4, and OSPFv3 (RFC 5340) was designed for IPv6 and later extended to carry IPv4 as well. OSPF is an open standard supported by practically every vendor, which makes it the usual choice for an interior gateway protocol in multi-vendor networks.
OSPF uses areas to limit how far detailed topology information travels. Routers inside an area know every router and link in that area, but they only receive prefix information about other areas. Every non-backbone area must connect to Area 0, the backbone, and the routers that connect them are called area border routers (ABRs).
In this lab, we'll build a three-area OSPFv2 network, redistribute an external route, turn one area into a totally stubby area, summarize and filter routes at an ABR, and finally run OSPFv3 for both IPv6 and IPv4 on the same topology. Every output in this article comes from the lab itself.
Topology
The topology has eight IOSv routers in three areas. R1, R2, R3, and R4 form the backbone. R3 connects Area 1 (R5 and R6), and R4 connects Area 2 (R7 and R8), which makes both of them ABRs. R1 becomes an autonomous system boundary router (ASBR) in Task 2, when it redistributes a static route into OSPF.
Every physical interface in IOSv is Gigabit Ethernet, so I set bandwidth 100000 on both ends of the R2–R3 link to make it look like Fast Ethernet.
| Link | Area | IPv4 subnet | IPv6 subnet | Link type |
|---|---|---|---|---|
| R1–R2 | 0 | 10.0.12.0/24 | 2001:db8:100:12::/64 | Gigabit |
| R2–R3 | 0 | 10.0.23.0/24 | 2001:db8:100:23::/64 | Fast Ethernet-like |
| R2–R4 | 0 | 10.0.24.0/24 | 2001:db8:100:24::/64 | Gigabit |
| R3–R4 | 0 | 10.0.34.0/24 | 2001:db8:100:34::/64 | Gigabit |
| R3–R5 | 1 | 10.1.35.0/24 | 2001:db8:100:135::/64 | Gigabit |
| R5–R6 | 1 | 10.1.56.0/24 | 2001:db8:100:156::/64 | Gigabit |
| R4–R7 | 2 | 10.2.47.0/24 | 2001:db8:100:247::/64 | Gigabit |
| R7–R8 | 2 | 10.2.78.0/24 | 2001:db8:100:278::/64 | Gigabit |
Every router has a Loopback0. R1 to R4, R7, and R8 use addresses that match their number, such as 1.1.1.1/32. R5 and R6 use 10.1.5.5/32 and 10.1.6.6/32 instead, so that they fit inside the Area 1 summary in Task 4. R1 also has Loopback1 (10.0.99.99/32), which we'll filter in Task 4, and a static route for 198.51.100.0/24 which we'll redistribute in Task 2. Loopback2 on every router is used in Task 6.
Task 1: Configure Multi-Area OSPFv2
Objective: Configure OSPFv2 process 1 on all eight routers, place each link and loopback in the correct area, and identify the ABRs and the LSA types in the database.
Configuration
R3 is a good example because it's an ABR. Its Gi0/0 and Gi0/1 links are in Area 0, while Gi0/2 is in Area 1:
configure terminalrouter ospf 1 router-id 3.3.3.3 auto-cost reference-bandwidth 1000 passive-interface Loopback0 network 3.3.3.3 0.0.0.0 area 0 network 10.0.23.0 0.0.0.255 area 0 network 10.0.34.0 0.0.0.255 area 0 network 10.1.35.0 0.0.0.255 area 1endEvery router gets the same router-id, auto-cost reference-bandwidth 1000, and passive-interface Loopback0 lines, with its own router ID and network statements:
| Router | Router ID | network statements |
|---|---|---|
| R1 | 1.1.1.1 | 1.1.1.1 0.0.0.0, 10.0.99.99 0.0.0.0, 10.0.12.0 0.0.0.255, all area 0 (Loopback1 is also passive) |
| R2 | 2.2.2.2 | 2.2.2.2 0.0.0.0, 10.0.12.0 0.0.0.255, 10.0.23.0 0.0.0.255, 10.0.24.0 0.0.0.255, all area 0 |
| R4 | 4.4.4.4 | 4.4.4.4 0.0.0.0, 10.0.24.0 0.0.0.255, 10.0.34.0 0.0.0.255 in area 0, 10.2.47.0 0.0.0.255 in area 2 |
| R5 | 5.5.5.5 | 10.1.5.5 0.0.0.0, 10.1.35.0 0.0.0.255, 10.1.56.0 0.0.0.255, all area 1 |
| R6 | 6.6.6.6 | 10.1.6.6 0.0.0.0, 10.1.56.0 0.0.0.255, all area 1 |
| R7 | 7.7.7.7 | 7.7.7.7 0.0.0.0, 10.2.47.0 0.0.0.255, 10.2.78.0 0.0.0.255, all area 2 |
| R8 | 8.8.8.8 | 8.8.8.8 0.0.0.0, 10.2.78.0 0.0.0.255, all area 2 |
The 1 in router ospf 1 is the OSPF process ID. Unlike the EIGRP autonomous system number, it is locally significant and does not need to match between neighbors. A router could even run several OSPF processes with different IDs. What does need to match is the area: both ends of a link must be in the same area.
The network command works the same way as in EIGRP. IOS compares each interface address against the address and wildcard mask, and enables OSPF on every interface that matches. The difference is the area at the end, which places the matching interface in that area. This is how R3 ends up with interfaces in two areas. Instead of network statements, OSPF can also be enabled directly on an interface with ip ospf 1 area 0.
The router ID identifies the router in the LSDB, so every router in the OSPF domain needs a unique one. If it isn't configured manually, IOS uses the highest IP address on a loopback interface, or the highest address on an active physical interface if there are no loopbacks. On R4, that would be 172.16.4.4 from Loopback2 instead of 4.4.4.4, so setting it explicitly keeps the outputs readable.
passive-interface Loopback0 still advertises the loopback's prefix, but the router doesn't send hellos out of it. A loopback can never have a neighbor, so there is no reason to send hellos there. The same command is commonly used on LAN interfaces facing end hosts.
The OSPF cost of an interface is the reference bandwidth divided by the interface bandwidth. The default reference bandwidth is 100 Mbps, which gives a Fast Ethernet link a cost of 100 / 100 = 1. A Gigabit link would be 100 / 1000 = 0.1, but the cost can't go below 1, so it also ends up as 1. OSPF can't tell the two apart. With auto-cost reference-bandwidth 1000, a Gigabit link costs 1000 / 1000 = 1 and the 100 Mbps R2–R3 link costs 1000 / 100 = 10. IOS reminds you that the value has to be the same on every router:
R3(config-router)#auto-cost reference-bandwidth 1000% OSPF: Reference bandwidth is changed. Please ensure reference bandwidth is consistent across all routers.If one router uses a different reference bandwidth, it calculates its costs on a different scale, and the routers can end up making inconsistent routing decisions.
Neighbor states
Before two routers become fully adjacent, they go through several neighbor states. In the CBT Nuggets OSPF lessons, Keith Barker uses two mnemonics that make this easy to remember.
IT-ELF, an elf that works in IT, is the order of the states:
- Init: the router has received a hello from the neighbor.
- Two-way: the neighbor's hello lists our router ID, so communication works in both directions. On multi-access networks, the DR and BDR are elected here.
- ExStart and Exchange: the routers decide which one starts the exchange, then describe their LSDBs to each other with database description (DBD) packets.
- Loading: each router requests the LSAs it's missing with link-state requests and receives them in link-state updates.
- Full: the LSDBs are synchronized.
STTAMP, like stamp with two Ts, lists what has to match for two routers to become neighbors: Subnet, Timers (hello and dead), network Type, Area, MTU, and Password (authentication).
To see the states, I added log-adjacency-changes detail under R2's OSPF process, which logs every state change instead of only the final one. This is R2's adjacency with R1:
R2# show logging | include Process 1, Nbr 1.1.1.1*Nov 10 09:06:56.579: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from DOWN to INIT, Received Hello*Nov 10 09:07:05.179: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from INIT to 2WAY, 2-Way Received*Nov 10 09:07:35.189: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from 2WAY to EXSTART, AdjOK?*Nov 10 09:07:40.042: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from EXSTART to EXCHANGE, Negotiation Done*Nov 10 09:07:40.058: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from EXCHANGE to LOADING, Exchange Done*Nov 10 09:07:40.078: %OSPF-5-ADJCHG: Process 1, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading DoneThe neighbor stays in 2WAY for 30 seconds. On a broadcast network, a router waits for the wait timer (40 seconds by default, counted from when OSPF was enabled on the interface) before the DR/BDR election, so it doesn't elect itself before the other routers on the segment have had a chance to show up. Once the DR and BDR were known, the rest of the process took about 5 seconds.
R1's interface shows the values that STTAMP refers to:
R1# show ip ospf interface GigabitEthernet0/0GigabitEthernet0/0 is up, line protocol is up Internet Address 10.0.12.1/24, Area 0, Attached via Network Statement Process ID 1, Router ID 1.1.1.1, Network Type BROADCAST, Cost: 1 Topology-MTID Cost Disabled Shutdown Topology Name 0 1 no no Base Transmit Delay is 1 sec, State BDR, Priority 1 Designated Router (ID) 2.2.2.2, Interface address 10.0.12.2 Backup Designated router (ID) 1.1.1.1, Interface address 10.0.12.1 Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5...On Ethernet, the default network type is broadcast, even though OSPF actually uses multicast to reach its neighbors. Both routers have the default priority of 1, so the higher router ID wins the DR election: R2 (2.2.2.2) is the DR and R1 is the BDR.
Verification
R2# show ip ospf neighborNeighbor ID Pri State Dead Time Address Interface4.4.4.4 1 FULL/DR 00:00:38 10.0.24.4 GigabitEthernet0/23.3.3.3 1 FULL/DR 00:00:38 10.0.23.3 GigabitEthernet0/11.1.1.1 1 FULL/BDR 00:00:37 10.0.12.1 GigabitEthernet0/0R2 is fully adjacent with R1, R3, and R4. The role after the slash is the neighbor's role on that link.
R2# show ip ospf interface briefInterface PID Area IP Address/Mask Cost State Nbrs F/CLo0 1 0 2.2.2.2/32 1 LOOP 0/0Gi0/2 1 0 10.0.24.2/24 1 BDR 1/1Gi0/1 1 0 10.0.23.2/24 10 BDR 1/1Gi0/0 1 0 10.0.12.2/24 1 DR 1/1Gi0/1 toward R3 has a cost of 10, and every Gigabit interface has a cost of 1.
R3 confirms that it's an ABR:
R3# show ip ospf | include area border|Area|interfaces in this area It is an area border router Area BACKBONE(0) Number of interfaces in this area is 3 (1 loopback) Area 1 Number of interfaces in this area is 1LSA types
The LSDB is built from different types of LSAs. These are the ones we'll see in this lab:
| Type | Name | Originated by | What it describes |
|---|---|---|---|
| 1 | Router | Every router | The router's own links in one area |
| 2 | Network | The DR | A multi-access segment and the routers attached to it |
| 3 | Summary | An ABR | A prefix from another area |
| 4 | ASBR summary | An ABR | How to reach an ASBR in another area |
| 5 | AS external | An ASBR | A route redistributed into OSPF |
Types 1 and 2 never leave their area. To pass routing information between areas, the ABR originates Type 3 LSAs, so routers in other areas only learn the prefix and the ABR's cost to reach it, not the topology behind it.
R2's database shows the first three types:
R2# show ip ospf database OSPF Router with ID (2.2.2.2) (Process ID 1) Router Link States (Area 0)Link ID ADV Router Age Seq# Checksum Link count1.1.1.1 1.1.1.1 18 0x80000002 0x00AF54 32.2.2.2 2.2.2.2 14 0x80000003 0x00B666 43.3.3.3 3.3.3.3 15 0x80000003 0x002E0C 34.4.4.4 4.4.4.4 19 0x80000002 0x0033FF 3 Net Link States (Area 0)Link ID ADV Router Age Seq# Checksum10.0.12.2 2.2.2.2 17 0x80000001 0x00BE4F10.0.23.3 3.3.3.3 20 0x80000001 0x00718410.0.24.4 4.4.4.4 19 0x80000001 0x00608B10.0.34.4 4.4.4.4 19 0x80000001 0x0024B9 Summary Net Link States (Area 0)Link ID ADV Router Age Seq# Checksum7.7.7.7 4.4.4.4 15 0x80000001 0x00E12D8.8.8.8 4.4.4.4 5 0x80000001 0x00BD4C10.1.5.5 3.3.3.3 16 0x80000001 0x004BCE10.1.6.6 3.3.3.3 6 0x80000001 0x0040D610.1.35.0 3.3.3.3 55 0x80000001 0x0028D910.1.56.0 3.3.3.3 16 0x80000001 0x004AA110.2.47.0 4.4.4.4 54 0x80000001 0x00797710.2.78.0 4.4.4.4 15 0x80000001 0x002DA3- Router LSAs: one from each of the four routers in Area 0.
- Network LSAs: one per link, originated by the DR of that link. The Link ID is the DR's interface address, so
10.0.12.2is R2's address on the R1–R2 link. - Summary LSAs: R3 advertises the Area 1 prefixes and R4 the Area 2 prefixes. R2 doesn't know anything about the links or routers inside those areas, only the prefixes and the cost to reach them through the ABR.
Why R2 goes through R4
OSPF cost is cumulative: every outgoing interface along the path adds its cost, including the cost of the destination's interface. R3's loopback is directly connected to R2's neighbor, but R2 doesn't use that link:
R2# show ip route 3.3.3.3Routing entry for 3.3.3.3/32 Known via "ospf 1", distance 110, metric 3, type intra area Last update from 10.0.24.4 on GigabitEthernet0/2, 00:00:06 ago Routing Descriptor Blocks: * 10.0.24.4, from 3.3.3.3, 00:00:06 ago, via GigabitEthernet0/2 Route metric is 3, traffic share count is 1The direct path costs 10 + 1 = 11, while the path through R4 costs 1 + 1 + 1 = 3, even though it has one more hop. The same applies to everything behind R3: R2 reaches all of the Area 1 prefixes through R4.
R2# show ip route ospf 1.0.0.0/32 is subnetted, 1 subnetsO 1.1.1.1 [110/2] via 10.0.12.1, 00:00:05, GigabitEthernet0/0 3.0.0.0/32 is subnetted, 1 subnetsO 3.3.3.3 [110/3] via 10.0.24.4, 00:00:05, GigabitEthernet0/2 4.0.0.0/32 is subnetted, 1 subnetsO 4.4.4.4 [110/2] via 10.0.24.4, 00:00:05, GigabitEthernet0/2 7.0.0.0/32 is subnetted, 1 subnetsO IA 7.7.7.7 [110/3] via 10.0.24.4, 00:00:05, GigabitEthernet0/2 8.0.0.0/32 is subnetted, 1 subnetsO IA 8.8.8.8 [110/4] via 10.0.24.4, 00:00:04, GigabitEthernet0/2 10.0.0.0/8 is variably subnetted, 14 subnets, 2 masksO 10.0.34.0/24 [110/2] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O 10.0.99.99/32 [110/2] via 10.0.12.1, 00:00:05, GigabitEthernet0/0O IA 10.1.5.5/32 [110/4] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O IA 10.1.6.6/32 [110/5] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O IA 10.1.35.0/24 [110/3] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O IA 10.1.56.0/24 [110/4] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O IA 10.2.47.0/24 [110/2] via 10.0.24.4, 00:00:05, GigabitEthernet0/2O IA 10.2.78.0/24 [110/3] via 10.0.24.4, 00:00:05, GigabitEthernet0/2Routes inside the same area are marked O, and routes learned from Type 3 LSAs are marked O IA (inter-area). OSPF has an administrative distance of 110.
Finally, R1 can reach R8 in Area 2:
R1# ping 8.8.8.8 source Loopback0Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:Packet sent with a source address of 1.1.1.1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/13/15 msTask 2: Redistribute an External Route
Objective: Redistribute R1's static route for 198.51.100.0/24 into OSPF, and identify the ASBR, the Type 4 and Type 5 LSAs, and the O E2 route.
Configuration
On R1:
configure terminalrouter ospf 1 redistribute static subnetsendR1 already has a static route for 198.51.100.0/24 pointing to Null0, so this command introduces one external prefix without changing the topology. Any router that redistributes routes into OSPF is an ASBR:
R1# show ip ospf | include boundary It is an autonomous system boundary routerThe subnets keyword tells IOS to redistribute subnets, not only classful networks. On older IOS versions, redistribute static without it would only include routes with their classful mask. On this IOSv image, entering just redistribute static also results in redistribute static subnets in the running configuration.
Verification
R8 learns the route as an O E2 route:
R8# show ip route 198.51.100.0Routing entry for 198.51.100.0/24 Known via "ospf 1", distance 110, metric 20, type extern 2, forward metric 4 Last update from 10.2.78.7 on GigabitEthernet0/0, 00:00:08 ago Routing Descriptor Blocks: * 10.2.78.7, from 1.1.1.1, 00:00:08 ago, via GigabitEthernet0/0 Route metric is 20, traffic share count is 1External routes come in two types. For an E2 route, the metric is the seed metric set by the ASBR, which is 20 by default (1 for routes redistributed from BGP), and it stays 20 no matter how far away the ASBR is. The forward metric 4 is R8's own cost to reach R1 (1 + 1 + 1 + 1), which is only used as a tiebreaker when the same external route is learned with the same E2 metric. For an E1 route, the internal cost to the ASBR is added to the external metric, so R8 would see a metric of 24. E2 is the default.
The route comes from a Type 5 LSA that R1 floods through the whole OSPF domain:
R8# show ip ospf database external OSPF Router with ID (8.8.8.8) (Process ID 1) Type-5 AS External Link States LS age: 21 Options: (No TOS-capability, DC, Upward) LS Type: AS External Link Link State ID: 198.51.100.0 (External Network Number ) Advertising Router: 1.1.1.1 LS Seq Number: 80000001 Checksum: 0xFA43 Length: 36 Network Mask: /24 Metric Type: 2 (Larger than any link state path) MTID: 0 Metric: 20 Forward Address: 0.0.0.0 External Route Tag: 0The Type 5 LSA only says that the route is reachable through the router with the ID 1.1.1.1. R8 doesn't have R1's Router LSA, because Type 1 LSAs stay in Area 0. This is what the Type 4 LSA is for: R4, the ABR, tells Area 2 how to reach the ASBR:
R8# show ip ospf database asbr-summary OSPF Router with ID (8.8.8.8) (Process ID 1) Summary ASB Link States (Area 2) LS age: 15 Options: (No TOS-capability, DC, Upward) LS Type: Summary Links(AS Boundary Router) Link State ID: 1.1.1.1 (AS Boundary Router address) Advertising Router: 4.4.4.4 LS Seq Number: 80000001 Checksum: 0xE83D Length: 28 Network Mask: /0 MTID: 0 Metric: 2R4's cost to R1 is 2 (R4 to R2, then R2 to R1). R8 adds its own cost to R4 (2) and gets the forward metric of 4.
Task 3: Make Area 2 Totally Stubby
Objective: Configure Area 2 as a totally stubby area, and compare R8's LSDB and routing table before and after.
Right now, R8 has 20 LSAs and 16 OSPF routes. It knows about every prefix in the network, even though all of them are reachable through the same exit, R4.
Stub area types
A stub area doesn't accept external routes. The ABR blocks Type 4 and Type 5 LSAs and injects a default route as a Type 3 LSA instead. A totally stubby area goes one step further: the ABR also blocks the Type 3 LSAs, except for the default route. Only the ABR needs the no-summary keyword, because it's the ABR that decides which Type 3 LSAs to send into the area. The other routers only need to agree that the area is a stub.
Neither type allows an ASBR inside the area. If a router in the area needs to redistribute routes, the area has to be a not-so-stubby area (NSSA), where external routes are carried as Type 7 LSAs and converted to Type 5 by the ABR. Area 2 has no ASBR, so totally stubby is enough.
Configuration
On R4, the ABR:
configure terminalrouter ospf 1 area 2 stub no-summaryendOn R7 and R8:
configure terminalrouter ospf 1 area 2 stubendAll routers in the area have to agree that it's a stub. The stub setting is carried in the options field of every hello. When R4 is configured first, it resets its adjacency with R7:
R4# show logging | include 7.7.7.7*Nov 10 09:07:41.460: %OSPF-5-ADJCHG: Process 1, Nbr 7.7.7.7 on GigabitEthernet0/2 from LOADING to FULL, Loading Done*Nov 10 09:10:07.692: %OSPF-5-ADJCHG: Process 1, Nbr 7.7.7.7 on GigabitEthernet0/2 from FULL to DOWN, Neighbor Down: Adjacency forced to reset*Nov 10 09:10:47.041: %OSPF-5-ADJCHG: Process 1, Nbr 7.7.7.7 on GigabitEthernet0/2 from LOADING to FULL, Loading DoneUntil R7 is configured too, it ignores R4's hellos. With debug ip ospf hello running on R7:
*Nov 10 09:10:26.608: OSPF-1 HELLO Gi0/0: Rcv hello from 4.4.4.4 area 2 10.2.47.4*Nov 10 09:10:26.609: OSPF-1 HELLO Gi0/0: Hello from 10.2.47.4 with mismatched Stub/Transit area option bitThe adjacency comes back as soon as R7 agrees that Area 2 is a stub.
Verification
R8's LSDB is now much smaller:
R8# show ip ospf database OSPF Router with ID (8.8.8.8) (Process ID 1) Router Link States (Area 2)Link ID ADV Router Age Seq# Checksum Link count4.4.4.4 4.4.4.4 54 0x80000004 0x003F50 17.7.7.7 7.7.7.7 50 0x80000005 0x006A09 38.8.8.8 8.8.8.8 48 0x80000004 0x00C536 2 Net Link States (Area 2)Link ID ADV Router Age Seq# Checksum10.2.47.7 7.7.7.7 50 0x80000003 0x00B6F810.2.78.8 8.8.8.8 48 0x80000003 0x00F08A Summary Net Link States (Area 2)Link ID ADV Router Age Seq# Checksum0.0.0.0 4.4.4.4 94 0x80000001 0x0039F4The Type 1 and Type 2 LSAs inside Area 2 are unchanged. The 13 Type 3 LSAs were replaced by a single default route, and the Type 4 and Type 5 LSAs are gone. The routing table follows:
R8# show ip route ospf | begin GatewayGateway of last resort is 10.2.78.7 to network 0.0.0.0O*IA 0.0.0.0/0 [110/3] via 10.2.78.7, 00:00:44, GigabitEthernet0/0 7.0.0.0/32 is subnetted, 1 subnetsO 7.7.7.7 [110/2] via 10.2.78.7, 00:00:54, GigabitEthernet0/0 10.0.0.0/8 is variably subnetted, 3 subnets, 2 masksO 10.2.47.0/24 [110/2] via 10.2.78.7, 00:00:54, GigabitEthernet0/0The default route has a cost of 3: 1 to R7, 1 to R4, and 1 for the default route itself, which is the default value of area 2 default-cost. The specific external route is gone:
R8# show ip route 198.51.100.0% Network not in tableR8 can still reach everything outside the area through the default route:
R8# ping 1.1.1.1 source Loopback0Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:Packet sent with a source address of 8.8.8.8!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 9/11/13 msIf an area had two ABRs, both would inject a default route, and the routers inside would no longer know which ABR has the better path to a specific destination.
Task 4: Summarize and Filter at the Area 1 ABR
Objective: On R3, summarize the Area 1 prefixes as 10.1.0.0/16 toward Area 0, and prevent R1's 10.0.99.99/32 from being advertised into Area 1.
Before the change, R2 learns every Area 1 prefix separately:
R2# show ip route ospf | include 10.1O IA 10.1.5.5/32 [110/4] via 10.0.24.4, 00:03:57, GigabitEthernet0/2O IA 10.1.6.6/32 [110/5] via 10.0.24.4, 00:03:57, GigabitEthernet0/2O IA 10.1.35.0/24 [110/3] via 10.0.24.4, 00:03:57, GigabitEthernet0/2O IA 10.1.56.0/24 [110/4] via 10.0.24.4, 00:03:57, GigabitEthernet0/2Configuration
On R3:
configure terminalip prefix-list BLOCK-MGMT seq 5 deny 10.0.99.99/32ip prefix-list BLOCK-MGMT seq 10 permit 0.0.0.0/0 le 32router ospf 1 area 1 range 10.1.0.0 255.255.0.0 area 1 filter-list prefix BLOCK-MGMT inendOSPF can only summarize internal routes at area boundaries, because routers inside an area must have identical LSDBs. External routes can be summarized on the ASBR with summary-address. area 1 range tells R3 to advertise one Type 3 LSA for 10.1.0.0/16 into the other areas, instead of one for every Area 1 prefix inside that range. The summary is advertised as long as at least one prefix in Area 1 falls inside the range.
area 1 filter-list prefix BLOCK-MGMT in filters the Type 3 LSAs that R3 sends into Area 1. in means into the area. With out, it would filter the Type 3 LSAs created from Area 1 prefixes that R3 sends to the other areas.
The prefix list has two entries. seq 5 denies exactly 10.0.99.99/32. seq 10 permits everything else: 0.0.0.0/0 le 32 matches any prefix with a mask length between 0 and 32. Like an access list, a prefix list ends with an implicit deny, so without seq 10, R3 would block every Type 3 LSA going into Area 1.
The two commands work in opposite directions. The range controls what leaves Area 1, and the filter controls what enters it.
Verification
R2 now has a single route for Area 1:
R2# show ip route ospf | include 10.1O IA 10.1.0.0/16 [110/3] via 10.0.24.4, 00:00:11, GigabitEthernet0/2R2# show ip route 10.1.0.0Routing entry for 10.1.0.0/16 Known via "ospf 1", distance 110, metric 3, type inter area Last update from 10.0.24.4 on GigabitEthernet0/2, 00:00:11 ago Routing Descriptor Blocks: * 10.0.24.4, from 3.3.3.3, 00:00:11 ago, via GigabitEthernet0/2 Route metric is 3, traffic share count is 1The summary is originated by R3 (from 3.3.3.3), but R2 still reaches it through R4 for the same cost reason as in Task 1. R3 advertises the summary with a cost of 1, the same as its cheapest component route, the connected 10.1.35.0/24.
R3 also installs a route for the summary pointing to Null0:
R3# show ip route 10.1.0.0 255.255.0.0Routing entry for 10.1.0.0/16 Known via "ospf 1", distance 110, metric 1, type intra area Routing Descriptor Blocks: * directly connected, via Null0 Route metric is 1, traffic share count is 1This is a discard route. R3 advertises the whole 10.1.0.0/16, but only a few prefixes inside it actually exist. If R3 receives a packet for an address that doesn't exist, such as 10.1.200.1, the more specific routes don't match, so the packet would follow R3's default route if it had one, possibly back toward the backbone and into a loop. The Null0 route drops it instead.
R3# show ip ospf | begin Area 1 Area 1 Number of interfaces in this area is 1 Area has no authentication SPF algorithm last executed 00:00:11.491 ago SPF algorithm executed 5 times Area ranges are 10.1.0.0/16 Active(1) Advertise Area-filter BLOCK-MGMT in...Active(1) means that at least one component route exists and the summary is being advertised with a cost of 1.
In Area 1, R5 no longer has a route for 10.0.99.99, while R1's other loopback is still there:
R5# show ip route 10.0.99.99% Subnet not in tableR5# show ip route 1.1.1.1Routing entry for 1.1.1.1/32 Known via "ospf 1", distance 110, metric 5, type inter area Last update from 10.1.35.3 on GigabitEthernet0/0, 00:04:32 ago Routing Descriptor Blocks: * 10.1.35.3, from 3.3.3.3, 00:04:32 ago, via GigabitEthernet0/0 Route metric is 5, traffic share count is 1The filter only affects the Type 3 LSAs that R3 sends into Area 1. R3 itself still has the route, and so does every router in Area 0:
R3# show ip route 10.0.99.99 | include Known|via Known via "ospf 1", distance 110, metric 4, type intra area * 10.0.34.4, from 1.1.1.1, 00:00:30 ago, via GigabitEthernet0/1And R1 can reach R6 through the summary:
R1# ping 10.1.6.6 source Loopback0!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 12/12/14 msTask 5: Configure OSPFv3 for IPv6
Objective: Configure OSPFv3 process 10 with the IPv6 address family on all eight routers. Keep the OSPFv2 configuration.
Configuration
On R3:
configure terminalrouter ospfv3 10 router-id 3.3.3.3 address-family ipv6 unicast auto-cost reference-bandwidth 1000 passive-interface Loopback0 area 1 range 2001:db8:100:100::/56 exit-address-familyinterface Loopback0 ospfv3 10 ipv6 area 0exitinterface GigabitEthernet0/0 ospfv3 10 ipv6 area 0exitinterface GigabitEthernet0/1 ospfv3 10 ipv6 area 0exitinterface GigabitEthernet0/2 ospfv3 10 ipv6 area 1exitendThe other routers follow the same pattern: every interface in the topology and every Loopback0 gets ospfv3 10 ipv6 area with the same area as in OSPFv2. R4 also gets area 2 stub no-summary, and R7 and R8 get area 2 stub, under the IPv6 address family.
router ospfv3 10 is the newer address-family configuration. The older ipv6 router ospf syntax only supports IPv6. With address families, a single OSPFv3 process can carry both IPv6 and IPv4, which we'll use in Task 6. There are no network statements in OSPFv3. OSPF is enabled on each interface directly.
The router ID is still a 32-bit number written like an IPv4 address. On a router without any IPv4 addresses, it has to be configured manually, otherwise the process can't start.
The IPv6 addresses are numbered so that the Area 1 summary works. 2001:db8:100:100::/56 covers everything from 2001:db8:100:100:: to 2001:db8:100:1ff::, which includes R5's and R6's loopbacks (2001:db8:100:105::5 and 2001:db8:100:106::6) and both Area 1 links (2001:db8:100:135::/64 and 2001:db8:100:156::/64).
What changes in OSPFv3
OSPFv3 works the same way as OSPFv2. The main differences are:
- OSPFv3 runs per link, not per subnet. Neighbors form adjacencies using their IPv6 link-local addresses, and the next hops in the routing table are link-local addresses too.
- Hellos are sent to
FF02::5(all OSPF routers) andFF02::6(DR and BDR) instead of 224.0.0.5 and 224.0.0.6. - Router and Network LSAs no longer carry addresses. They only describe the topology, and the prefixes are moved into new LSA types.
| Type | Name | What it describes |
|---|---|---|
| 8 | Link | The router's link-local address and the prefixes on one link. It's only flooded on that link. |
| 9 | Intra-Area Prefix | The prefixes attached to a router or a transit network, referencing its Router or Network LSA |
The Type 3 and Type 4 LSAs are renamed to Inter-Area Prefix and Inter-Area Router LSAs, but they do the same job.
Verification
R2# show ospfv3 ipv6 neighbor OSPFv3 10 address-family ipv6 (router-id 2.2.2.2)Neighbor ID Pri State Dead Time Interface ID Interface4.4.4.4 1 FULL/DR 00:00:34 2 GigabitEthernet0/23.3.3.3 1 FULL/DR 00:00:33 2 GigabitEthernet0/11.1.1.1 1 FULL/BDR 00:00:33 2 GigabitEthernet0/0Instead of the neighbor's IP address, OSPFv3 shows its interface ID, a number that identifies the neighbor's interface on that link.
R2# show ipv6 route ospfIPv6 Routing Table - default - 17 entriesO 2001:DB8:100:1::1/128 [110/1] via FE80::5229:E2FF:FE72:0, GigabitEthernet0/0O 2001:DB8:100:3::3/128 [110/2] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2O 2001:DB8:100:4::4/128 [110/1] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2O 2001:DB8:100:34::/64 [110/2] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2OI 2001:DB8:100:100::/56 [110/4] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2OI 2001:DB8:100:207::7/128 [110/2] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2OI 2001:DB8:100:208::8/128 [110/3] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2OI 2001:DB8:100:247::/64 [110/2] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2OI 2001:DB8:100:278::/64 [110/3] via FE80::52F4:F8FF:FEE6:0, GigabitEthernet0/2The next hops are link-local addresses, the Area 1 prefixes appear only as the /56 summary, and inter-area routes are marked OI. R2 again uses R4 to reach R3's loopback.
The loopback costs are one lower than in OSPFv2. R1's loopback costs 1 here and 2 in OSPFv2. IOS advertises an OSPFv3 loopback prefix with a cost of 0 (Metric: 0 in R1's Intra-Area Prefix LSA), while OSPFv2 adds the loopback interface's cost of 1.
R2's database shows the new LSA types:
R2# show ospfv3 ipv6 database OSPFv3 10 address-family ipv6 (router-id 2.2.2.2) Router Link States (Area 0)ADV Router Age Seq# Fragment ID Link count Bits 1.1.1.1 62 0x80000002 0 1 None 2.2.2.2 58 0x80000003 0 3 None 3.3.3.3 59 0x80000003 0 2 B 4.4.4.4 62 0x80000002 0 2 B Net Link States (Area 0)ADV Router Age Seq# Link ID Rtr count 2.2.2.2 61 0x80000001 2 2 3.3.3.3 64 0x80000001 2 2 4.4.4.4 62 0x80000001 2 2 4.4.4.4 62 0x80000001 3 2 Inter Area Prefix Link States (Area 0)ADV Router Age Seq# Prefix 3.3.3.3 59 0x80000002 2001:DB8:100:100::/56 4.4.4.4 92 0x80000001 2001:DB8:100:247::/64 4.4.4.4 58 0x80000001 2001:DB8:100:207::7/128 4.4.4.4 58 0x80000001 2001:DB8:100:278::/64 4.4.4.4 48 0x80000001 2001:DB8:100:208::8/128 Link (Type-8) Link States (Area 0)ADV Router Age Seq# Link ID Interface 2.2.2.2 106 0x80000001 4 Gi0/2 4.4.4.4 103 0x80000001 2 Gi0/2 2.2.2.2 106 0x80000001 3 Gi0/1 3.3.3.3 104 0x80000001 2 Gi0/1 1.1.1.1 106 0x80000001 2 Gi0/0 2.2.2.2 106 0x80000001 2 Gi0/0 Intra Area Prefix Link States (Area 0)ADV Router Age Seq# Link ID Ref-lstype Ref-LSID 1.1.1.1 62 0x80000002 0 0x2001 0 2.2.2.2 58 0x80000003 0 0x2001 0 2.2.2.2 61 0x80000001 2048 0x2002 2 3.3.3.3 59 0x80000003 0 0x2001 0 3.3.3.3 64 0x80000001 2048 0x2002 2 4.4.4.4 62 0x80000002 0 0x2001 0 4.4.4.4 62 0x80000001 2048 0x2002 2 4.4.4.4 62 0x80000001 3072 0x2002 3- The Router LSAs have no prefixes anymore. The
Bbit marks R3 and R4 as ABRs (border routers). - The Network LSAs use the DR's interface ID as the Link ID instead of an IP address.
- The Link LSAs are listed per interface, because they're only flooded on their own link. R2 has one for each of its links, and it sees one from each neighbor.
- The Intra-Area Prefix LSAs carry the prefixes.
Ref-lstype 0x2001points to a Router LSA (the loopbacks), and0x2002points to a Network LSA (the transit links).
In the totally stubby Area 2, R8 has only a default route and the two Area 2 prefixes:
R8# show ipv6 route ospfIPv6 Routing Table - default - 7 entriesOI ::/0 [110/3] via FE80::527B:FAFF:FE77:1, GigabitEthernet0/0O 2001:DB8:100:207::7/128 [110/1] via FE80::527B:FAFF:FE77:1, GigabitEthernet0/0O 2001:DB8:100:247::/64 [110/2] via FE80::527B:FAFF:FE77:1, GigabitEthernet0/0And IPv6 works end to end:
R1# ping 2001:db8:100:208::8 source Loopback0Sending 5, 100-byte ICMP Echos to 2001:DB8:100:208::8, timeout is 2 seconds:Packet sent with a source address of 2001:DB8:100:1::1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 7/9/13 msTask 6: Add the OSPFv3 IPv4 Address Family
Objective: Add the IPv4 address family to OSPFv3 process 10 on all routers, using the same area design, and advertise each router's Loopback2. Keep OSPFv2 running.
Configuration
On R3:
configure terminalrouter ospfv3 10 router-id 3.3.3.3 address-family ipv4 unicast auto-cost reference-bandwidth 1000 passive-interface Loopback2 area 1 range 172.18.0.0 255.255.0.0 exit-address-familyinterface Loopback2 ospfv3 10 ipv4 area 0exitinterface GigabitEthernet0/0 ospfv3 10 ipv4 area 0exitinterface GigabitEthernet0/1 ospfv3 10 ipv4 area 0exitinterface GigabitEthernet0/2 ospfv3 10 ipv4 area 1exitendThe other routers again follow the same pattern, with ospfv3 10 ipv4 area on every link and on Loopback2, and the same stub settings for Area 2. Loopback2 uses 172.16.x.x/32 in Areas 0 and 2 and 172.18.x.x/32 in Area 1, so these prefixes are only advertised by OSPFv3 and are easy to tell apart from the OSPFv2 routes.
The OSPFv3 IPv4 address family carries IPv4 routes, but the OSPF packets themselves are still IPv6 packets. This is why IPv6 has to be enabled on every interface that runs it, including Loopback2, which has ipv6 enable in its startup configuration even though it has no IPv6 address.
Verification
Each address family forms its own adjacency. R2 has two OSPFv3 adjacencies with R1, one for each address family:
R2# show logging | include OSPFv3.*Nbr 1.1.1.1*Nov 10 09:13:27.313: %OSPFv3-5-ADJCHG: Process 10, IPv6, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading Done*Nov 10 09:15:36.816: %OSPFv3-5-ADJCHG: Process 10, IPv4, Nbr 1.1.1.1 on GigabitEthernet0/0 from LOADING to FULL, Loading DoneR2# show ospfv3 ipv4 neighbor OSPFv3 10 address-family ipv4 (router-id 2.2.2.2)Neighbor ID Pri State Dead Time Interface ID Interface4.4.4.4 1 FULL/DR 00:00:31 2 GigabitEthernet0/23.3.3.3 1 FULL/DR 00:00:38 2 GigabitEthernet0/11.1.1.1 1 FULL/BDR 00:00:38 2 GigabitEthernet0/0The interface shows both an IPv6 link-local address and an IPv4 address:
R2# show ospfv3 ipv4 interface GigabitEthernet0/0 | include Link Local|Internet|Network Type|Area Link Local Address FE80::528C:BEFF:FE99:0, Interface ID 2 Internet Address 10.0.12.2/24 Area 0, Process ID 10, Instance ID 64, Router ID 2.2.2.2 Network Type BROADCAST, Cost: 1The two address families share the same links, so OSPFv3 uses the instance ID in the packet header to keep them apart. The IPv4 unicast address family uses instance ID 64, while the IPv6 address family uses 0.
With debug ospfv3 ipv4 hello, we can see that the IPv4 address family's hellos are sent between IPv6 link-local addresses:
*Nov 10 09:16:38.817: OSPFv3-10-IPv4 HELLO Gi0/0: Rcv hello from 1.1.1.1 area 0 from FE80::5229:E2FF:FE72:0 interface ID 2*Nov 10 09:16:44.328: OSPFv3-10-IPv4 HELLO Gi0/0: Send hello to FF02::5 area 0 from FE80::528C:BEFF:FE99:0 interface ID 2An IPv6 link-local address can't be used as the next hop for an IPv4 route, though. In the IPv4 address family, each router puts its IPv4 interface address in its Link LSA instead:
R2# show ospfv3 ipv4 database link adv-router 1.1.1.1 | include Link Local|Interface|Link State ID|Prefix LS Type: Link-LSA (Interface: GigabitEthernet0/0) Link State ID: 2 (Interface ID) Link Local Address: 10.0.12.1 Number of Prefixes: 1 Prefix Address: 10.0.12.0 Prefix Length: 24, Options: NoneR2 uses 10.0.12.1 as the next hop for routes learned from R1.
The routes appear in the IPv4 routing table with the ospfv3 10 source:
R1# show ip route 172.16.8.8Routing entry for 172.16.8.8/32 Known via "ospfv3 10", distance 110, metric 4, type inter area Last update from 10.0.12.2 on GigabitEthernet0/0, 00:00:29 ago Routing Descriptor Blocks: * 10.0.12.2, from 4.4.4.4, 00:00:29 ago, via GigabitEthernet0/0 Route metric is 4, traffic share count is 1R1# ping 172.16.8.8 source Loopback2Sending 5, 100-byte ICMP Echos to 172.16.8.8, timeout is 2 seconds:Packet sent with a source address of 172.16.1.1!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 9/10/15 msTwo OSPF processes in one routing table
OSPFv2 and OSPFv3 now both carry IPv4 routes, with separate LSDBs and the same administrative distance of 110. R2's OSPFv3 routes show what that means:
R2# show ip route ospfv3 10.0.0.0/8 is variably subnetted, 13 subnets, 3 masksO IA 10.1.35.0/24 [110/3] via 10.0.24.4, 00:00:12, GigabitEthernet0/2O IA 10.1.56.0/24 [110/4] via 10.0.24.4, 00:00:12, GigabitEthernet0/2 172.16.0.0/32 is subnetted, 6 subnetsO 172.16.1.1 [110/1] via 10.0.12.1, 00:00:12, GigabitEthernet0/0O 172.16.3.3 [110/2] via 10.0.24.4, 00:00:12, GigabitEthernet0/2O 172.16.4.4 [110/1] via 10.0.24.4, 00:00:12, GigabitEthernet0/2O IA 172.16.7.7 [110/2] via 10.0.24.4, 00:00:12, GigabitEthernet0/2O IA 172.16.8.8 [110/3] via 10.0.24.4, 00:00:11, GigabitEthernet0/2O IA 172.18.0.0/16 [110/4] via 10.0.24.4, 00:00:12, GigabitEthernet0/2The Loopback2 prefixes and the 172.18.0.0/16 Area 1 summary are what we expected. But 10.1.35.0/24 and 10.1.56.0/24 are back. In OSPFv2, R3 hides them behind 10.1.0.0/16. The OSPFv3 IPv4 address family runs on the same links, so it advertises the link subnets too, and its own range only covers 172.18.0.0/16.
For a prefix that both processes advertise with the same mask, such as 10.0.34.0/24, R2 kept the OSPFv2 route. 10.1.35.0/24 is a different prefix from 10.1.0.0/16, so both are installed, and because of longest-prefix match, traffic to the Area 1 links now follows the OSPFv3 routes:
R2# show ip route 10.0.34.0 | include Known Known via "ospf 1", distance 110, metric 2, type intra areaR2# show ip route 10.1.35.0 | include Known Known via "ospfv3 10", distance 110, metric 3, type inter areaR2# show ip route 10.1.0.0 255.255.0.0 | include Known Known via "ospf 1", distance 110, metric 3, type inter areaSummarization and filtering are configured per process, and in OSPFv3 per address family, so they don't apply to the other one. This is something to keep in mind when two IGPs run side by side, for example during a migration from OSPFv2 to OSPFv3.
