In an OSPF network, any device generates a link status notice. When sending a link to the entire network, any other device in the middle is only responsible for two tasks: learn records and continue forwarding without any modification (LSA: Link Status announcement)
OSPF route table generation process:
Announcement of switching link status between devices
Each device collects the link status notifications of other devices to establish its own link status database.
Find the optimal path for each device to reach each node in the network based on the algorithm and the shortest path tree.
Three OSPF tables:
Neighbor table
Topology table (link status database lsdb)
Optimal Route Selection table
To eliminate unnecessary traffic, a Dr will be selected in an OSPF broadcast domain, and LSA will be forwarded by other routers through dr.
In this broadcast domain, the relationship between DR and the common router is adjacent, and the relationship between the common router and the common router is neighbor.
The default cost value of OSPF is cost = 10000000/bandwidth.
TCP/IP route technology volume 1 version 2 ie1919
OSPF uses interface information to understand link information
The neighbor relationship is that the two parties only exchange HELLO messages, but not the link status database, and the adjacent relationship needs to interact with all information. The distinction between neighbors and neighboring areas is mainly used in Ethernet (broadcast) networks. A central node called Dr needs to be elected, that is, all Ethernet devices must interact with dr, at least HELLO messages are interacted with each other, and the database synchronization is scheduled by Dr to broadcast the link status database. This mainly aims to reduce the number of link status databases that need to be interacted over Ethernet.
The neighbor relationship status is 2way/drother, and the neighbor relationship status is full/DR or full/BDR.
OSPF only establishes a neighbor relationship with the directly connected vro. the adjacent areas are not necessarily.
There can be a maximum of two adjacent areas, and a bunch of neighbors can exist.
The Hello packet is used to establish and maintain a neighbor relationship. In the ethereum environment, the packet is sent once every 10 seconds. If the other party does not respond for 40 seconds, the packet is considered to have crashed.
DBD has two roles: one is to ensure who sends the package first, and the other is to exchange directory information.
LSR is used for the entries that are not in the request directory. LSU is the response data packet and the Core update data packet of The Link. lsack is used for confirmation.
LSU is LSA
OSPFState Machine:
An LSA is exchanged once every 30 minutes in OSPF stable state, and an update can be triggered.
When the device receives an LSA process:
The role of the network command is to declare the network. It is followed by an anti-mask. 0 indicates detection, 255 indicates ignore not detection, and 0 indicates the same part. The required CIDR block will be passed out with its own mask.
The default loopback route received through OSPF is the host address rather than the network segment. Therefore, you must enter the ip ospf network point-to-point in Lo, otherwise, the loopback address received by other devices is considered as a host (/32 ).
Show ip ospf neighbor display neighbor table
Show ip ospf database display link status database
Show IP Route OSPF displays the OSPF Optimal Path table, that is, the route entries calculated by OSPF.
Show IP protocols display Routing Protocol
Show ip ospf interface brief
Show ip ospf interface F0/0 understand the status of the specified interface in OSPF
Show ip ospf interface understand the status of all interfaces involved in OSPF
Show ip ospf database-Summary displays the number of LSA announcements in a link status database based on region and LSA type.
OSPF performs Database Synchronization in the Link State. The databases of each device are the same.
The OSPF area only divides ports, rather than the entire router.
The router ID of OSPF is a port address of the device. It is irrelevant to whether the port is involved in the OSPF process, as long as the IP address is active (up ). It can be changed manually.
Election Rules: 1. logical port priority (because it is generally not down, it is more suitable as a device identifier) 2. if multiple logical ports exist or no logical port exists, the IP address is larger than the IP address.
In an OSPF network, the device uses a router ID to identify itself.
Dr and BDR election rules: 1. Priority (highest) 2. Size of the router ID (highest)
Priority: You can use the neighbor 192.168.1.2 priority 0 command to change the priority. 0 indicates no participation. 255 indicates the highest priority.
Priority can affect the selection process, but cannot force replace a valid Dr or BDR router.
Dr is not preemptible. When Dr already exists in a network, even devices with better conditions are directly affiliated. Therefore, in a multi-access network, the first two vrouters with Dr selection qualifications initialized will become Dr and BDR routers.
The specified vro is the feature of the router interface, not the feature of the entire vro.
To prevent the network from effectively transmitting data packets after the Dr fails, in addition to selecting the specified vro, a backup vro (BDR) is also selected ). In this way, all the routers on the network will form an adjacent relationship with the specified router (DR) and the backup of the specified router (BDR) at the same time. The relationship between DR and BDR is also formed. In this way, when the Dr fails, BDR will become a new dr.
It is generally considered that in a newly initialized broadcast OSPF network, a BDR is first elected, then the selected BDR is upgraded to a Dr, and then a BDR is selected.
There are several broadcast domains and there are several DR, based on the port selection.
All routers send hello packets to allspfrouters as Multicast (destination IP-224.0.0.5, MAC-0100.5E00.0005)
All routers except Dr and BDR send the link status update packet and link status validation packet to 224.0.0.6 (MAC-0100.5E00.0006) in multicast mode, which is called alldrouters. Only the DR and BDR routers listen on this address. In turn, the Dr router uses the multicast address 224.0.0.5 to spread and update packets to BDR and drothers.
If R1 adds a loopback address, it notifies DR and BDR of the multicast packet whose destination address is 224.0.0.6, and then the Dr uses the multicast packet whose destination address is 224.0.0.5 to notify all devices except him, including R1.
In OSPF, routes between regions must be exchanged through area 0
OSPF network type:
Point-to-point basically uses the multicast address (including the hello packet and update packet)
When two routers run a serial link, it is automatically recognized as a point-to-point
Frame Relay environment:
1. Configure the frame relay switch (FR) and specify the dlci number from the port to the port.
2. Configure the router. After configuring the port address, configure the encapsulation form (encapsulation frame-relay) under the port)
3. fr will push the dlci number to the router with the dlci configured port (view the show frame-relay PVC)
4. the router uses the dlci number for reverse ARP and resolves the IP addresses of other routers (show frame-relay map can be viewed)
Disable reverse ARP resolution in Frame Relay (in Port mode ):
No ARP frame-relay
No frame-relay inverse-ARP
After the Reverse Address Resolution is disabled, the router does not have a ing and other routers cannot be pinged.
In this case, you can hand-write ing (for example, R1-> S0/0: frame-relay map IP 123.0.0.2 102 frame-relay map IP 123.0.0.3 103)
The physical structure of frame relay is fixed, and the logical structure is determined by whether the link specifies the dlci.
One-to-one and one-to-multiple connections can be achieved through frame relay. The physical interface can be a molecular interface, and the sub-interface can be one-to-one or one-to-many, with strong access capabilities.
In the frame relay environment, data transmission relies entirely on ing. Data can be sent with dlci, but not without dlci. Therefore, Ping fails, and broadcast and multicast are not supported.
In networks without broadcast capabilities (such as frame relay, ATM, and X.25), OSPF cannot run properly because packet sending is dependent on the broadcast capability of the network. The solution is nbma.
Nbma(Non-broadcast Multiple Access) network types:
Show ip ospf int S0/0. You can view the OSPF network type. The default value is nbma.
Broadcast(Pseudo broadcast, suitable for a fully-Connected Structure ):
1. Change the OSPF network type under the interface: ip ospf network broadcast
2. if reverse ARP resolution is enabled (enabled by default), no configuration is required (reverse ARP can resolve the broadcast address, which is the same as adding the broadcast keyword after static ing). If reverse ARP resolution is enabled, add the broadcast keyword After configuring each static ing.
When reverse ARP resolution is disabled and only the broadcast keyword is added after the static ing is configured on a vro, The ing neighbor relationship is full, which is down after a while. The reason for "full" is that the hello packet can be sent, and the unicast address is used to send back from the neighbor. The reason is that the neighbor cannot send the hello packet back.
Nbma(Suitable for full interconnection ):
The Hello interval is changed to 30 s (in the low-speed link ). No pseudo-broadcast or unicast communication is required.
1. Specify dr. Change the priority of the specified vro to 255, and change the priority of the other vro to 0. (Ip ospf priority 255)
2. Specify the neighbor statically on the Dr device. (Router OSPF 1 neighbor 123.0.0.2 ...)
3. Configure static ing (this option is not required if reverse ARP resolution is not disabled)
If it is not fully interconnected, if there is no dlci between R2 and R3, R2 and R3 cannot Ping each other.
In this case, you need to set the forwarding policy: R2 <-> R1 <-> R3, R2 and R3 forward packets through R1 (R2-s0/0: frame-relay map IP 123.0.0.3 201 R3-s0/0: frame-relay map IP 123.0.0.2 301)
Point-to-Point(In a network, not all devices are involved in OSPF. If less, you can consider the point-to-point mode. For example, R1 and R2 are involved, and R3 is not involved ):
It is equivalent to standard point-to-point and requires support for pseudo-broadcast.
1. Change the OSPF network type (S0/0: ip ospf network point-to-point)
2. Add the broadcast keyword After configuring the specified static ing (if reverse ARP resolution is not disabled, do not configure this one)
Point-to-multipoinT(Used in Star (main) or some interconnected structures ):
Point-to-point is the reuse of multiple points-to-point. A point-to-point tunnel is established from a device to multiple other devices at the same time. Pseudo-broadcast support is required.
1. Change the OSPF network type of each star node (S0/0: ip ospf network point-to-multipoint)
2. Add the broadcast keyword After configuring the specified static ing (if reverse ARP resolution is not disabled, do not configure this one)
Point-to-multipoint nonbroadcast(When the environment does not support pseudo-broadcast ):
The network environment does not support pseudo-broadcast.
1. Change the OSPF network type of the master (that is, the point) (S0/0: ip ospf network point-to-multipoint non-broadcast)
2. Configure static ing (this option is not required if reverse ARP resolution is not disabled)
3. Specify the neighbor statically. (Router OSPF 1 neighbor 123.0.0.2 ...)
Frame Relay Network in progress:
Point-to-point interface:
It is equivalent to the point-to-point mode, where no Dr is required, no neighbors are required, and pseudo-broadcast support is required.
1. Make the following configurations on the router (such as R1) that you want to drag the interface:
Int S0/0
No IP Address
Encapsulation frame-relay
Int S0/0.12 point-to-point
IP address 12.0.0.12 255.255.255.0
Frame-relay interface-dlci 102
Int S0/0.13 point-to-point
IP address 12.0.0.13 255.255.255.0
Frame-relay interface-dlci 103
2. change the network type (ip ospf network point-to-point) on a router (such as R2 and R3) that does not drag the molecular interface ), the router of the drag interface is automatically point-to-point by default.
3. Add the broadcast keyword After configuring the specified static ing (if reverse ARP resolution is not disabled, do not configure this one)
Multi-idea Interface:
Sub-interfaces are used to connect to multiple devices at the same time. Similar to nbma operations, Dr is required and neighbors must be specified manually.
1. Make the following configurations on the router (such as R1) that you want to drag the interface:
Int S0/0
No IP Address
Encapsulation frame-relay
Int S0/0.123 multipoint
IP address 123.0.0.1 255.255.255.0
Frame-relay map IP address 123.0.0.2 102; static ing is required here
Frame-relay map IP 123.0.0.3 103
Static neighbors:
Neighbor 123.0.0.2
Neighbor 123.0.0.3
2. The interface priority is reduced on routers (such as R2 and R3) that do not drag molecular interfaces to achieve the specified Dr effect.
3. Configure static ing on routers (such as R2 and R3) that do not drag molecular interfaces (if reverse ARP resolution is not disabled, no configuration is required)
Another method for configuring OSPF (this is used in IPv6 ):
1. Enable the OSPF process and then exit (router OSPF 1 Exit)
2. Enter the interface to participate in the OSPF process, ip ospf 1 area 0 (Network announcement is not required)
Lsa type:
TYpe 1 (router LSAs): All routers that enable the OSPF process generate this type of LSA and only distribute it in the region, including the router interface information. It is the LSA generated by each vro about its own link status, so it is called router LSA.
TYpe 2 (Network LSAs): generated by Dr, including information of all networks connected to Dr, which is only transmitted within the region. Is the LSA used by Dr to notify other routers.
TYpe 3 (ABR summary LSAs): This is generated by the ABR and notifies the route entries outside the vro area of the region. Cost is used to determine if there are more than one abr. This cost is obtained by adding the external route cost and the internal cost by the vro in the region, rather than running the SPF algorithm. Therefore, we can say thatOSPF is a link state protocol in a region, while OSPF is a distance vector protocol between regions..
TYpe 4 (ASBR summary LSAs): generated by ASBR. It is a host route that points to the IP address of the ASBR router and tells the route from the vro in the same Autonomous Region to the external Autonomous Region, used to broadcast the location of the ASBR.
TYpe 5 (external LSAs): generated by ASBR and advertised as an external route. The external LSA of the self-made system is the only LSA announcement that is not associated with a specific region and will conduct flooding throughout the self-made system. Generally, in a large network, a large number of such LSAs exist in the router database, causing heavy load on the router. So we can use stub area to limit the spread of such LSA.
TYpe 7 (NSSA external LSA): generated by ASBR, which is almost the same as the LSA 5 announcement, however, The NSSA external LSA announcement only carries out flooding in the non-pure peripheral area where the NSSA external LSA announcement is issued. In The NSSA region, when one vro is ASBR, the LSA 5 packet has to be generated, but The NSSA cannot contain LSA 5 packets and all the LSA 7 packets generated by the ASBR, to the vro in the region.
Each DR in an area sends an LSA to the outside, and each device in this area receives it, not just the broadcast domain where the DR is located.
O routing in the same area
O Ia routes to other areas in the same OSPF network
O E1 routes from external networks
O E2 routes from external networks
The difference between O E1 and O E2 (the default value is O E2 ):
O E1 accumulates intermediate devices (accurate results), and O E2 does not accumulate (saving resources ).
In the OSPF process, change redistribute rip subnets metric-type 1 to o E1 (assuming that the external network runs rip ).
In the nearest outbound location of the network, the packets sent to the external destination address are forwarded to the network using the E1 metric. If you want to forward the packets from the location closest to their external destination address, use the E2 metric.
-------------------------- OSPF optimization ----------------------------
Overload Protection of link status databases: Max-LSA 12000
Limit the maximum number of LSAs that a device can learn from other devices, excluding its own LSAs. Prevent attackers from sending a large number of LSAs to consume a large amount of resources for computing and affect the normal operation of the device.
If parameters are not followed, the default value is to disconnect the neighbors when the specified number is exceeded. It will be automatically restored in a period of time.
You can set the following parameters:
<1-100>: an alarm is triggered when the specified number is exceeded.
Ignore-time: the time when the neighbor relationship is automatically restored.
Ignore-count
Reset-time: Counting cycle of the counter. The counter is cleared after one cycle.
Warning-only: when the number of specified neighbors is exceeded, only alarms are triggered.
Passive interface:
It declares the network segments connected by some interfaces, but does not send hello packets to these interfaces or receive the hello packets sent from these network segments. This is generally the case when the peer is a host.
Rip, OSPF, and OSPF all have the passive interface function. Rip is not sent but received, and OSPF are neither sent nor received. (Sending and receiving refers to route update information, not normal data)
Two configuration methods (under the routing process ):
1. Passive-interface Ethernet 0: specify an interface as passive-Interface
2. Passive-interface default: Specify all interfaces as passive-interface, and then cancel some interfaces that do not want to be set as passive-interface.
No Passive-interface Ethernet 0
Virtual Link (the identifier of the failed Network ):
A maximum of one area can be specified, and the area cannot be a special functional area.
Routes transmitted through virtual link are not affected by the aging time. If virtual link exists, the route passed in exists. (There are DNA keywords in lsdb)
Two problems can be solved:
1. A non-backbone area is connected to area 0 across regions
Configuration: configure the ingress process in and out of the ABR of the area to be crossed (as shown in the figure: abr1 -- Area 10 virtual-link 2.2.2.2 abr2 -- Area 10 virtual-link 1.1.1.1 IP is the router ID)
The device that participates in virtual link also belongs to area 0 (, abr1 belongs to area 0, which can be viewed in lsdb)
2. Discontinuous area 0
View command: Show ip ospf Virtual-links
All virtual link interfaces belong to area 0.
Modify the OSPFCostValue (cost = 100000000/bandwidth ):
1. Change the bandwidth. Bandwidth modification affects the actual transmission capacity
2. Change cost directly. The workload is too large when a large number of modifications are required (in interface mode: ip ospf cost 10)
3. Change the divisor to 100000000 to a larger value (in the routing process, the unit of auto-cost reference-bandwidth 100 is MB, and the default value is 100)
OSPF does not support automatic summary, but can be summarized manually. OSPF summary only occurs in two places:
Summary benefits:
1. Reduce the number of Route entries
2. Reduce the impact of network changes on vrouters and protect CPU resources
Configuration:
Lsa 3: In the routing process, area 0 range 4.4.4.0 255.255.252.0
Lsa 5: In the routing process, summary-address 172.16.32.0 255.255.255.225.0
After the summary, the summary entries in the routing table point to the null 0 interface to prevent the router entries missed after the summary from forming a layer-3 loop.
Null 0 interface: 1. Anti-ring 2. Security policy function: discard data packets
Default-Information originate is configured on the ASBR to notify other devices in the OSPF network of the default route, which is passed as the LSA of type 5 to the following devices (Prerequisites: The ASBR must already have a default route, if ASBR is a dial-up Internet access and there is no default route above, the always keyword should be added to the backend)
An enterprise connects two ISPs:
1. Master-slave Routing
Default-Information originate metric 10 under the routing process on r1
Default-Information originate metric 20 under the routing process on r2
You can set different metric values for the default route pushed by the two vbrs to implement the master-slave route (the default value is 1)
2. PBR Policy Routing
If there are multiple equal-cost and equal-cost routes in the last route subset, the OSPF protocol will use them. By default, a Cisco router can achieve load balancing on a maximum of 16 Equal-cost routes. This value can be changed by running the maximum-paths command.
OSPF region type:
Backbone area (Area 0)
Common Area
Stub
Totally stub
NSSA
Totally NSSA
All vrouters in the region must use area 0 to access networks outside the region.
Stub:
Multiple ABR
Only the LSA of type 1, 2, and 3 is retained, and multiple default routes of Type 3 are retained,
Configuration: Under the routing process of each vro in the specified stub region, tap area * stub.
Totally stub:
Only one API
Only LSA of type1 and 2 is retained, and there is a default route of Type 3.
Configuration: in the specified totally stub area, except for the routing process of each vroabr of the ABR, tap area * stub, and then tap under the routing process of the ABR: area * stub no-Summary
NSSA:
I have more asbrs than stub and more than I have.
The ASBR In The NSSA area is transferred from the external route to the LSA of Type 7 to the ABR, And the LSA of type 5 is transferred to other internal routers.
Configuration: Click area * NSSA under the routing process of each vro in the specified NSSA region, and then tap on the vro closer to the ISP (ABR or ASBR: area * NSSA default-information-originate, so that other routers in the NSSA area will have a default route pointing to this router.
Totally NSSA:
There are more asbrs than totally stub, with only one ABR
The ASBR In The NSSA area is transferred from the external route to the LSA of Type 7 to the ABR, And the LSA of type 5 is transferred to other internal routers.
Configuration: in the specified totally stub area, except for the routing process of each vroabr of the ABR, tap area * NSSA, and then tap under the routing process of the ABR: area * NSSA no-summary. If you do not need to repeat default-information-originate, a default route is automatically pushed (because there is only one API ).
OSPF Authentication(Enable authentication before setting authentication ):
1. plaintext authentication
2. MD5 authentication
There are two ways to enable authentication:
1. Click "ip OSPF Authentication [Message-digest]" to enable the authentication function of this interface.
2. In the routing process, press area 0 authentication [Message-digest] to enable authentication for all interfaces involved in area 0, including virtual-Link
Virtual-link authentication method: In the routing process, tap area * virtual-link 3.3.3.3 Authentication-key mykey.
Plaintext authentication Configuration:
1. enable authentication
2. Configure the password: ip ospf Authentication-key mykey in Interface Mode
MD5 authentication Configuration:
1. enable authentication
2. Configure the password: In interface mode, ip ospf message-digest-key 1 MD5 mykey 1 is the key ID, and mykey is the password. The authentication must be completed in the same way.
Ccnp -- Router-1 OSPF