OSPF Operations
Default Route
Default Route
- Default-information originate:
- Requires a preconfigured default route.
- Default-information originate always:
- No need for a default gateway.
- If you only want the default route and not any other route in the RIB, you can configure a prefix list and permit
0.0.0.0/0 [not le 32]
. Note that the LSDBs must remain consistent within an area. Be cautious about the filtering direction:- Inside filters the RIB of the router where it is configured.
- Outside filters the RIB for the routers to which it is connected. It does not affect the LSDB, so adjacent neighbors without filtering will still receive the full routing table.
- Modifying OSPF Default Cost:
-
To modify OSPF's default behavior related to default routes, you can use the
area area-number default-cost value
command. This command allows you to change OSPF's default cost for advertising default routes into OSPF stub areas and NSSAs.-
Elaboration: The
area area-number default-cost value
command can be used to adjust the cost of default routes advertised by an ABR into a stub area or NSSA. It allows network administrators to fine-tune OSPF routing behavior according to their specific network requirements. -
In some scenarios, routers within a stub area or NSSA may add their own cost to reach the ABR, which is combined with the ABR's advertised cost for the default summary. This concept remains applicable when dealing with redistribution into stub, totally stub, and totally NSSAs, where a Type-3 summary default LSA is distributed within the OSPF domain.
-
it's important to note that when configuring an NSSA where the NSSA ABR is set to redistribute a default route, the rules differ slightly. In such cases, the NSSA ABR generates a Type-7 NSSA external default LSA to represent the default route within the NSSA. This Type-7 NSSA external default LSA is assigned a default metric, which may deviate from the standard default cost used for self-originated Type-7 NSSA external LSAs.
-
As network administrators configure OSPF, they can use the
area area-number default-cost value
command to tailor the OSPF routing cost as needed, ensuring precise control over default route behavior within the OSPF domain.
-
-
Administrative Distance
- AD is always 110, regardless of route type.
- You can change AD for path preference using the
distance
command. It is based on the router ID, not the interface. - Use the command
distance <1-255> {IP Source address (R.I.D of the source Router)]
to change AD for prefixes from a specific router. Check the LSDB to determine what the R.I.D is advertising. - You can also add an ACL with
distance 128 3.3.3.3 0.0.0.0 [<1-99><1300-1999><word>]
to change AD for specific prefixes. Use Named ACLs for convenience. - If you apply AD changes after the initial setting, you may need to clear the OSPF process.
- If no source is specified, all prefixes will have the set AD.
- To set AD for different route types, use the command
distance ospf intra-area 200 inter-area 220 external 225
. Adjust these values based on your requirements.
Summarization
- Summarization can be done on the ABR or ASBR, depending on route types:
- Use the
range
command to summarize Inter-area types (Type 3 LSAs) (O IA) witharea 0 range 192.168.1.0 255.255.255.0
on the ABR. The area ID is the originating area. - Use the
summary-address
command to summarize external types (Type 5,4 LSAs) (E1, E2) withsummary-address 192.168.1.0 255.255.255.0
on the ASBR. In the OSPF database, you will see the summarized prefix under Type 5 LSAs.
- Use the
Passive Interfaces
-
In OSPF, passive interfaces are used to prevent OSPF advertisements and neighborship on specific interfaces. Marking an interface as passive prevents OSPF from forming neighborships and advertising routes on that interface.
- Cisco's Use: In Cisco devices, passive interfaces can also be combined with the
default-information originate
command to simplify routing. By marking all interfaces as passive except for the ones you want to participate in OSPF, you effectively create a default route without explicitly configuring it. This is a convenient way to achieve default routing in OSPF.
- Cisco's Use: In Cisco devices, passive interfaces can also be combined with the
Graceful Shutdown
- Used when there's an adjacency between two routers, and one router's interface needs maintenance. Normally, the other router would wait for the hold-down timer to expire.
- With graceful restart/shutdown, the router in maintenance sends a hello packet with the other router's router ID excluded. The other router keeps neighborship information and enters the INIT state. Full adjacency is restored when the maintenance is complete.
- You can use this by:
- Using the
shutdown
command under the router OSPF process. The adjacent router will be in INIT state. - Using
ip ospf shutdown
under the specific interface. - On OSPFv3, it's the same.
- Using the
TTL Security
- Generally, the default settings are fine, unless you need to modify the TTL hops.
- To protect against DOS attacks and ensure that OSPF neighbors are part of the local or remote network, use TTL security.
- Directly connected neighbors usually have a TTL of 255, even on broadcast segments.
- You can set a router to accept a specific TTL value.
- Set the TTL security value globally on routers with
ttl-security all-interfaces hops <1-254> 254
. - You can also enable it per interface with
ip ospf ttl-security [<cr>, disable, hops]
.