OSPF dynamic routing configuration in Cisco Packet Tracer Cisco Simulator

OSPF (Open Shortest Path First) protocol is one of the most widely used dynamic routing protocols in the network at present, and also belongs to the interior gateway routing protocol, which can adapt to network environments of various scales and is a typical link state (Link State) protocol.

learning situation

The scale of Haicheng Company is getting bigger and bigger, and the number of routers is gradually increasing, reaching 8 sets. After consideration, the company's network administrator found that the original RIP routing protocol was no longer suitable for the existing company's applications. Therefore, it was decided to use the dynamic OSPF routing protocol between the company's routers to realize network interconnection.

situational analysis

As the network scale of the company is getting bigger and bigger, the administrator finds that the OSPF routing protocol is the most suitable, because the OSPF routing protocol can achieve fast convergence, and the possibility of loops is small, so it is suitable for medium and large enterprise networks.

Equipment needed:

(1) Two Cisco 2911 routers.

(2) One Cisco 3560-24PS switch

(3) 3 PCs.

(4) 2 cross lines.

(5) 2 straight lines.

(6) DCE serial port and DTE serial port line 1

(7) 1 Console line.

Task topology, see Figure 4-2-18.

Figure 4-2-18 Configuring OSPF single-area topology

The configuration is shown in Table 4-2-6.

Table 4-2-6 Switch and PC IP address network parameter setting

 

equipment

port

IP

Mask

Gateway 1

Switch-A

G0/1

192.168.1.1

255.255.255.0

none

F0/1

192.168.10.1

255.255.255.0

none

Router-A

g0/1

192.168.1.2

255.255.255.0

none

g0/0

192.168.20.1

255.255.255.0

none

S0/0/0

192.168.2.1

255.255.255.0

none

Router-B

S0/0/0

192.168.2.2

255.255.255.0

none

G0/0

192.168.30.1

255.255.255.0

none

PC1

192.168.10.2

255.255.255.0

192.168.10.1

PC2

192.168.20.2

255.255.255.0

192.168.20.1

PC3

192.168.30.2

255.255.255.0

192.168.30.1

steps to achieve

Step 1: Connect the network topology diagram as shown in Figure 4-2-18.

Step 2: Configure the IP address, subnet mask and gateway of the computer as shown in Table 4-2-6.

Step 3: Configure the name of Switch-A and its interface IP address. .

Switch>

Switch>enable

Switch#conf t

Switch(config)#host Switch-A   修改主机名

Switch-A(config)#ip routing  开启通信功能

Switch-A(config)#int fa0/1  进入端口

Switch-A(config-if)#no switchport 转换端口为路由端口

Switch-A(config-if)#ip add 192.168.10.1 255.255.255.0  配置IP和子网

Switch-A(config-if)#no shut  开启端口

Switch-A(config-if)#int g0/1  进入端口

Switch-A(config-if)#no switchport  开启端口

Switch-A(config-if)#ip add 192.168.1.1 255.255.255.0  配置网络

Switch-A(config-if)#no shut 开启端口

Switch-A(config-if)#exit

Step 4: Configure the name of Router-A and its interface IP address. .

Router>enable

Router#conf t

Router(config)#host Router-A  修改主机名

Router-A(config)#int g0/1   进入端口

Router-A(config-if)#ip add 192.168.1.2 255.255.255.0  修改主机名

Router-A(config-if)#no shut  开启端口

Router-A(config-if)#int g0/0

Router-A(config-if)#ip add 192.168.20.1 255.255.255.0

Router-A(config-if)#no shut

Router-A(config-if)#int s0/0/0

Router-A(config-if)#clock rate 64000  时钟速率设置为64000

Router-A(config-if)#ip add 192.168.2.1 255.255.255.0

Router-A(config-if)#no shut

Router-A(config-if)#

Step 5: Configure the name of Router-B and its interface IP address. .
 

Router>en

Router#conf t

Router(config)#host Router-B

Router-B(config)#int g0/0

Router-B(config-if)#ip add 192.168.30.1 255.255.255.0

Router-B(config-if)#no shut

Router-B(config-if)#int s0/0/0

Router-B(config-if)#ip add 192.168.2.2 255.255.255.0

Router-B(config-if)#no shut

Router-B(config-if)#

At this time, the test network communication cannot realize the intercommunication of the whole network. To realize the intercommunication of the whole network, the configuration of dynamic routing OSPF is required.

Step 6: Configure dynamic single-area OSPF routing on Switch-A.

Switch-A>en

Switch-A#conf t

Switch-A(config)#router ospf 1  进入ospf组1

Switch-A(config-router)#log-adjacency-changes 防止黑洞路由的产生

Switch-A(config-router)#network 192.168.10.0 0.0.0.255 area 0  允许通过的网段 区域为0

Switch-A(config-router)#network 192.168.1.0 0.0.0.255 area 0

注释:在思科OSPF协议里面,网段的子网掩码要用反掩码,
不过可以输入正常的掩码,思科系统会自动换算成反掩码

Step 7: Configure dynamic single-area OSPF routing on Router-A.

Router-A>

Router-A>enable

Router-A#conf t

Router-A(config)#router ospf 1  进入ospf动态路由组1

Router-A(config-router)#log-adjacency-changes 防止黑洞路由的产生

Router-A(config-router)#network 192.168.1.0 0.0.0.255 area 0  允许通过网段 区域0

Router-A(config-router)#network 192.168.2.0 0.0.0.255 area 0

Router-A(config-router)#network 192.168.20.0 0.0.0.255 area 0

Router-A(config-router)#

注释:在思科OSPF协议里面,网段的子网掩码要用反掩码,
不过可以输入正常的掩码,思科系统会自动换算成反掩码

Step 8: Configure dynamic single-area OSPF routing on Router-B.

Router-B#

Router-B#conf t

Router-B(config)#router ospf 1

Router-A(config-router)#log-adjacency-changes 防止黑洞路由的产生

Router-B(config-router)#network 192.168.2.0 0.0.0.255 area 0

Router-B(config-router)#network 192.168.30.0 0.0.0.255 area 0  允许通过的网段

Router-B(config-router)#

注释:在思科OSPF协议里面,网段的子网掩码要用反掩码,
不过可以输入正常的掩码,思科系统会自动换算成反掩码

Step 9: After configuring the routing protocol, verify the connectivity of the network. Ping PC2 and 3 on PC1, as shown in the figure, they can communicate with each other

 summary:

(1) The OSPF process number of each router can be different, and a router can have multiple OSPF processes.

(2) OSPF is a classless routing protocol and must be masked.

(3) The first zone must be zone 0.

related information

The Open Shortest Path First (OSPF) protocol is a link-state routing protocol designed to replace the distance vector routing protocol RIP. RIP was a well-accepted routing protocol in the early days of networking and the Internet. However, RIP's reliance on hop count as the only metric for determining the best route soon became problematic. Using hop counts does not scale well in large networks with multiple paths of varying speeds. OSPF has a huge advantage over RIP because it both converges quickly and scales to larger networks. Its characteristics are as follows:

(1) Wide range of adaptation - supports networks of various sizes, up to hundreds of routers.

(2) Convergence is fast—update messages are sent immediately after the topology of the network changes, so that this change is synchronized in the autonomous system.

(3) No self-loop——OSPF ​​uses the shortest path tree algorithm to calculate the route according to the collected link status, which ensures that no self-loop route will be generated from the algorithm itself.

(4) Area division management—allows the network of the self-made system to be divided into areas for management, and the routing information transmitted between areas is further abstracted, thereby reducing the occupied network bandwidth.

(5) Routing classification—use 4 types of different levels of routing, which are in order of priority: intra-area routing, inter-area routing, first-class external routing, and second-class external routing.

(6) Support verification - support interface-based message verification to ensure the security of routing calculations.

(7) Multicast transmission is possible—on the link layer with multicast transmission capability, the multicast address can send and receive messages, which not only achieves the function of broadcast, but also minimizes the interference to other networks.

The OSPF routing protocol notifies its own routing information to the entire network, so that each device in the network finally synchronizes a database (LSDB) with the link state of the entire network, and then the router uses the SPF algorithm, with itself as the root, to calculate the route to other networks The shortest path finally forms the routing information of the entire network.

In a large-scale network environment, OSPF supports area division to plan the network reasonably. area0 (backbone area) must exist when dividing areas. Other areas are directly connected to the backbone area, or connected through virtual links.

To create an OSPF routing process, in global command configuration mode, execute the following command:

router#config

router_config#router ospf process-id ! Start the ospf routing process

router_config_router_process-id#network address wildcard-mask area area-id

router_config_router_process-id#

(1) The OSPF routing process process-id must be specified in the range of 1-65535. Multiple OSPF processes can be configured on the same router, but it is best not to do so. Multiple OSPF processes require multiple copies of the OSPF database and must run multiple copies of the shortest path algorithm. The process-id only works inside the router, and the process-id of different routers can be different.

(2) wildcard-mask is the inverse of the subnet mask, and the network area ID area-id is a decimal number within 0-4294967295, or it can be xxxx with an IP address format. When the network area ID is 0 or 0.0.0.0, it is the backbone domain. Routers in different network areas learn routing information through the backbone area.

knowledge development

Implementation of OSPF Dynamic Routing Protocol Multi-area

When a large OSPF area is divided into smaller areas, it is called multi-area OSPF. Multi-area OSPF is useful in large network deployments to reduce processing and memory overhead.

For example, whenever a router receives new information about the topology, like the addition, deletion, or modification of a link, the router must rerun the SPF algorithm, create a new SPF tree, and update the routing table. The SPF algorithm is CPU-intensive, and its computation time depends on the region size. Having too many routers in an area makes the LSDB larger and increases CPU load. Thus, effectively partitioning routers can break a huge database into smaller, more manageable databases.

Multi-area OSPF requires the use of a hierarchical network design. The main area is called the backbone area (area 0) and all other areas must be connected to the backbone area. With hierarchical routing, routing between regions is still possible (interregion routing); however, many tedious routing operations (such as recomputing databases) take place within regions.

For complex networks, OSPF can be implemented in a hierarchical manner using multiple areas. All areas must be connected to the backbone area (Area 0). The routers that interconnect areas are called Area Border Routers (ABRs).

With multi-area OSPF, OSPF can divide a large autonomous system (AS) into smaller areas to support hierarchical routing. With hierarchical routing, routing between regions is still possible (interregion routing), but many processor-intensive routing operations (such as recomputing databases) occur within regions.

Note: Topology changes are distributed to routers in other areas in a distance vector format. In other words, these routers just update their routing tables without re-running the SPF algorithm.

Too many routers in an area can make the LSDB very large and increase the load on the CPU. Therefore, effectively partitioning routers can break huge databases into smaller, more manageable databases.

The hierarchical topology of multi-area OSPF provides the following advantages:

Reduced Routing Table - Fewer routing table entries because network addresses between areas can be summarized. Route summarization is not enabled by default.

Reduced Link State Update Overhead - Minimizes processing and memory requirements.

SPF calculations less frequently - so that topology changes only affect the inside of the zone. For example, it minimizes the impact of routing updates because LSA flooding terminates at area boundaries.

Word of the day:

Autumn in the year and in the lifetime, the time is short, but it is clearer and less varied.

Guess you like

Origin blog.csdn.net/weixin_59507792/article/details/126813578