Experiment content: Configuration
OSPF
Dynamic Routing Protocol
Lab environment:
Cisco
Packet Tracer
Simulator
Tutorial principle:
1. Overview
-- OSPF is a typical link-State routing protocol, which is generally used in the same routing domain. Here, the routing domain refers to an autonomous system.
(Autonomous
System), that is, as, which refers to a group of networks that exchange route information through a unified routing policy or routing protocol. In this as, all OSPF routers maintain the same description.
The as database stores the status information of the corresponding link in the routing domain. The OSPF router uses this database to calculate the OSPF route table.
-- As a link status routing protocol, OSPF transmits the link status broadcast packet LSA (link state advertisement) to all routers in a region, this is different from the distance vector routing protocol. A router running the distance vector routing protocol Transmits some or all route tables to its adjacent routers.
2. data packet format
-- In an OSPF Packet, the packet header length is 24 bytes and contains the following eight fields:
* Version number-defines the version of the OSPF routing protocol used.
* Type-defines the OSPF Packet type. There are five types of OSPF data packets:
* Hello-is used to establish and maintain the relationship between two adjacent OSPF routers. This packet is sent periodically.
* Database description-describes the entire database. This packet is sent only when OSPF is initialized.
* Link State request-Requests part or all of the data to the adjacent OSPF router. This type of data packet is sent only when the router finds that its data has expired.
* Link state Update-this is the response to the Link State request packet, that is, the LSA packet.
* Link state acknowledgment-is the response to the LSA data packet.
* Packet length-defines the length of the entire data packet.
* Router ID-used to describe the source address of a data packet, expressed as an IP address.
* Area ID-used to identify the Region ID of an OSPF Packet. All OSPF packets belong to a specific OSPF region.
* Checksum-check bit, used to mark data packets with no error code during transmission.
* Authentication type-defines the OSPF Authentication Type.
* Authentication-contains OSPF Authentication Information, which is 8 bytes long.
3. OSPF basic algorithm
3.1 SPF algorithm and shortest path tree
-- SPF algorithm is the basis of OSPF routing protocol. SPF algorithm is also known as Dijkstra algorithm, because the Shortest Path Priority Algorithm SPF was invented by Dijkstra.
. The SPF algorithm uses Each router as the root to calculate the distance from the router to each destination. Each router calculates the topology of the routing domain based on a unified database accounting.
The structure is similar to a tree. In SPF, it is called the Shortest Path Tree. In the OSPF routing protocol, the trunk length of the shortest path tree is the distance from the OSPF router to each destination router.
It is the cost of OSPF, and its algorithm is: cost = 100 × 106/link bandwidth
-- Here, the link bandwidth is expressed in bps. That is to say, the cost of OSPF is inversely proportional to the bandwidth of the link. The higher the bandwidth, the smaller the cost, which indicates the closer the OSPF to the destination. For example, the cost of FDDI or fast Ethernet is 1, the cost of 2 m serial link is 48, and the cost of 10 M Ethernet is 10.
3.2 link status Algorithm
-- As a typical link-State routing protocol, OSPF must follow the Unified Algorithm of The Link-State routing protocol. The Link State algorithm is very simple. Here, the link state algorithm is summarized into the following four steps:
When a vro is initialized or the network structure changes (such as adding or removing a vro or changing the link status), The vro generates a link status broadcast packet (LSA ), this packet contains the status information of all connected links on the router, that is, the status information of all ports.
All routers exchange link status data through a method called flooding. Flooding means that the router transmits its LSA data packets to all adjacent
An OSPF router updates its database based on the link status information it receives, and forwards the link status information to its adjacent router until it is stable.
When the network becomes stable again, it can be said that when the OSPF routing protocol converges, all routers calculate their route tables based on their respective link status information database. This routing table contains the router to each
A cost that can reach the destination and the next router (next-hop) to be forwarded to the destination ).
The 4th step is actually a feature of the OSPF routing protocol. When the network status is stable, the link status information transmitted in the network is relatively small, or it can be said that when the network is stable, the network is relatively quiet. This is also a major difference between link status routing protocols and distance vector routing protocols.
Configuration
OSPF
Routing Protocol commands
Command
|
Function
|
Router OSPF process-ID |
Used OSPF Protocol |
Network Address wildcard-mask area-ID |
Network connected to the vro |
Show IP Route |
View route table information |
Show IP Route OSPF |
View OSPF Protocol route information |
Note:
1
·
OSPF
Routing process
Process-ID
The specified range must be
1 ~ 65 535
Between multiple
OSPF
The process can be configured on the same vro, but it is best not to do so.
OSPF
Process requires multiple
OSPF
A copy of the database. You must run copies of multiple Shortest Path Algorithms.
Process-ID
It only works inside the vro.
Process-ID
It can be different.
2
·
Wildcard-Mask
Is the inverse of the subnet mask
. Network Area
ID area-ID
Yes
0 ~ 4294967295
In decimal number, which can also contain
IP
Address format
X. x
. When the Network Area
ID
Is
0
Or
0.0.0.
0
Is
Main domain
.
Routers in different network regions learn route information through the trunk domain.
The routing topology is set up as follows:
To vro
Router0
Configuration
OSPF
Dynamic Routing Protocol
Router (config) # Router
OSPF 10
Router (config-router) # network 192.2.0.0 0.0.255 area 1
Router (config-router) # network 192.1.0.128 0.0.0.63 area 1
Router (config-router) # exit
Router (config )#
To vro
Router1
Configuration
OSPF
Dynamic Routing Protocol
Router (config) # Router
OSPF 100
Router (config-router) # network 192.200.10.4 0.0.0.3 area 0
Router (config-router) # network 192.1.0.128 0.0.0.63 area 1
Router (config-router) # End
% SYS-5-CONFIG_ I:
Configured from console by Console
Router #
00: 32: 53:
% OSPF-5-ADJCHG: Process 100, NBR 192.2.0.1 on serial0/0/1 from loading to full,
Loading done
To vro
Router2
Configuration
OSPF
Dynamic Routing Protocol
Router (config) # Router
OSPF 100
Router (config-router) # network 192.200.10.4 0.0.0.3 area 0
Router (config-router) # network 192.1.0.128 0.0.63 area 2
To vro
Router3
Configuration
OSPF
Dynamic Routing Protocol
Router (config) # Router
OSPF 12
Router (config-router) # network 192.1.0.64 0.0.0.31 area 2
Router (config-router) # network 192.3.0.0 0.0.255 area 2
Router (config-router) # End
View
Router0
Route information:
Router # Show IP Route
192.1.0.0/26 is subnetted, 2 subnets
O IA
192.1.0.64 [110/192] via 192.1.0.129,
00:08:21, serial0/0/1
C
192.1.0.128 is directly connected,
Serial0/0/1
C
192.2.0.0/24 is directly connected,
Fastethernet0/0
O Ia 192.3.0.0/24
[110/193] via 192.1.0.129, 00:08:21, serial0/0/1
192.200.10.0/30 is subnetted, 1 subnets
O IA
192.200.10.4 [110/128] via 192.1.0.129,
00:48:24, serial0/0/1
View
Router1
Route information:
Router # Show IP Route
192.1.0.0/26 is subnetted, 2 subnets
O IA
192.1.0.64 [110/128] via 192.200.10.6,
00:09:55, serial0/0/0
C
192.1.0.128 is directly connected,
Serial0/0/1
O
192.2.0.0/24 [110/65] via 192.1.0.130,
00:49:53, serial0/0/1
O Ia 192.3.0.0/24
[110/129] via 192.200.10.6, 00:09:55, serial0/0/0
192.200.10.0/30 is subnetted, 1 subnets
C
192.200.10.4 is directly connected,
Serial0/0/0
View
Router2
Route information:
Router> enable
Router # Show IP Route
192.1.0.0/26 is subnetted, 2 subnets
C
192.1.0.64 is directly connected,
Serial0/0/1
O IA
192.1.0.128 [110/128] via 192.200.10.5,
00:17:56, serial0/0/0
O Ia 192.2.0.0/24
[110/129] via 192.200.10.5, 00:17:56, serial0/0/0
O
192.3.0.0/24 [110/65] via 192.1.0.65,
00:11:18, serial0/0/1
192.200.10.0/30 is subnetted, 1 subnets
C
192.200.10.4 is directly connected,
Serial0/0/0
View
Router3
Route information:
Router> enable
Router # Show IP Route
192.1.0.0/26 is subnetted, 2 subnets
C
192.1.0.64 is directly connected,
Serial0/0/1
O IA
192.1.0.128 [110/128] via 192.200.10.5,
00:17:56, serial0/0/0
O Ia 192.2.0.0/24
[110/129] via 192.200.10.5, 00:17:56, serial0/0/0
O
192.3.0.0/24 [110/65] via 192.1.0.65,
00:11:18, serial0/0/1
192.200.10.0/30 is subnetted, 1 subnets
C
192.200.10.4 is directly connected,
Serial0/0/0
The experiment is completed .............................