1. 程式人生 > 實用技巧 >EIGRP預設路由總結

EIGRP預設路由總結

實現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中,不推薦使

轉載於:https://blog.51cto.com/gujian139/391383