eNSP 配置OSPF
一、子網劃分
?按需求,區域0可以匯總成一個網段以減少路由表條目,而區域1只有一個網段需要添加到路由表
劃分如下
?此處列舉R1的配置
[r1]int loop 1 [r1-LoopBack1]ip ad 192.168.1.17 28 [r1-LoopBack1]int g0/0/0 [r1-GigabitEthernet0/0/0]ip ad 192.168.1.81 28 Jul 12 2022 22:35:53-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP on the interface GigabitEthernet0/0/0 has entered the UP state.二、啟用OSPF
R1? ?R2
[r1]ospf 1 router-id 1.1.1.1 ***啟動時可以定義進程號、RID;默認進程1,RID--格式為IPV4地址,全網唯一 [r1-ospf-1]area 0 ***劃分到區域0 [r1-ospf-1-area-0.0.0.0]network 192.168.1.81 0.0.0.0 [r1-ospf-1-area-0.0.0.0]network 192.168.1.17 0.0.0.0 ***ospf在宣告時,需要使用反掩碼,來匹配宣告的地址范圍 ***被選中接口的拓撲信息可以共享給鄰接[r2]ospf 1 router-id 2.2.2.2 [r2-ospf-1]area 0 [r2-ospf-1-area-0.0.0.0]netwo 192.168.1.49 0.0.0.0 [r2-ospf-1-area-0.0.0.0]netwo 192.168.1.83 0.0.0.0R3? ?
[r3]ospf 1 ro 3.3.3.3 [r3-ospf-1]a [r3-ospf-1]area 0 [r3-ospf-1-area-0.0.0.0]net [r3-ospf-1-area-0.0.0.0]network 192.168.1.82 0.0.0.0 [r3-ospf-1-area-0.0.0.0]network 192.168.1.33 0.0.0.0 ***宣告區域0內的接口 [r3-ospf-1-area-0.0.0.0]q [r3-ospf-1]ar [r3-ospf-1]area 1 [r3-ospf-1-area-0.0.0.1]net [r3-ospf-1-area-0.0.0.1]network 192.168.1.1 0.0.0.0 ***宣告區域1內的接口R4
[r4]ospf 1 router-id 5.5.5.5 [r4-ospf-1]area 1 [r4-ospf-1-area-0.0.0.1]network 192.168.1.2 0.0.0.0三、設置DR設備
要求R1-R3中,R3為DR設備,且R1-R3中沒有BDR設備。
選舉DR/BDR的規則為:
????????1.先比較該網段所有參選設備接口的優先級,越大越優;
? ?????????默認優先級為1;取值范圍0-255,0標識不參選
????????2.若所有參選者優先級相同,比較參選設備的RID,數值大優
所以在區域0中R3是DR(Master),R2是BDR(Master)
選舉DR/BDR默認優先級為1,所以將R1、R2的優先級設置為0,將R3的優先級設置為2;
ospf的選舉是非搶占性的;故在修改完優先級后,需要所有路由器重啟OSPF進程。
此處列舉R3的配置
[r3]interface GigabitEthernet 0/0/0 [r3-GigabitEthernet0/0/0]ospf dr-priority 2 修改接口優先級<r1>reset ospf process 重啟ospf進程 Warning: The OSPF process will be reset. Continue? [Y/N]:y此時再查看R3的ospf鄰居信息
[r3]display ospf peerOSPF Process 1 with Router ID 3.3.3.3Neighbors Area 0.0.0.0 interface 192.168.1.82(GigabitEthernet0/0/0)'s neighborsRouter ID: 1.1.1.1 Address: 192.168.1.81 State: Full Mode:Nbr is Slave Priority: 0DR: 192.168.1.82 BDR: None MTU: 0 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:02:18 Authentication Sequence: [ 0 ] Router ID: 2.2.2.2 Address: 192.168.1.83 State: Full Mode:Nbr is Slave Priority: 0DR: 192.168.1.82 BDR: None MTU: 0 Dead timer due in 33 sec Retrans timer interval: 5 Neighbor is up for 00:02:28 Authentication Sequence: [ 0 ] Neighbors Area 0.0.0.1 interface 192.168.1.1(GigabitEthernet0/0/1)'s neighborsRouter ID: 5.5.5.5 Address: 192.168.1.2 State: Full Mode:Nbr is Master Priority: 1DR: 192.168.1.2 BDR: 192.168.1.1 MTU: 0 Dead timer due in 35 sec Retrans timer interval: 5 Neighbor is up for 00:03:04 Authentication Sequence: [ 0 ]此時區域0已經沒有了BDR
三、OSPF的區域匯總
OSPF協議不支持接口匯總;只能在ABR上將a區域拓撲計算所得路由,共享給B區域時進行匯總
分析拓撲圖,得知R3是區域0到區域1的ABR(區域邊界路由器),則在R3中進行配置
則R3的配置如下
[r3]ospf [r3-ospf-1]area 0 ***選中區域0 [r3-ospf-1-area-0.0.0.0]abr-summary 192.168.1.0 255.255.255.128 ***R3為一臺連接區域0和其他區域的ABR; ***以上操作為,R2將通過區域0學習到的拓撲計算所得的路由, ***傳遞給其他區域時進行匯總,匯總網段192.168.1.0/25四、OSPF缺省路由配置
要求不能宣告R4的環回且使得全網可達,則需要配置缺省路由。
邊界路由器上配置后,將自動向內網下放一條缺省路由,之后內網設備將自動生成缺省路由指向邊界。
分析拓撲圖,得知R4為該內網的邊界路由。
配置如下
[r4]ospf 1 [r4-ospf-1]default-route-advertise always五、OSPF的接口認證
要求全網可達的同時,路由器之間更新安全。
則給在直連鄰居或鄰接的接口上配置,保障更新的安全。
而區域0中R1-R3都是直連鄰居或鄰接的接口,所以認證碼要一致
而區域1中只要求R3和R4之間認證碼相同
此處區域0中的配置
[r1-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123 ***md5后的1代表ospf的進程號 [r2-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123 [r3-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 123區域1中的配置
[r3-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher 124 [r4-GigabitEthernet0/0/0]ospf authentication-mode md5 1 cipher 124六、測試
用R1 ping 其他三個路由器的環回? 全部能ping通
[r1]ping 4.4.4.1PING 4.4.4.1: 56 data bytes, press CTRL_C to breakReply from 4.4.4.1: bytes=56 Sequence=1 ttl=254 time=50 msReply from 4.4.4.1: bytes=56 Sequence=2 ttl=254 time=70 msReply from 4.4.4.1: bytes=56 Sequence=3 ttl=254 time=40 msReply from 4.4.4.1: bytes=56 Sequence=4 ttl=254 time=40 msReply from 4.4.4.1: bytes=56 Sequence=5 ttl=254 time=50 ms--- 4.4.4.1 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 40/50/70 ms[r1]ping 192.168.1.49PING 192.168.1.49: 56 data bytes, press CTRL_C to breakReply from 192.168.1.49: bytes=56 Sequence=1 ttl=255 time=40 msReply from 192.168.1.49: bytes=56 Sequence=2 ttl=255 time=60 msReply from 192.168.1.49: bytes=56 Sequence=3 ttl=255 time=60 msReply from 192.168.1.49: bytes=56 Sequence=4 ttl=255 time=40 msReply from 192.168.1.49: bytes=56 Sequence=5 ttl=255 time=40 ms--- 192.168.1.49 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 40/48/60 ms[r1]ping 192.168.1.82PING 192.168.1.82: 56 data bytes, press CTRL_C to breakReply from 192.168.1.82: bytes=56 Sequence=1 ttl=255 time=50 msReply from 192.168.1.82: bytes=56 Sequence=2 ttl=255 time=40 msReply from 192.168.1.82: bytes=56 Sequence=3 ttl=255 time=70 msReply from 192.168.1.82: bytes=56 Sequence=4 ttl=255 time=40 msReply from 192.168.1.82: bytes=56 Sequence=5 ttl=255 time=60 ms--- 192.168.1.82 ping statistics ---5 packet(s) transmitted5 packet(s) received0.00% packet lossround-trip min/avg/max = 40/52/70 ms總結
以上是生活随笔為你收集整理的eNSP 配置OSPF的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 搜索在线设备的工具软件-SADPTool
- 下一篇: 两种方式对线性规划问题求解详细步骤:【E