大型公司網絡之——OSPF高級配置(實驗)

OSPF高級配置

路由重分發:

一.理解路由重分發:

1.一個單一IP路由協議是管理網絡中IP路由的首選方案

2.Cisco ISO能執行多個路由協議,每一個路由協議和該路由協議所服務的網絡屬於同一個自治系統

3.Cisco ISO使用路由重分發特性以交換不同協議創建的路由信息

二.路由重分發的考慮:

1.度量值

2.管理距離

三.重分發到OSPF域中路由的路徑類型:


1.類型1的外部路徑(type1 external path,E1)

2.類型2的外部路徑(type2 external path,E2)

路由重分發配置

一.路由重分發配置命令:

Router(config-router)#redistribute protocol metric metric-value metric-type type-value subnets

二.OSPF與RIP重分發配置實例:

router rip

  redistribute ospf 1metric 10

router ospf 1

  redistribute rip metric 200 subnets
三.OSPF重分發靜態路由配置實例:
router ospf 1

  redistribute static metric 100 subnets metric-type2
四.OSPF重分發默認路由配置實例:
router ospf 1

  network 192.168.0.0 0.0.0.255 area 0

  default-information originate metric 10 netric-type 1

ip route 0.0.0.0 0.0.0.0 10.0.1.1

OSPF高級配置實驗:(GNS3中拓撲圖如下)

大型公司網絡之——OSPF高級配置(實驗)

實驗環境準備:GNS3及與之相連的CRT

實驗中需要用到的協議有:默認路由協議、靜態路由協議、RIP協議、OSPF協議

打開GNS3後:
1.拖出六個路由器(每臺路由器需要右鍵點擊選擇configure,在Slots中添加一個端口NM-1FE-TX,點擊OK添加)
2.四臺PC機
3.將R6的 圖標改爲cloud(這裏作爲電信運營商)

其中:
1.area1和area2都爲ospf協議
2.R4到R5段爲RIP協議
3.R3擔任ABR的角色

第一步:根據拓撲圖上的端口環境配置端口地址:

R1:

  R1#conf t
  R1(config)#int f0/0    
  R1(config-if)#ip add 192.168.10.1 255.255.255.0
  R1(config-if)#no shut
  R1(config-if)#int f0/1
  R1(config-if)#ip add 192.168.20.1 255.255.255.0
  R1(config-if)#no shut
  R1(config-if)#ex
  R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.0                  //末梢網絡環境配置默認路由出去,指向下一跳地址

R2:

  R2#conf t
  R2(config)#int f0/1
  R2(config-if)#ip add 192.168.20.2 255.255.255.0
  R2(config-if)#no shut
  R2(config-if)#ex
  R2(config)#int f0/0
  R2(config-if)#ip add 192.168.30.1 255.255.255.0
  R2(config-if)#no shut
  R2(config-if)#ex
  R2(config)#router ospf 1                                                                  //啓用OSPF進程1
  R2(config-router)#router-id 2.2.2.2                                                 //標註router-id
  R2(config-router)#network 192.168.30.0 0.0.0.255 area 1             //宣告30段落的網段,在area1中
  R2(config-router)#ex
  R2(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1      //做靜態路由
  R2(config)#router ospf 1                                                                  //啓用OSPF進程1
  R2(config-router)#redistribute connected subnets                         //直連網段20段落注入
  R2(config-router)#redistribute static subnets                                 //靜態網段10段落注入
  R2(config-router)#ex

R3:

  R3#conf t
  R3(config)#int f0/0
  R3(config-if)#ip add 192.168.30.2 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f0/1
  R3(config-if)#ip add 192.168.40.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f1/0
  R3(config-if)#ip add 12.0.0.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#int f2/0
  R3(config-if)#ip add 192.168.70.1 255.255.255.0
  R3(config-if)#no shut
  R3(config-if)#do show ip int b
  Interface                  IP-Address      OK? Method Status                Protocol
  FastEthernet0/0            192.168.30.2    YES manual up                    up      
  FastEthernet0/1            192.168.40.1    YES manual up                    up      
  FastEthernet1/0            12.0.0.1        YES manual up                    up      
  FastEthernet2/0            192.168.70.1    YES manual up                    up      
  R3(config-if)#ex
  R3(config)#ip route 0.0.0.0 0.0.0.0 12.0.0.2                               //配置默認路由出去,指向下一跳
  R3(config)#router ospf 1                                                            //啓用OSPF進程1
  R3(config-router)#router-id 3.3.3.3                                            //標註router-id
  R3(config-router)#network 192.168.30.0 0.0.0.255 area 1        //在area1中宣告30段
  R3(config-router)#network 192.168.40.0 0.0.0.255 area 0        //在area0中宣告40段
  R3(config-router)#network 192.168.70.0 0.0.0.255 area 0        //在area0中宣告70段
  R3(config-router)#default-information originate                         //注入外部默認路由 
  R3(config-router)#ex

R4:

  R4#conf t
  R4(config)#int f0/0
  R4(config-if)#ip add 192.168.40.2 255.255.255.0
  R4(config-if)#no shut
  R4(config-if)#int f0/1
  R4(config-if)#ip add 192.168.50.1 255.255.255.0
  R4(config-if)#no shut
  R4(config-if)#ex
  R4(config)#router rip                                                         //配rip協議
  R4(config-router)#ver 2
  R4(config-router)#no auto-summary
  R4(config-router)#network 192.168.50.0
  R4(config-router)#redistribute ospf 1 metric 5                  //注入ospf協議包含進程號和度量值
  R4(config-router)#ex
  R4(config)#router ospf 1                                                  //啓用OSPF進程1
  R4(config-router)#router-id 4.4.4.4                                  //標註router-id
  R4(config-router)#network 192.168.40.0 0.0.0.255 area 0
  R4(config-router)#redistribute rip subnets                       //注入rip協議
  R4(config-router)#ex

R5:

  R5#conf t
  R5(config)#int f0/0
  R5(config-if)#ip add 192.168.50.2 255.255.255.0
  R5(config-if)#no shut
  R5(config-if)#int f0/1
  R5(config-if)#ip add 192.168.60.1 255.255.255.0
  R5(config-if)#no shut
  R5(config-if)#ex
  R5(config-if)#router rip                                                           //配rip協議 
  R5(config-router)#ver 2
  R5(config-router)#no auto-summary
  R5(config-router)#network 192.168.50.0
  R5(config-router)#network 192.168.60.0
  R5(config-router)#ex

R6:

  R6#conf t
  R6(config)#int f0/0
  R6(config-if)#ip add 12.0.0.2 255.255.255.0
  R6(config-if)#no shut
  R6(config-if)#int f0/1
  R6(config-if)#ip add 13.0.0.1 255.255.255.0
  R6(config-if)#no shut
  R6(config-if)#ex
  R6(config)#ip route 192.168.0.0 255.255.0.0 12.0.0.1          //配靜態路由

第二步:進入四臺客戶機配置IP地址和網關:

1客戶機>ip 192.168.10.2 192.168.10.1
2客戶機>ip 192.168.70.2 192.168.70.1
3客戶機>ip 13.0.0.13 13.0.0.1
4客戶機>ip 192.168.60.2 192.169.60.1

第三步:進行全網互通測試:

進入PC1

PC1>ping 192.168.70.2 -t(長ping測試)
PC1>ping 192.168.60.2 -t(長ping測試)
PC1>ping 13.0.0.13 -t(長ping測試)
結果如下圖,達成全網互通,實驗成功!

大型公司網絡之——OSPF高級配置(實驗)

第四步:查看所有網段是否全部互相學習了

R1:

R1(config)#do show ip route
......(省略部分顯示)
C    192.168.10.0/24 is directly connected, FastEthernet0/0
C    192.168.20.0/24 is directly connected, FastEthernet0/1
S*   0.0.0.0/0 [1/0] via 192.168.20.2

R2:

R2(config)#do show ip route
......(省略部分顯示)
C        192.168.30.0/24 is directly connected, FastEthernet0/0
O  E2 192.168.60.0/24 [110/20] via 192.168.30.2, 00:12:45, FastEthernet0/0
S        192.168.10.0/24 [1/0] via 192.168.20.1
O  IA  192.168.40.0/24 [110/20] via 192.168.30.2, 01:43:09, FastEthernet0/0
C        192.168.20.0/24 is directly connected, FastEthernet0/1
O  E2 192.168.50.0/24 [110/20] via 192.168.30.2, 00:12:45, FastEthernet0/0
O  IA  192.168.70.0/24 [110/11] via 192.168.30.2, 01:42:47, FastEthernet0/0
O *E2 0.0.0.0/0 [110/1] via 192.168.30.2, 01:41:24, FastEthernet0/0

R3:

R3(config)#do show ip route
......(省略部分顯示)
C        192.168.30.0/24 is directly connected, FastEthernet0/0
O  E2 192.168.60.0/24 [110/20] via 192.168.40.2, 00:21:06, FastEthernet0/1
O  E2 192.168.10.0/24 [110/20] via 192.168.30.1, 01:51:31, FastEthernet0/0
C        192.168.40.0/24 is directly connected, FastEthernet0/1
O  E2 192.168.20.0/24 [110/20] via 192.168.30.1, 01:51:31, FastEthernet0/0
          12.0.0.0/24 is subnetted, 1 subnets
C        12.0.0.0 is directly connected, FastEthernet1/0
O  E2 192.168.50.0/24 [110/20] via 192.168.40.2, 00:21:07, FastEthernet0/1
C        192.168.70.0/24 is directly connected, FastEthernet2/0
S*       0.0.0.0/0 [1/0] via 12.0.0.2

R4:

R4(config)#do show ip route
......(省略部分顯示)
O IA 192.168.30.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
R    192.168.60.0/24 [120/1] via 192.168.50.2, 00:00:00, FastEthernet0/1
O E2 192.168.10.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
C    192.168.40.0/24 is directly connected, FastEthernet0/0
O E2 192.168.20.0/24 [110/20] via 192.168.40.1, 00:24:05, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/1
O    192.168.70.0/24 [110/11] via 192.168.40.1, 00:24:05, FastEthernet0/0
O*E2 0.0.0.0/0 [110/1] via 192.168.40.1, 00:24:07, FastEthernet0/0

R5:

R5(config)#do show ip route
......(省略部分顯示)
R    192.168.30.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
C    192.168.60.0/24 is directly connected, FastEthernet0/1
R    192.168.10.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R    192.168.40.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R    192.168.20.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
C    192.168.50.0/24 is directly connected, FastEthernet0/0
R    192.168.70.0/24 [120/5] via 192.168.50.1, 00:00:20, FastEthernet0/0
R*   0.0.0.0/0 [120/1] via 192.168.50.1, 00:00:10, FastEthernet0/0

R6:

R6(config)#do show ip route
......(省略部分顯示)
     12.0.0.0/24 is subnetted, 1 subnets
C       12.0.0.0 is directly connected, FastEthernet0/0
     13.0.0.0/24 is subnetted, 1 subnets
C       13.0.0.0 is directly connected, FastEthernet0/1
S    192.168.0.0/16 [1/0] via 12.0.0.1

以上實驗就是在大型企業網絡中會應用到的OSPF的高級配置,希望能給大家帶來幫助,大家也可以使用GNS3根據上面的步驟進行操作。謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章