Table of contents
OSPF (Link State Routing Protocol)
Dynamic routing evaluation criteria:
3. Resource usage (the smaller the better)
Similarities between RIP and OSPF:
Differences between RIP and OSPF:
Structure Deployment: Regional Planning
1. Start the OSPF process and configure RID
OSPF (Link State Routing Protocol)
OSPF: Open Shortest Path First Algorithm - Link State Routing Protocol
Workflow: collect LSA (topology information) --> form image graph --> shortest path tree (five-ring structure) --> spf algorithm to get the path
RIP is not as good as OSPF in some aspects
Dynamic routing evaluation criteria:
1. Choose a good route
RIP uses the hop count to select routes Hop count: The basis for route selection is not reasonable enough, and the selected route may form a loop.
OSPF uses bandwidth to select routes
2. Fast convergence
There is also a timer in OSPF, and the period of the timer is shorter than that of RIP
3. Resource usage (the smaller the better)
Single packet: The OSPF packet contains a lot of information resulting in a large packet
Overall: great
OSPF uses many methods to solve the problem of resource occupation
same as different
Similarities between RIP and OSPF :
Version:
RIP V1 V2 ——ipv4
of
OSPF V1 V2 ——ipv4
V3—— ipv6
Mainly learn OSPF V3
1. Both RIP and OSPF are classless dynamic routing protocols that can be summarized and subnetted
2. Both RIPV2 and OSPFV2 use multicast to send packets
RIP uses multicast address: 224.0.0.9 OSPF uses multicast address: 224.0.0.5 224.0.0.6
3. Both support equal cost load balancing
Differences between RIP and OSPF :
RIP can only be applied to small and medium-sized networks
OSPF is suitable for medium and large networks (80% are implemented by OSPF)
Structure Deployment: Regional Planning
Structure Deployment: Regional Planning
AS : autonomous system
OSPF area:
Distance Vector Characteristics of Link State Routing Protocols
Transfer topology information in an OSPF area
Transmitting routes between OSPF areas
ABR : Area border router (must belong to two or more areas at the same time) --- interface
OSPF area division must also be based on the actual situation (there is no specified size)
If area division is performed : multi-area OSPF network
If no area division is performed : single-area OSPF
OSPF has designed an area ID : ( area ID ) 32-bit binary composition (distinguishing and identifying different areas)
Example: Area 0: 0.0.0.0 Area 2: 0.0.0.2
Rules for OSPF area division
1. ABR must exist: there must be at least one router ( which acts as a backup for each other ) and belongs to two or more areas at the same time ( and must have an interface connected to area 0 )
2.0SPF area division must be divided according to the star structure
Backbone area : only in area 0, area0 =0.0.0.0
OSPF packet (five types)
Hello packet: used to periodically discover , establish and keep alive neighbor relationships
Only accommodate RID : "Specifically distinguish and identify different OSPF" routing identity, 32-bit binary composition
(with uniqueness and uniformity "perform according to the IP address format")
Hello time: sent every 10 seconds by default
Dead time Death time : the default is equal to four times the Hello time 40 seconds
OSPF will send a Hello packet every 30 seconds in some special network environments
The device obtains the RID method:
1. Manual configuration
2. Automatic generation
If the router is configured with a loopback address, it will choose the loopback address with the largest value as its own RID
If the router is not configured with a loopback address, it will choose the interface IP address with the largest value as its own RID
DBD package: database description package (similar to LSA directory)
LSBB database : link state database (used to store LSA "topology information")
LSR packet: link state request packet
Requesting LSA information I don't have after comparing with DBD package (LSA directory)
LSU package: link state update package
Reply LSR packet , the data packet actually carrying LSA information
LSAck packet: link state confirmation packet
Reply R1 message to reach
OSPF state machine
State one:
Down State : Before the protocol is enabled
Init State state : OSPF discovers the process of establishing a neighbor
Two Way State state : the state of two-way communication (marking the establishment of a neighbor relationship) (share DIP with each other)
State two:
Condition matching : Only devices that match the conditions successfully can enter the next state.
If the condition fails to match, it will stay in the neighbor relationship and keep alive every ten seconds through the Hello packet.
The following figure shows that the condition matches successfully:
Exstart State state : pre-start state (election of master-slave relationship)
Competing for priority to enter the next state "election criteria depends on whose RID is large"
Exchange State status : Start sending summary LSDB packets (LSA directory) according to IP size
The function of the DBD package also has a different state
state three
Loading State : loading state (Huawei does not have this state, Cisco has it) and stores LSA information in the state database
Full State state: complete state
Marks the establishment of the adjacency state , only the adjacency state can truly share LSA information
Working status of OSPF
Establish a neighbor relationship ----After the startup configuration is completed, OSPF will periodically send hello packets (10s) to all local interfaces running the OSPF protocol with multicast 224.0.0.5 (target IP), and the hello packets will carry their own local RID, the neighbor receives the RID of the peer and will store this information in the neighbor table
Condition matching: If the condition matches successfully, it will enter the next state; if the match fails, it will stay in the neighbor relationship . You need to use the hello package for periodic keepalive
Establish an adjacency relationship : Election of the master-slave relationship, first use the DBD packet that does not carry data (real LSA summary) for election----compared with RID, the one with the larger RID will be the master device, and the master device will share its own database summary first information, and at the same time, the master device will first share its own LSA information. Afterwards, use the local link LSR/LSU/LSACK to obtain locally unknown LSA information, complete the establishment of the local Isdb, and form a local link database table.
Complete convergence : based on your local link state database, relying on the OSPF algorithm to form a directed graph---finally calculate the route---load it into your local routing table
After the convergence is completed, the hello packet will be used to keep alive periodically, and the periodic update will be performed every 30 minutes. The LSA will be updated periodically. The LSA has
OSPF configuration
1. Start the OSPF process and configure RID
[r1]ospf ?
INTEGER<1-65535> ProcessID Configure process ID
[r1] ospf 1 router-id 1.1.1.1 try to specify manually
2. Create a zone
[r1-ospf-1]area 0
3. declare
[r1-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255 range announcement (equivalent to announcing a network segment)
0.0.0.255: (anti-mask)
0 means immutable 1 means mutable
32-bit binary composition, consisting of consecutive 0s or consecutive 1s, the only part of the mask is the network bit, which is equivalent to immutable
[r1-ospf-1-area-0.0.0.0]network 12.0.0.1 0.0.0.0 Accurate announcement, which is equivalent to announcing only one IP
extension:
[r2]display ospf peer View neighbor table
[r2]display ospf peer brief View neighbor brief list
Algorithm of OSPF overhead (Cost bandwidth):
Reference Bandwidth/True Bandwidth
The default reference bandwidth is 100M (100 megabytes)
[r3-ospf-1] bandwidth-reference 10000 - modify bandwidth
How does OSPF deal with changes in the network structure?
When a new or missing network segment is added to the network, the network is unreachable (waiting for death time)
OSPF also exists to trigger updates, and this packet needs to be echoed
condition match
DR : Designated router (actually refers to the interface)
The DR and other routers in the broadcast domain establish neighbor relationships
BDR : Backup Designated Router
DRother : a broadcast domain, other routers except DR and BDR
To discover neighbors in a broadcast domain, at least four routers are required
The one with the largest RID in the broadcast domain will be selected as the DR , the one with the second largest RID will be the BDR , and the remaining devices will be the DRother ( the election rules only look at the RID )
The election of DR and BDR is non preemptive , and the maximum election time is the death time ( must be elected within the death time ), after
Those who join will follow the ones elected before.
Priority: 1 The one with the higher priority value of DR becomes DR
[r1-GigabitEthernet0/0/0]ospf dr-priority ?
INTEGER<0-255> Router priority value
Interfere in the election of DR and BDR, 0 means not to participate in the election
OSPF extended command:
1. Certification
Interface authentication:
interface GigabitEthernet0/0/0
ospf authentication-mode md5 1 plain 123456
Regional Certification:
The essence is still interface authentication
area 0.0.0.0
authentication-mode md5 1 plain 123456
network 192.168.1.0 0.0.0.255
2. Manual summary
Area summary: configure on the ABR
[r4-ospf-1area 0 enters the corresponding area
[r4-ospf-1-area-0.0.0.0]abr-summary 172.16.0.0 255.254.0.0 summary (the mask can only be written in dot-minute-ten system)
3. Silent interface:
[r5-ospf-1] silent-interface GigabitEthernet 0/0/1 configuration location
4. Speed up convergence
[r4-GigabitEthernet0/0/1]ospf timer hello 5- only need interface to change hello time
By default, the death time will be automatically modified according to the relationship between the 4 beings
Conclusion: All interfaces need to be modified
5. Default route
[r5-ospf-1]default-route-advertise-configuration location, in the ospf process
There must be a default for itself before it can be delivered to other devices.
[r5-ospf-1]default-route-advertise always - force the default route to be delivered