EIGRP默認路由總結

版權聲明:原創作品,允許轉載,轉載時請務必以超鏈接形式標明文章 原始出處 、作者信息和本聲明。否則將追究法律責任。http://gujian139.blog.51cto.com/1166106/391383

  

 

實現EIGRP默認路由:

方法1:寫一條默認路由,重發布到EIGRP

 R2(config)#ip route 0.0.0.0 0.0.0.0 s0/0 172.16.12.1  //使用出站接口和下一跳IP地址均可

R2(config-router)#redistribute static metric 1544 20000 1 255 1500

    

查看R3上的路由表如下:

Gateway of last resort is 192.168.23.2 to network 0.0.0.0

 

D    192.168.45.0/24 [90/2681856] via 192.168.34.4, 00:31:50, Serial0/1

D    192.168.25.0/24 [90/2681856] via 192.168.23.2, 00:31:52, Serial0/0

C    192.168.23.0/24 is directly connected, Serial0/0

C    192.168.34.0/24 is directly connected, Serial0/1

D*EX 0.0.0.0/0 [170/7289856] via 192.168.23.2, 00:00:05, Serial0/0

默認路由條目以外部路由存在

 

方法2:使用EIGRP特有的IP default-network宣告默認路由

  ip default-network 後的IP地址一定要是主類IP地址,並且處於所宣告該網段的接口的IP地址也必須的主類IP地址。

如果R2配置如下:

     router eigrp 10

 network 172.16.0.0

 network 192.168.23.0

        network 192.168.25.0

        no auto-summary

R2(config)#ip default-network 172.16.12.0

R2show run會發現多處一條靜態路由:ip route 172.16.0.0 255.255.0.0 172.16.12.0

該靜態路由是由宣告子網所造成的。所產生的路由表如下:

Gateway of last resort is 172.16.12.1 to network 0.0.0.0

 

D    192.168.45.0/24 [90/2681856] via 192.168.25.5, 00:05:14, Serial0/2

C    192.168.25.0/24 is directly connected, Serial0/2

     172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks

C       172.16.12.0/24 is directly connected, Serial0/0

S       172.16.0.0/16 [1/0] via 172.16.12.0     生成的靜態路由

C    192.168.23.0/24 is directly connected, Serial0/1

D    192.168.34.0/24 [90/2681856] via 192.168.23.3, 00:05:14, Serial0/1

S*   0.0.0.0/0 [1/0] via 172.16.12.1

 

  正確方法:router eigrp 10

 network 172.16.0.0

       network 192.168.23.0

              network 192.168.25.0

              no auto-summary

       R2(config)#int s0/0

       R2(config-if)#ip add 172.16.12.2 255.255.0.0

       R2(config)#ip default-network  172.16.0.0

   查看R2路由表

      Gateway of last resort is 172.16.12.1 to network 0.0.0.0

 

D    192.168.45.0/24 [90/2681856] via 192.168.25.5, 00:20:58, Serial0/2

C    192.168.25.0/24 is directly connected, Serial0/2

C*   172.16.0.0/16 is directly connected, Serial0/0   

C    192.168.23.0/24 is directly connected, Serial0/1

D    192.168.34.0/24 [90/2681856] via 192.168.23.3, 00:20:58, Serial0/1

S*   0.0.0.0/0 [1/0] via 172.16.12.1

 

172.16.0.0的默認路由用於宣告給EIGRP鄰居,作爲鄰居的最後求助(last-resort)的網關,但ip default-network對自己不生效,所以必須再在R2上配置

ip route 0.0.0.0 0.0.0.0 172.16.12.1

查看R3路由表:

Gateway of last resort is 192.168.23.2 to network 172.16.0.0 

//R3將通告給自己172.16.0.0默認路由的路由器設定爲網關

 

D    192.168.45.0/24 [90/2681856] via 192.168.34.4, 00:24:25, Serial0/1

D    192.168.25.0/24 [90/2681856] via 192.168.23.2, 00:24:26, Serial0/0

     172.16.0.0/16 is subnetted, 1 subnets

D*      172.16.0.0 [90/2681856] via 192.168.23.2, 00:05:48, Serial0/0

C    192.168.23.0/24 is directly connected, Serial0/0

C    192.168.34.0/24 is directly connected, Serial0/1

 

建議在R2上簡歷一個C類的環回口,然後作爲表示本臺路由器的默認路由宣告給EIGRP鄰居

R2上部分配置如下:

 interface Loopback0

 ip address 192.168.1.1 255.255.255.0

router eigrp 10

 network 192.168.1.0

 network 192.168.23.0

 network 192.168.25.0

 no auto-summary

   ip default-network 192.168.1.0

ip route 0.0.0.0 0.0.0.0 172.16.12.1

查看R2路由表:

   Gateway of last resort is 172.16.12.1 to network 0.0.0.0

 

D    192.168.45.0/24 [90/2681856] via 192.168.25.5, 00:32:03, Serial0/2

C    192.168.25.0/24 is directly connected, Serial0/2

C    172.16.0.0/16 is directly connected, Serial0/0

C    192.168.23.0/24 is directly connected, Serial0/1

D    192.168.34.0/24 [90/2681856] via 192.168.23.3, 00:32:03, Serial0/1

C*   192.168.1.0/24 is directly connected, Loopback0

S*   0.0.0.0/0 [1/0] via 172.16.12.1

 

解析:在R2上所配置的IP default-network 的網段主要用於標示R2,告訴自己的EIGRP鄰居,“如果不知道如何轉發數據包,就交給該網段(就是R2)”。僅當使用該命令的路由器能夠到達指定網絡時,纔會將其作爲候選默認路由宣告給其他EIGRP路由器。同時還必須將該命令中指定的網絡號通告給其他EIGRP路由器,這樣這些路由器才能將該網絡作爲其默認路由,並將其最後求助的網關設置爲該默認網絡。該網段必須是由EIGRP加入到路由選擇表中的,或是根據靜態路由生成並被重分佈到EIGRP中的。

 

方法3:寫一條出站接口默認路由,並將該默認路由宣告進EIGRP

默認情況下,EIGRP不重分佈默認路由0.0.0.0 0.0.0.0,然而,如果EIGRP配置中包含命令network 0.0.0.0,則命令ip route 0.0.0.0 0.0.0.0 interface(出站接口)  將導致EIGRP重發布一條默認路由。但使用下一跳IP地址將不會導致這樣的結果。

R2上配置如下:

  router eigrp 10

 network 192.168.23.0

 network 192.168.25.0

    network 0.0.0.0

 no auto-summary

      ip route 0.0.0.0 0.0.0.0 Serial0/0 注意:必須使用出站接口

  使用該方法會將所有接口宣告進EIGRP中,不推薦使

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