Table of contents
Rules for External Route Calculation
Routing cost calculation rules when importing
OSPF route selection principles
OSPF external routing
basic concept
Generally, external routing refers to the external network of the enterprise. When the internal network of the enterprise needs to access the external network, the external network can be imported into the internal network of the enterprise (routing import)
Add router role
ASBR: Autonomous System Border Router
- The router that executes the import route
- In the NASS area, ABR routers that perform type 7 conversion to type 2
OSPF route import
On the ASBR router, routes of other protocols running on this router or routes of other OSPF processes are imported into another OSPF protocol process. This process is called OSPF route import.
route import command
under the ospf process
import-route routing protocol Import the route of this routing protocol into OSPF
Notice:
Only the active routes in the routing table will be imported (use the import [route type/direct connection] command under the ospf process to import routes)
By default, the default route will not be imported
The priority of external routes imported into OSPF is 150 (calculated through Type 5 and Type 7 LSAs)
The intra-area route priority of OSPF is 10 (calculated through Type 1, Type 2, and Type 3 LSAs)
import default route
The default route cannot be imported through import-static, and needs to be imported through the default-rote-advertise command
Rules for External Route Calculation
If the OSPF device and the ASBR are in the same area, the cost calculation method for the external route is as follows:
Cost = cost from itself to ASBR + cost when imported (type 5 LSA)
Next-Hop = the next hop from itself to ASBR
If the OSPF device and the ASBR are not in the same area, the cost calculation method for the external route is as follows:
Cost = cost from itself to ABR + cost from ABR to ASBR (type 4 LSA) + cost when imported (type 5 LSA)
Routing cost calculation rules when importing
Different cost types lead to different cost calculation methods when importing external routes
There are two types, Type 1 and Type 2. The default is Type 2
- Type 1: The routing table always displays the sum of the imported cost (external cost) + AS internal path cost
- Type 2: When importing external routes, ignore the cost of the AS internal path in the routing table, and only display the cost when importing (external cost)
Modify External Overhead Calculation Type
ospf 1
default type 1 Modify the external overhead calculation method to type1
By default in Huawei, the default external cost of the external route imported by ASBR is 1; if you need to keep the cost of the external route imported, you can do the following configuration
ospf 1
default inherit-metric Configure the external cost when the external route is imported as the cost before the import
default 10 Configure the external cost of importing external routes as 10 (the default is 1)
External route cost comparison method:
- Type 1 always takes precedence over Type 2
- The cost type is all 1, choose the one with a small Cost value, and if the cost is the same, the load will be shared (details are as follows)
- The introduction overhead is the same, compare the internal overhead, and the smaller one is preferred
- The introduction overhead is the same as the internal overhead, load sharing
- The cost type is 2 (do not care about the internal path of the AS, the cost displayed in the routing table is only the external cost)
- The cost of importing is different, and the cost of importing is small
- When the external overhead introduced is the same, the internal overhead is still compared, and the smaller the internal overhead, the better (just not displayed)
Forwarding-Address role
The Forwarding-Address field only appears in Type 5 and Type 7 LSAs, and only Type 5 LSAs are described here.
When a suboptimal path appears in the imported external route, the Forwarding Address section in Type 5 LSA will be used to solve the problem.
This field will contain the optimal next hop address.
Specific steps:
RTB fills its next hop address to 192.168.3.0 into the Forwarding Address field and sends it to RTA
After RTA receives it, it finds that the address in the Forwarding Address field of Type 5 LSA is directly reachable (there is a direct route to the 10.1.123.0/24 network segment), and then uses the address in this field as the next hop of the external route
OSPF route selection principles
- Intra-area routing is better than inter-area routing than out-of-area routing
- That is, type 1/2 LSA is better than type 3 LSA is better than type 5/7 LSA
- External routes Metric-Type1 routes are better than Metric-Type2 routes
- For external routes that are also Type1, the route with the smallest sum of internal cost plus external cost is preferred
- For external routes that are also Type 2, the route with the lowest external cost is preferred. If the external cost is the same, the route with the lowest internal cost is preferred; otherwise, the routing load is balanced