How can I set the cost value when OSPF imports external routes

4

When OSPF imports external routes, the cost of original routes is not used. By default, the cost of the external routes imported by OSPF is 1.

To change the default cost value of external routes imported by OSPF, run the default { cost { cost | inherit-metric } command. In the preceding command:
-cost: specifies the cost of the imported external routes. The value is an integer ranging from 0 to 16777214.
-inherit-metric: indicates that the cost of the imported external routes is the cost carried in the route.

Other related questions:
USG2000 / 5000 Configure OSPF to import external routes
USG2000 & 5000 Configure OSPF to import external routes as follows: 1. Configure the basic parameters of each interface to implement interworking. 2. Configure OSPF on the USG. 3. Configure the OSPF area on the USG and add the Internet segment on the USG to the OSPF area. 4. Configure OSPF to import direct routes on the egress gateway.

Precedence of external routes imported by OSPF on S series switches
When an S series switch runs OSPF, you can run the import-route command in the OSPF process view to import external routes. The routes imported using this method are OSPF ASE routes and default precedence is 150.

Can OSPF import IBGP routes
In V200R001C00, open shortest path first (OSPF) cannot import Internal Border Gateway Protocol (IBGP) routes. Starting from V200R001C01, the OSPF protocol can import IBGP routes. By default, the OSPF protocol does not import IBGP routes. However, OSPF can import IBGP routes on Multi-VPN-Instance CE (MCE) devices. You can run the vpn-instance-capability simple command for OSPF processes to disable route loop detection and directly calculate routes.

What are route selection rules if OSPF imports external routes with the same prefix
OSPF can import Type 1 and Type 2 external routes. By default, OSPF imports Type 2 external routes. If a Type 1 external route is imported, the cost contained in the corresponding LSA and the cost of the Type 1 external route are used for route calculation. If a Type 2 external route is imported, the cost of the Type 2 external route is much larger than the cost of an OSPF internal route. Therefore, only the cost of the corresponding LSA is used for route calculation. Route selection rules are described below if OSPF imports Type 1 external routes with the same prefix: Costs (cost of a route to the ASBR+cost contained in the corresponding LSA) of the imported routes are compared. The route with a smaller cost is preferred. If the route costs are the same, the corresponding LSA types are compared. The route that is imported using a Type 5 LSA is preferred. Route selection rules are described below if OSPF imports Type 2 external routes with the same prefix: The costs contained in the LSAs that are used to import the routes are compared. The route that is imported using the LSA with a smaller cost is preferred. If the costs in LSAs are the same, the costs of the routes to the ASBR are compared. The route with a smaller cost is preferred. If the costs of the routes to the ASBR are the same, the corresponding LSA types are compared. The route that is imported using a Type 5 LSA is preferred.

If you have more questions, you can seek help from following ways:
To iKnow To Live Chat
Scroll to top