From 77901d1552542bc1ea0b2f85e3695c051aada649 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E6=80=9D?= <1662679300@qq.com> Date: Mon, 21 Apr 2025 17:59:46 +0800 Subject: [PATCH] 0421 --- ...0\346\200\201\350\267\257\347\224\261 .md" | 174 ++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 "22 \346\235\216\346\200\235/20250421 OSPF\345\212\250\346\200\201\350\267\257\347\224\261 .md" diff --git "a/22 \346\235\216\346\200\235/20250421 OSPF\345\212\250\346\200\201\350\267\257\347\224\261 .md" "b/22 \346\235\216\346\200\235/20250421 OSPF\345\212\250\346\200\201\350\267\257\347\224\261 .md" new file mode 100644 index 0000000..c81d12c --- /dev/null +++ "b/22 \346\235\216\346\200\235/20250421 OSPF\345\212\250\346\200\201\350\267\257\347\224\261 .md" @@ -0,0 +1,174 @@ +OSPF 是一种基于链路状态的内部网关协议,用于在大型企业网络或互联网服务提供商网络中实现动态路由。OSPF 特别适用于大型企业网络或 ISP 网络,因为它能够有效处理大量的路由信息,并提供灵活的路由策略。OSPF 可以在复杂的网络拓扑中实现高效的路由计算,同时支持分层和分区,使得网络管理更加灵活。 + +/*=Part2 OSPF动态路由配置 */ +Router(config)#router ospf 1 //启用OSPF协议,从属OSPF进程ID=1 +//指定通告网络,并归属OSPF区域ID=0 +Router(config-router)#network 192.168.3.0 0.0.0.255 area 0 + +``` +SW1 三层交换机 +Switch>en +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#vlan 10 +Switch(config-vlan)#ex +Switch(config)#vlan 20 +Switch(config-vlan)#ex +Switch(config)#inter vlan 10 +Switch(config-if)# +%LINK-5-CHANGED: Interface Vlan10, changed state to up + +Switch(config-if)#ip address 192.168.10.254 255.255.255.0 +Switch(config-if)#ex +Switch(config)#inter vlan 20 +Switch(config-if)# +%LINK-5-CHANGED: Interface Vlan20, changed state to up + +Switch(config-if)#ip address 192.168.40.254 255.255.255.0 +Switch(config-if)#ex +Switch(config)#inter f0/1 +Switch(config-if)#sw tr en dot1Q +Switch(config-if)#sw mo tr + +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up + +Switch(config-if)#ex +Switch(config)#inter f0/2 +Switch(config-if)#no sw +Switch(config-if)# +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to down + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up + +Switch(config-if)#ip address 10.10.1.1 255.255.255.0 +Switch(config-if)#ex +Switch#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Switch(config)#router ospf 1 +Switch(config-router)#network 192.168.10.0 0.0.0.255 area 0 +Switch(config-router)#network 192.168.40.0 0.0.0.255 area 0 +Switch(config-router)#network 10.10.1.0 0.0.0.255 area 0 +``` + + + +``` +路由器0 +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#inter g0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface GigabitEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to up + +Router(config-if)#ex +Router(config)#inter g0/1.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface GigabitEthernet0/1.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1.1, changed state to up + +Router(config-subif)#en dot1Q 30 +Router(config-subif)#ip address 192.168.20.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#inter g0/1.2 +Router(config-subif)# +%LINK-5-CHANGED: Interface GigabitEthernet0/1.2, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1.2, changed state to up + +Router(config-subif)#en dot1Q 40 +Router(config-subif)#ip address 192.168.50.254 255.255.255.0 +Router(config-subif)#ex +Router(config)#inter g0/0 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up + +Router(config-if)#ip address 10.10.1.2 255.255.255.0 +Router(config-if)#ex +Router(config)#inter g0/2 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface GigabitEthernet0/2, changed state to up + +Router(config-if)#ip address 10.10.2.1 255.255.255.0 +``` + + + +``` +路由器1 +Router>en +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#inter f0/1 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up + +Router(config-if)#inter f0/1.1 +Router(config-subif)# +%LINK-5-CHANGED: Interface FastEthernet0/1.1, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1.1, changed state to up + +Router(config-subif)#en dot1Q 10 +Router(config-subif)#ip address 192.168.30.254 255.255.255.0 +Router(config-subif)#ex + +Router(config)#inter f0/0 +Router(config-if)#no shut + +Router(config-if)# +%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up + +%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up + +Router(config-if)#ip address 10.10.2.2 255.255.255.0 +``` + + + +``` +路由器0 OSPF核心配置 +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#router ospf 1 +Router(config-router)#network 192.168.20.0 0.0.0.255 area 0 +Router(config-router)#network 192.168.50.0 0.0.0.255 area 0 +Router(config-router)#network 10.10.1.0 0.0.0.255 area 0 +Router(config-router)#network 10.10.2.0 0.0.0.255 area 0 +``` + + + +``` +路由器1 OSPF核心配置 +Router#conf t +Enter configuration commands, one per line. End with CNTL/Z. +Router(config)#router ospf 1 +Router(config-router)#network 192.168.30.0 0.0.0.255 area 0 +Router(config-router)#network 10.10.2.0 0.0.0.255 area 0 +Router(config-router)#ex +``` + +![Snipaste_2025-04-21_17-41-34](https://gitee.com/nevers-brother/picture-warehouse/raw/master/img/upgit_20250421_1745229390.png) \ No newline at end of file -- Gitee