ospf工作原理_OSPF动态路由配置经典案例
前導知識點:靜態路由
結合上一講講解的距離矢量路由協議,本講我們講解鏈路狀態路由協議----OSPF,相比較于RIP,OSPF能夠支持大型網絡,下面列出RIP和OSPF的對比圖,進一步說明了OSPF的強大。
綜合以上幾點,OSPF是大型網絡必備的路由協議。當然,OSPF本身的理論非常復雜,限于篇幅,這里不再贅述。有機會做個連載,再給大家詳細講解OSPF的工作原理。
網絡拓撲圖:單區域OSPF的實現
如上圖,我們今天做一個基礎的OSPF,只做單區域,area0稱為骨干區域。
實驗步驟
1、定義客戶端的IP地址
PC1設置
PC2設置
2、定義設備的IP地址
R1(config)#int s0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config)#int f0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0
R1(config-if)#no shutdown
R2(config)#int s0/0
R2(config-if)#ip address 10.0.0.2 255.255.255.252
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config)#int s0/1
R2(config-if)#ip address 10.0.1.1 255.255.255.252
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R3(config)#int s0/0
R3(config-if)#ip address 10.0.1.2 255.255.255.252
R3(config-if)#no shutdown
R3(config)#int s0/1
R3(config-if)#ip address 10.0.2.1 255.255.255.252
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
R4(config)#int s0/0
R4(config-if)#ip address 10.0.2.2 255.255.255.252
R4(config-if)#no shutdown
R4(config)#int f0/0
R4(config-if)#ip address 192.168.1.254 255.255.255.0
R4(config-if)#no shutdown
3、配置OSPF動態路由,注意ospf也是聲明直連網段,但要注意路由器所屬的區域,以及反轉掩碼的概念
R1(config)#router ospf 1#啟用rip
R1(config-router)#router-id 1.1.1.1#設置RID,注意RID格式和ip地址相同,在ospf網絡中,RID是唯一的
R1(config-router)# network 192.168.1.0 0.0.0.255 area 0 #設置192.168.1.0/24網段為area 0區域
R1(config-router)# network 10.0.0.0 0.0.0.3 area 0 #設置10.0.0.0/30網段為area 0區域
同樣的方法設置R2、R3、R4
R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 10.0.0.0 0.0.0.3 area 0
R2(config-router)#network 10.0.1.0 0.0.0.3 area 0
R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 10.0.1.0 0.0.0.3 area 0
R3(config-router)#network 10.0.2.0 0.0.0.3 area 0
R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 192.168.2.0 0.0.0.255 area 0
R4(config-router)#network 10.0.2.0 0.0.0.3 area 0
驗證效果
R1的鄰居關系
R2的鄰居關系
R3的鄰居關系
R4的鄰居關系
R1路由表
R2路由表
R3路由表
R4路由表
課后總結和作業
OSPF的基礎配置不難,但是OSPF本身的理論很復雜,不適合大篇幅講解。本次案例中使用了兩個驗證指令:show ip ospf neighbor和show ip route,前者用于查看路由器的鄰居關系,如驗證效果圖中R1的鄰居關系,顯示的是“2.2.2.2 full”,表示已和RID為2.2.2.2的路由器建立了鄰居關系。后者用于查看路由表,可以發現學到的路由條目類型是“O”,表示通過ospf學習到的。下面一個例子,同學們自行完成,通過ospf實現網絡互聯,一共四個區域,網絡自行規劃。
某大學園區網
總結
以上是生活随笔為你收集整理的ospf工作原理_OSPF动态路由配置经典案例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 原生安卓刷机包下载(原生安卓刷机包)
- 下一篇: 萌钻怎么获得(安卓萌钻)