[[426836]] OSPF- OSPF is an IGP and a Link-State protocol based on IP Pro89.
- The SPF algorithm (Dijkstra algorithm) is used to calculate the best path.
- Respond quickly to network changes.
- Periodic updates are sent less frequently (every 30 minutes) and are called link state refreshes.
- Updates are triggered when the network changes.
- Supports equal-cost load balancing.
Three tables maintained by OSPF- Neighbor Table: Ensures two-way communication between direct neighbors.
- Topology Table: LSDB (Link-State DataBase). All routers in the same area have the same LSDB.
- Routing Table: The SPF algorithm is applied to the LSDB, and the best route to the destination address is selected and placed in the routing table.
OSPF Area Division (1) OSPF adopts a hierarchical design and uses Area to separate routers. Routers in an area maintain detailed information about all links and routers in that area, but only summary information about routers and links in other areas is maintained. (2) Transit area (backbone or area 0) Area 0 - Mainly used to prevent loops, but also improves scalability! Main function: To transmit data packets quickly and efficiently. Usually not connected to users. (3) Regular areas (nonbackbone areas) are mainly used to connect users. All data must be transferred through area 0. Includes: Stub/Totally Stubby/NSSA The benefits of adopting a hierarchical design- Reduced routing table entries
- LSA flooding stops at the network border, accelerating convergence
- Limiting the impact of topology changes reduces network instability, and problems in one area will not affect other areas.
OSPF Neighbor and Adjacency Relationships- An OSPF router establishes a neighbor relationship with its directly connected neighbors.
- OSPF routers only exchange LSAs with routers that have established adjacency relationships.
- A router can reach the FULL state only with neighbors with which it has established an adjacency relationship.
- Routing updates are only transmitted between routers that have reached the FULL state.
- The P2P link can reach the FULL state.
- In an MA network, all routers and DR/BDR reach the FULL state only.
(Backup Designated Router) Difference between Neighbor and Adjacency- Neighbors---must have a directly connected link
- Adjacency --- 1. Must be neighbors 2. The databases in the same area on both sides of the link must be synchronized (status: FULL).
(1) Route-ID: Uniquely identifies a router in an OSPF domain. Set the priority of Route-ID: - Manually specify Route-ID xxxx (can be arbitrary, but cannot be repeated)
- Largest Loopback IP
- The highest interface IP (ensure that the interface is active) higher active physical interface IP It is recommended to use the loopback port and manually specified router-id because they are more stable.
(2) DR/BDR election: Compare the priority, the larger the better (the default is 1, if set to 0, it means not participating in the election) Compare Route-IDs, the larger the better. - DRother sends LSA to DR/BDR using 224.0.0.6
- DR sends LSA to DRother using 224.0.0.5
- Non-MA network (no DR/BDR), all routers use 224.0.0.5
< DR/BDR>Features- No preemption. When DR is normal, even if a new router with a higher Pri than DR comes up, it cannot preempt to become DR.
- When the DR is normal, the BDR only receives all information, and the tasks of forwarding LSA and synchronizing LSDB are completed by the DR. When the DR fails, the BDR automatically becomes the DR, completes the work of the original DR, and elects a new BDR.
- DR is an interface concept. Each network segment elects a DR.
- Select DR/BDR for different network segments
SPF Algorithm- All routers in an area have the same LSDB
- Each router uses itself as the root of the tree when calculating
- The route with the lowest cost to the destination is the best path.
- The best route is entered into the forwarding table
Timer- Hello Intervals: 10S/30S (Broadcast network default is 10s, non-broadcast network default is 30s!)
- Dead Interval: 4*Hello = 40S, which is three times the Hello time of other protocols
Hello packet is sent to 224.0.0.5 The hello time for the following three network types is 30S - NON_BROADCAST
- POINT_TO_MULTIPOINT
- POINT_TO_MULTIPOINT (point to multipoint) NON_BROADCAST (non-broadcast)
OSPF cost calculation- OSPF Cost = 10^8/BW (bps)
By default, the cost of the loopback port is 1, the cost of the serial port is 64, and the cost of the Ethernet port is 10. Five types of OSPF messages (1) Hello: Discover and establish adjacency. Also elect DR and BDR!!! (2) DBD: Contains summary information of the route. (3) LSR: Requests complete information about a specific route from another router. (4) LSU: used to flood LSA and respond to LSR with complete information about the route. In OSPF, only LSU needs to be displayed for confirmation. (5) LSAck: confirms LSU. Acknowledgement (ACK): - Implicit confirmation of Request by Update
- Explicit LSAs are only explicitly acknowledged to the LSU
There is a three-bit flag field (master-slave relationship control flag) in the DBD packet: - Initial (initial position), More (successor position), Master/Slave (master/slave position)
- I (Is it the first packet) M (Are there any subsequent packets) M/S
- 1 1 1
- 0 1 0
- 0 1 1
They are 0x7, 0x2, and 0x3 respectively. The router with the highest route-id is the master router. When establishing neighbors, the first DBD is empty, in order to select the master-slave relationship. The purpose of selecting the master-slave is to synchronize the DBD. At the beginning, both routers send an empty DBD, and the sequence number is randomly generated. After the master router is selected, the slave router first sends a DBD with the sequence number of the master router. (This is implicit confirmation) Necessary conditions for establishing OSPF neighbors- Hello/Dead Intervals
- Area ID
- Authentication Password
- Stub Area Flag
- MTU
- Subnet mask (must be the same network segment)
- show ip ospf nei Rugao City exstart status shows that their mtu is inconsistent, so ip ospf mtu-ignore (ignore this problem zx)
OSPF State Machine- down state
- init state
- Two-way state
- exstart state
- exchange state
- loading state
- full state
OSPF Basic Operation Commands- R1(config)#router ospf 110 Note: The process ID is Cisco's proprietary technology. It is not necessary to set it the same for all processes.
- R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 (both positive and negative masks are acceptable)
- R1(config-router)#network 12.1.1.0 255.255.255.0 area 0 The area number can also be expressed in dotted decimal notation.
- R1#show ip protocols
- R1#show ip ospf can view router-id, process number, and number of domains
- R1#show ip ospf interface
- R1#show ip ospf interface brief
- R1#show ip ospf neighbor View neighbor information
- R4(config-if)#ip ospf hello-interval 9
- (dead automatic*4)
- R4(config-if)#ip os dead-interval 80
- R4(config-if)#ip ospf priority 10 Change the priority
- R1#show ip os database
- Note: In OSPF, the routing mask of the loopback interface will become 32 bits. The available command is IP OSPF NETWORK POINT-TO-POINT
If OSPF is not layered in a large network, the following problems may occur: - Each router receives too many LSAs
- Routing calculations are often performed
- The routing table is too large and the router's memory is limited.
Types of OSPF routers: - Internal routers - routers within a common area
- Core router - router in area 0
- ABR Area Border Router - a router that connects two different areas
- ASBR Autonomous System Border Router - a router that connects an OSPF domain to another autonomous system
LSA Link state type, link state ID, and notification router are used to uniquely identify an LSA. Sequence number, checksum, and aging time identify a specific instance of an LSA. - 32-bit
- 16b----------|----8----------|------8-----|
- Aging time Options Type
- Link-ID name
- ADV Router Router-id
- Sequence number .seq
- Checksum .CRC Length .len
Points to note when studying: - Dissemination range
- Who produced it
- What's included
- Type Indicates the type of LSA
- Link-ID Each LSA has a Link-ID to distinguish LSAs sent by different routers
- ADV Router refers to the Router-id of the advertising router
-
-
- 1 2 3 4 5 7
- Link ID RID DR IP Route ASBR RID Route Route
-
-
- show ip ospf database router 1.1.1.1
- LSA1 (Router Link States)
- R1#show ip ospf database router View the detailed information of type 1 LSA in LSDB
- Intra-domain routes are transmitted only within the region and do not pass through the ABR.
- Each router generates
- Contains the router's directly connected neighbors and information about directly connected networks
- Link ID: router ID
- ADV router: router ID
- Three types of information: Another neighbor stub network transit network (some information about the Ma network, indicating whether it is connected to the Ma network!)
- LSA2 (Net Link States)
- R1#show ip ospf database network
- 1. Deliver only in this area
- 2. LSA2 is only generated in MA networks and is generated by DR.
- 3. Identify the routers in this MA network and the mask information of this network.
- Link ID: DR interface IP
- ADV router: Router ID of DR
- LSA3 (Summary Net Link States)
- R1#show ip ospf database summary
- 1. Inter-domain routing can flood to the entire AS.
- 2. Sent by ABR, passing through an ABR, its ADV Router will become the Router-id of this ABR.
- 3. Contains all routing information in this area, including network number and mask.
- Link ID: route (network number)
- ADV router: ABR router ID (after passing through an ABR, it will be changed to the router ID of this ABR)
- LSA4 (Summary ASB Link States) is used to inform other routers of the location of ASBR.
- R1#show ip os database asbr-summary
- 1. Spread the router-id of the ASBR to other areas so that routers in other areas know the location of the ASBR.
- 2. Generated and sent by ABR, passing through an ABR, its ADV Router will become the Router-id of this ABR.
- Link ID: RID of ASBR
- ADV router: ABR router ID (after passing through an ABR, it will be changed to the router ID of this ABR)
- In the area directly connected to the ASBR, no type 4 LSA is generated, because the ASBR will send out a type 1 LSA, which will indicate that it is the ASBR.
- LSA5 (Type-5 AS External Link States)
- R1#show ip os database external
- 1. External routes do not belong to a certain area. Advertise external routes into the ospf area!
- 2. ASBR generates and floods the entire AS. ADV Router will not be changed. Because it does not change, other routers do not know how to go to ASBR, so type 4 LSA is used!
- 3. Type 4 LSA containing routes outside the domain is needed to find the ASBR
- Link ID: Router (network ID)
- ADV router: router ID of ASBR (unchange)
- R1#sh ip os database external
- OSPF Router with ID (172.16.1.1) (Process ID 1)
- Type-5 AS External Link States
- LS age: 135
- Options: (No TOS-capability, DC)
- LS Type: AS External Link
- Link State ID: 172.16.1.0 (External Network Number)
- Advertising Router: 172.16.1.1
- LS Seq Number: 80000001
- Checksum: 0xB76C
- Length: 36
- Network Mask: /24
- Metric Type: 2 (Larger than any link state path)
- TOS: 0
- Metric: 20
- Forward Address: 0.0.0.0 The forwarding address of 0.0.0.0 means that if you want to send a data packet to an external router, it should be sent to the advertising router....Under what circumstances is it not 0.0.0.0? This will cause problems.
- External Route Tag: 0
- LSA7 (Type-7 AS External Link States)
- R2#show ip os database nssa-external
- Special extra-domain routes exist only in the NSSA area.
- Link ID: Router (network ID)
- ADV router: ASBR router ID (only in NSSA area)
- R2(config-if)#bandwidth 5000
- R2(config-if)#ip ospf cost 30
Four types of OSPF paths- Intra-domain routing O...1, 2
- Inter-domain routing O IA....3, 4
- E1 external routing O E1...5 (can be optimized when there are 2 exits)
- E2's external route O E2...5 (best when there is only one exit)
There are two types of external route redistribution into OSPF: - The default route redistributed into OSPF is E2, Cost=20, and the COST does not change during the transmission process.
- If the type is changed to E1, the cost value of each incoming interface will be accumulated during the transmission process.
If multiple routes to the same destination are redistributed into OSPF, OSPF follows the following principles when selecting external routes: - O E1 is better than O E2
- In the same situation, the one with lower cost has higher priority.
- When the cost is the same, choose the best path to the ASBR.
New Commands- Router(config-router)#max-lsa maximum-number [threshold-percentage] [warning-only] [ignore-time] [ignore-count] [reset-time]...Limit the number of lsa entries
- Define a percentage value. When the number of LSAs received exceeds the specified value, perform corresponding operations to limit the number of LSAs that the router can receive.
- maximum-number The maximum number of LSAs allowed to be received
- [threshold-percentage] The percentage of maximum-number. If this value is exceeded, a warning will be issued. The default value is 75%.
- [warning-only] Only send warnings, no other actions, closed by default
- [ignore-time] The time to enter the ignore state after exceeding the maximum value, the default is 5 minutes, and it will resume after 5 minutes
- [ignore-count] After the number of times, it will enter the ignore state
- [reset-time] How long does it take to reset all neighbors after entering the ignore state?
How does an ABR send out three types of LSAs when it has multiple routes? Even if the ABR router knows that it has multiple routes to the same destination, it will only send a single network summary LSA advertisement for this destination, whether it is from the core area to the non-core area or from the non-core area to the core area, and it must be the LSA with the lowest cost. Modify Cost reference value- OSPF Cost = 108 /BW (bps) The cost of the loopback port is 1, the cost of the serial port is 64, and the cost of the Ethernet port is 10
There are two ways to modify the COST value of a route: The first one: - R1(config)#int e0
- R1(config-if)#ip ospf cost 10 Directly modify the COST value 1-65535
Second type: - R1(config)#router ospf 110
- R1(config-router)#auto-cost reference-bandwidth 1000 (Mbps10 to the sixth power) Modify the numerator in the COST formula. In this example, the numerator is changed to 10 to the ninth power.
Benefits of aggregation: - Reduce the number of routing entries
- Limit the impact of topology changes to a small area
- Reduced flooding of LSA3 and LSA5
|