天天看點

大型公司網絡之——OSPF進階配置(實驗)OSPF進階配置實驗:(GNS3中拓撲圖如下)

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進階配置(實驗)OSPF進階配置實驗:(GNS3中拓撲圖如下)

實驗環境準備: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進階配置(實驗)OSPF進階配置實驗:(GNS3中拓撲圖如下)

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

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根據上面的步驟進行操作。謝謝!

繼續閱讀