2020年4月20日 星期一

手把手玩IT分享 Cisco Route OSPF setting

手把手玩IT分享

Cisco Route OSPF Setting
圖中有Route0、Route1、Route2三台路由器,以及192.168.44.0/24、192.168.55.0/24、
172.16.10.0、10.10.22.0/24四段網路區段,假設要將0、1、2這三台路由器全都設定成使用
OSPF路由協定,則相關設定流程如下所述
一、先在lab中建立三台2901 Route及兩台PC
二、將三台Route的每個相互介接Port設上IP及兩台PC設定好IP
三、設定Route ID及設定設定IP遶送(OSPF)
四、用PC0去tracert PC1
由上圖可以看來源到目地中間所經過的節點


步驟一
先將LAB所需的設備建立好(三台Route及兩台PC)
步驟二
將Route介接的Port位綁上IP
  1. 首先點選Route0
  2. 點選CLI 
  3. 設定介接的Port位的IP(Route0的gi 0/0 port跟PC介接,故此IP亦是PC0的GATEWAY)
指令
Router>enable  進入特權模式
Router#config terminal  進入組態模式
Router(config)#hostname Router0  更名
Router0(config)#interface gigabitethernet 0/0  選擇要設定的介面0/0 Port
Router0(config-if)#ip address 192.168.44.1 255.255.255.0  將介面設上IP
Router0(config-if)#no shutdown  將介面UP起來
Router0(config)#exit  回到特權模式
Router0(config)#interface gigabitethernet 0/1  選擇要設定的介面
Router0(config-if)#ip address 192.168.55.1 255.255.255.0  將介面設IP
Router0(config-if)#no shutdown  將介面UP起來
Router0(config-if)#end  回到特權模式
Router0#write  存檔
上述動作重複在3台Route上執行,並將6個Port都設上相對應的IP,如下圖
步驟三
設定IP路由協定OSPF
  1. 點選Route0
  2. 進入CLI
  3. 設定路由協定
指令
Router0>enable  進入特權模式
Router0#configure terminal  進入組態模式
Router0(config)#router ospf 1  建立ospf ID
Router0(config-router)#network 192.168.44.0 0.0.0.255 area 0  設定網段IP遶送
Router0(config-router)#network 192.168.55.0 0.0.0.255 area 0  設定網段IP遶送
Router0(config-router)#end
Router0#write
上述動作的指令是先建立ospf ID然後將Router0相鄰的兩個網段加入路由表中,如此兩邊網段的IP
再經過Router0時才會進行IP遶送


設定完成後可查看路由表確認是否正確
進入組態模式後執行下列指令
Router0(config)#show ip router
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
   Gateway of last resort is not set
   10.0.0.0/24 is subnetted, 1 subnets
O 10.10.22.0/24 [110/3] via 192.168.55.2, 00:24:15, GigabitEthernet0/1
172.16.0.0/24 is subnetted, 1 subnets
O 172.16.10.0/24 [110/2] via 192.168.55.2, 00:24:15, GigabitEthernet0/1
192.168.44.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.44.0/24 is directly connected, GigabitEthernet0/0
L 192.168.44.1/32 is directly connected, GigabitEthernet0/0
192.168.55.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.55.0/24 is directly connected, GigabitEthernet0/1
L 192.168.55.1/32 is directly connected, GigabitEthernet0/1


也可以僅show出ospf的路由表
Router0(config)# show ip router ospf
Router0#show ip route ospf
10.0.0.0/24 is subnetted, 1 subnets
O 10.10.22.0 [110/3] via 192.168.55.2, 00:24:36, GigabitEthernet0/1
172.16.0.0/24 is subnetted, 1 subnets
O 172.16.10.0 [110/2] via 192.168.55.2, 00:24:36, GigabitEthernet0/1


以此反覆將Router1及Router2的設定key完


步驟四
Traceroute驗證
  1. 點選PC0
  2. 進入command prompt
  3. Tracert 10.10.22.1
Tracing route to 10.10.22.1 over a maximum of 30 hops
1  1ms    0 ms 0 ms    192.168.44.1
1  1ms    0 ms 0 ms    192.168.55.2
1  1ms    0 ms 0 ms    10.10.22.1


Trace complete


   由下圖可以看出追縱路由經過Router0及Router1兩個節點後就到達PC1
   

   

沒有留言:

張貼留言

搜尋此網誌