OSPF,OSPFV3協議配置(GNS3)


一.拓撲圖

   

 

 

 

 

 

本次試驗規划:拓撲分4個區域,其中區域2采用幀中繼實現區域內互通的前提下配置OSPF、ospfv3.R7與R8之間配置rip實現互通,區域1作為nssa區域,實現路由注入.最終實現全局互通。

 

二.ospf 配置

(1)ipv4地址規划

 

R1

 

F0/0

10.21.10.1/24

F0/1

10.21.20.1/24

R2

F0/0

10.21.10.2/24

F1/0

10.21.30.2/24

R3

S4/2

10.21.40.3/24

F0/0

10.21.10.3/24

R5

S4/0

10.21.40.2/24

R6

S4/1

10.21.40.1/24

R7

F1/0

10.21.30.1/24

F0/1

10.21.20.2/24

F0/0

10.21.50.2/24

R8

F0/0

10.21.50.1/24

 

 

R1

Looback0

10.21.1.1/24

R2

Looback0

10.21.2.1/24

R3

Looback0

10.21.3.1/24

R4

Looback0

10.21.4.1/24

R5

Looback0

10.21.5.1/24

R6

Looback0

10.21.6.1/24

R7

Looback0

10.21.7.1/24

R8

Looback0

10.21.8.1/24

 

 

 

(2) 配置步驟

1:配置路由器各端口地址以及個路由器的環回接口地址

2:區域二采用幀中繼連接,R4作為幀中繼交換機

R4#configure terminal

R4(config)#frame-relay switching

R4(config)#interface serial 4/0

R4(config-if)# encapsulation frame-relay

R4(config-if)#no arp frame-relay //關閉動態dicl

R4(config-if)# frame-relay lmi-type cisco   //定義信令類型

R4(config-if)# frame-relay intf-type dce    //定義設備類型

R4(config-if)# frame-relay route 201 interface Serial4/1 101   //配置幀中繼路由表

R4(config-if)#frame-relay route 202 interface Serial4/2 402

R4(config-if)#exit

 

R4(config)#interface serial 4/1

R4(config-if)# encapsulation frame-relay

R4(config-if)# frame-relay lmi-type cisco   //定義信令類型

R4(config-if)# frame-relay intf-type dce    //定義設備類型

R4(config-if)# frame-relay route 101 interface Serial4/0 201   //配置幀中繼路由表

R4(config-if)#frame-relay route 102 interface Serial4/2 401

R4(config-if)#exit

 

R4(config)#interface serial 4/2

R4(config-if)# encapsulation frame-relay

R4(config-if)# frame-relay lmi-type cisco   //定義信令類型

R4(config-if)# frame-relay intf-type dce    //定義設備類型

R4(config-if)# frame-relay route 401 interface Serial4/1 102   //配置幀中繼路由表

R4(config-if)#frame-relay route 402 interface Serial4/2 202

R4(config-if)#exit

 

R5 R6配置靜態dlci

R5#configure terminal

R5(config)interface Serial4/0

R5(config-if)# encapsulation frame-relay

R5(config-if)#no arp frame-relay //關閉動態dicl

R5(config-if)# frame-relay map ip 10.29.40.1 201 broadcast

R5(config-if)# frame-relay map ip 10.29.40.3 202 broadcast

R5(config-if)#exit

 

R6#configure terminal

R6(config)#interface Serial4/1

R6(config-if)# encapsulation frame-relay

R6(config-if)#no arp frame-relay //關閉動態dicl

R6(config-if)# frame-relay map ip 10.29.40.3 102 broadcast

R6(config-if)# frame-relay map ip 10.29.40.2 101 broadcast

R6(config-if)#exit

 

測試連通性:

R5#ping 10.29.40.3

 

 

3:配置ospf

R2配置以R1為例:

R1#conf terminal

R1(config)#router ospf 1

R1(config-router)# router-id 1.1.1.1

R1(config-router)#area 1 nssa                //定義區域1為nssa區域

R1(config-router)#network 10.21.1.0 0.0.0.255 area 0 // 宣告直連網段

R1(config-router)# network 10.21.10.0 0.0.0.255 area 0

R1(config-router)# network 10.21.20.0 0.0.0.255 area 1

R1(config-router)#exit

 

4:區域2基於幀中繼配置Ospf

R5參照R6配置

R6#configure terminal

R6(config)#router ospf 1

R6(config-router)#router-id 6.6.6.6

 

R6(config-router)# network 10.29.40.0 0.0.0.255 area 2

R6(config-router)#exit

R6(config)interface Serial4/1

R6(config-if)# ip ospf priority 0 //設置端口優先級為0,不參於選舉。

R6(config-if)# exit

 

R3#conf terminal

R3(config)#router ospf 1

R3(config-router)# router-id 3.3.3.3

R3(config-router)#network 10.21.3.0 0.0.0.255 area 0  //宣告直連網段

R3(config-router)#network 10.21.10.0 0.0.0.255 area 0

R3(config-router)#network 10.21.40.0 0.0.0.255 area 2

R3(config-router)#neighbor 10.21.40.2    //手動配置R5,R6為鄰居

R3(config-router)# neighbor 10.21.40.1

R3(config-router)# area 0 range 10.21.0.0 255.255.0.0 //配置路由匯總

R3(config-router)#exit

 

查看鄰居狀態

R3#show ip ospf neighbor

 

Neighbor ID     Pri   State           Dead Time   Address         Interface

1.1.1.1           1   FULL/DROTHER    00:00:39    10.21.10.1      FastEthernet0/0

2.2.2.2           1   FULL/BDR        00:00:32    10.21.10.2      FastEthernet0/0

5.5.5.5           0   FULL/DROTHER    00:01:44    10.21.40.2      Serial4/2

6.6.6.6           0   FULL/DROTHER    00:01:46    10.21.40.1      Serial4/2

 

5:配置rip 並重發布到ospf中

R7#configure terminal

R7(config)router ospf 1

R7(config-router)#router-id 7.7.7.7

R7(config-router)#area 1 nssa

R7(config-router)# network 10.21.20.0 0.0.0.255 area 1  //宣告直連網段

R7(config-router)# network 10.21.30.0 0.0.0.255 area 1

R7(config-router)#redistribute rip metric 25 subnets  //將RIP重發布到ospf中

R7(config-router)#exit

R7(config)#router rip

R7(config-router)#version 2

R7(config-router)# network 10.0.0.0

R7(config-router)#no auto-summary

R7(config-router)#redistribute ospf 1 metric 4 //將ospf重發布到Rip中

 

 

測試連通性:R8 ping R6 R5

 

 

 

R5 ping R1

 

 

 

 

至此,ospf配置成功,接下來在此配置下配置ospfv3

 

 

 

 

三.OSPFV3配置

(1)ipv6地址規划

R1

 

F0/0

2001:db8:21:3::1/64

F0/1

2001:db8:21:4::1/64

R2

F0/0

2001:db8:21:3::2/64

F1/0

2001:db8:21:5::1/64

R3

S4/2

2001:db8:21:1::3/64

F0/0

2001:db8:21:3::3/64

R5

S4/0

2001:db8:21:1::1/64

R6

S4/1

2001:db8:21:1::2/64

R7

F1/0

2001:db8:21:5::2/64

F0/1

2001:db8:21:4::2/64

F0/0

2001:db8:21:2::2/64

R8

F0/0

2001:db8:21:2::1/64

 

 

R1

Looback0

2001:cf:21:9::1/64

R1

Looback0

2001:cf:21:1::1/64

R2

Looback0

2001:cf:21:2::1/64

R3

Looback0

2001:cf:21:3::1/64

R4

Looback0

2001:cf:21:4::1/64

R5

Looback0

2001:cf:21:5::1/64

R6

Looback0

2001:cf:216::1/64

R7

Looback0

2001:cf:21:7::1/64

R8

Looback0

2001:cf:21:8::1/64

 

 

 

 

 

(2)配置步驟

1:配置路由器各端口地址以及個路由器的環回接口地址

 

2:區域二采用幀中繼連接,R4作為幀中繼交換機,配置與之前相同

 

3:幀中繼路由R3,R5,R6靜態配置dlci

R3#configure terminal

R3(config)#ipv6 unicast-routing

R3(config)#interface Serial4/2

R3(config-if)# frame-relay map ipv6 2001:DB8:21:1::1 402 broadcast

R3(config-if)# frame-relay map ipv6 2001:DB8:21:1::2 401 broadcast  

R3(config-if)#frame-relay map ipv6 FE80::CE01:1EFF:FE28:0 401 broadcast  //此映射是為ospfv3鋪墊              

R3(config-if)# frame-relay map ipv6 FE80::CE02:EFF:FE60:0 402 broadcast  

R3(config-if)#exit

 

R5#configure terminal

R5(config)#ipv6 unicast-routing

R5(config)interface Serial4/0

R5(config-if)#frame-relay map ipv6 2001:DB8:21:1::3 202 broadcast

R5(config-if)#frame-relay map ipv6 2001:DB8:21:1::2 201 broadcast

R5(config-if)# frame-relay map ipv6 FE80::CE01:1EFF:FE28:0 201 broadcast

R5(config-if)# frame-relay map ipv6 FE80::CE04:19FF:FE18:0 202 broadcast

R5(config-if)#exit

 

R6#configure terminal

R6(config)#ipv6 unicast-routing

R6(config)interface Serial4/1

R6(config-if)# frame-relay map ipv6 2001:DB8:21:1::3 102 broadcast

R6(config-if)# frame-relay map ipv6 2001:DB8:21:1::1 101 broadcast

R6(config-if)#frame-relay map ipv6 FE80::CE04:19FF:FE18:0 102 broadcast

R6(config-if)#frame-relay map ipv6 FE80::CE02:EFF:FE60:0 101 broadcast

R6(config-if)#exit

 

測試連通性:

R6 ping R3

R6#ping 2001:db8:29:1::3

 

 

 

 

R6 ping R3 鏈路本地地址

 

 

4:幀中繼環境下配置ospf

R3#configure terminal

R3(config)#ipv6 router ospf 1

R3(config-rtr)#router-id 3.3.3.3 //配置路由id

R3(config-rtr)# area 0 range 2001:DB8::/32 //配置路由匯總

R3(config-rtr)# exit

R3(config)#interface Serial4/2

R3(config-if)#ipv6 ospf 1 area 2

R3(config-if)# ipv6 enable

R3(config-if)# ipv6 ospf neighbor FE80::CE02:EFF:FE60:0 priority 1  //手動配置鄰居,優先級為零,此地址為R5 R6 的鏈路本地地址

R3(config-if)# ipv6 ospf neighbor FE80::CE01:1EFF:FE28:0  priority 1

R3(config-if)#exit

R3(config)#interface fastEthernet 0/0

R3(config-if)#ipv6 ospf 1 area 0

 

R6配置參考下面R5配置

 

R5#configure terminal

R5(config)#ipv6 router ospf 1

R5(config-rtr)#router-id 5.5.5.5 //配置路由id

R5(config-rtr)# exit

R5(config)#interface Serial4/2

R5(config-if)# ipv6 ospf 1 area 2

R5(config-if)# ipv6 enable

R5(config-if)#exit

 

5:配置其他區域的OSPFV3

R2參考R1配置

R1#configure terminal

R1(config)#ipv6 unicast-routing

R1(config)#ipv6 router ospf 1

R1(config-rtr)#router-id 1.1.1.1

R1(config-rtr)#area 1 nssa 定義區域1為nssa區域

R1(config-rtr)#exit

R1(config)#interface fastEthernet 0/0

R1(config-if)#ipv6 enable

R1(config-if)#ipv6 ospf 1 area 0

R1(config-if)#exit

R1(config)#interface fastEthernet 0/1

R1(config-if)#ipv6 enable

R1(config-if)# ipv6 ospf 1 area 1

R1(config-if)#exit

 

 

 

6配置路由重發布

R7#configure terminal

R7(config)#ipv6 unicast-routing

R7(config)#ipv6 router rip ys

R7(config-rtr)#redistribute ospf 1 metric 4 //將ospfv3重發布到RIP中,定義最大條數為4

R7(config-rtr)# redistribute connected

R7(config-rtr)#exit

R7(config)#ipv6 router ospf 1

R7(config-rtr)# router-id 7.7.7.7

R7(config-rtr)#area 1 nssa

R7(config-rtr)# redistribute rip ys  //將rip重發布到ospfv3中

R7(config-rtr)# redistribute connected  //由於重分布 RIPng,不能把連接 R8 的接口網段重分布進入OSPFv3,因此重分布直連,把連接 R8 的網段重分布到 OSPFv3

R7(config-rtr)# exit

 

測試連通性

R8 ping R3

 

 

查看路由匯總后R6的路由

R6#show ipv6 route ospf

IPv6 Routing Table - 13 entries

Codes: C - Connected, L - Local, S - Static, R - RIP, B - BGP

       U - Per-user Static route, M - MIPv6

       I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea, IS - ISIS summary

       O - OSPF intra, OI - OSPF inter, OE1 - OSPF ext 1, OE2 - OSPF ext 2

       ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2

       D - EIGRP, EX - EIGRP external

OI  2001:CF:29:1::1/128 [110/65]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OI  2001:CF:21:2::1/128 [110/65]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OI  2001:CF:21:7::1/128 [110/66]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OE2  2001:CF:21:9::/64 [110/20]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OI  2001:DB8::/32 [110/65]       //區域0經過匯總后的路由表

     via FE80::CE04:19FF:FE18:0, Serial4/1

OE2  2001:DB8:21:2::/64 [110/20]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OI  2001:DB8:21:4::/64 [110/66]

     via FE80::CE04:19FF:FE18:0, Serial4/1

OI  2001:DB8:21:5::/64 [110/66]

     via FE80::CE04:19FF:FE18:0, Serial4/1

 

查看R5的鄰居:

R5#show ipv6 ospf neighbor

Neighbor ID     Pri   State           Dead Time   Interface ID    Interface

6.6.6.6           1   FULL/BDR        00:01:40    10              Serial4/0

3.3.3.3           1   FULL/DR         00:01:57    11              Serial4/0

 

 

 

四.實驗總結:

此次實驗的目的是了解兩個版本的ospf與其所相關的知識點,通過本次實驗,我了解到了ospf與ospfv3原理上的差別,ospfv3比ospf配置更加便捷,其通過路由器的鏈路本地地址建立鄰居,所以配置中開啟了幀中繼的部分要設置關於鏈路本地地址的靜態dicl映射,還要是該部分的區域間路由作為DR,否則鄰居即使建立成功也無法多路發送”hello”包。本次實驗我獲益匪淺,遇到的問題就是幀中繼部分的ospf建立,通過查閱資料解決了問題。對這兩個協議的理解更加深刻了。在實驗當中應當做好數據輸入規划避免造成接口錯誤。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM