EIGRP重分發
EIGRP重分發
還是以剛才的拓撲圖作為例子,我們只在R1,R2,R3這三臺裝置上開啟了EIGRP協議,並沒有在R4上開啟,所以R1和R 2是無法ping通R4的,那麼我們如何將去往R4的路由通過rEIGRP告知R1和R2呢?
我們選取的思路是在R3上寫入一條通往R4的靜態路由,再在R4上寫入一條通往R3的靜態路由。再通過EIGRP告知全網,那麼具體實現如下:
一共有三種方式,方法一:
首先我們在R3上配置一條預設路由:
R3(config)#ip route 0.0.0.0 0.0.0.0 f0/0
R3(config)#do show ip route
Codes: C - connected, S - static , R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 0.0.0.0 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/435200] via 192.168.2.1, 00:08:41, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.2.1, 00:08:10, FastEthernet0/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
D 192.168.1.0/24 [90/307200] via 192.168.2.1, 00:08:41, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
S* 0.0.0.0/0 is directly connected, FastEthernet0/0
可見,S*即為剛才新增的預設路由(S為靜態路由,帶*號的為預設路由)
同樣的方法在R4上配置預設路由(為了資料包返回) R4(config)#ip route 0.0.0.0 0.0.0.0 f 0/0
接下來就是如何將R3上的預設路由通過EIGRP宣告出去了 R3(config)#router eigrp 100
下面我們在R1上檢視路由表
R3(config-router)#redistribute static
R1(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 192.168.1.2 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.1.2, 00:11:34, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/435200] via 192.168.1.2, 00:11:27, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
D 192.168.2.0/24 [90/307200] via 192.168.1.2, 00:12:33, FastEthernet0/0
D 192.168.3.0/24 [90/332800] via 192.168.1.2, 00:12:05, FastEthernet0/0
D*EX 0.0.0.0/0 [170/332800] via 192.168.1.2, 00:00:30, FastEthernet0/0
我們看見多了一條標記為D*EX的路由,這裡D表示這條路由來自EIGRP,*表示為預設路由,EX代表是EIGRP轉發其他協議的路由。我們由R1pingR4的環回口試試網路是否連通:
R1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
..!!!
Success rate is 60 percent (3/5), round-trip min/avg/max = 56/66/76 ms
Ok!連通(前面兩個資料包沒有到達是因為RIP的原因)
方法二:
與方法一一樣,先在R3和R4上寫入預設路由,然後在R3上的操作略有區別: R3(config)#router ei 100
no redistribute static這條命令是移除剛才方法一的重分發靜態路由的操作,然後我們直接將靜態路由的網路邊界通過network語句宣告出去,這下我們再來R1上檢視一下路由表看是否有變化:
R3(config-router)#no redistribute static
R3(config-router)#network 0.0.0.0 0.0.0.0
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 192.168.1.2 to network 0.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.1.2, 00:16:55, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/435200] via 192.168.1.2, 00:16:48, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
D 192.168.2.0/24 [90/307200] via 192.168.1.2, 00:17:54, FastEthernet0/0
D 192.168.3.0/24 [90/332800] via 192.168.1.2, 00:17:26, FastEthernet0/0
D* 0.0.0.0/0 [90/332800] via 192.168.1.2, 00:01:44, FastEthernet0/0
可見沒有了EX標記,因為這條路由是通過EIGRP宣告出來的,是屬於EIGRP協議內鄰居轉發來的路由,而不是重分發的靜態路由,所以沒喲EX標誌。我們再來嘗試一下R1pingR4:
R1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/55/76 ms
Ok!連通
方法三(思科官方推薦方法)
方法三為思科官方推薦做法,本方法配置預設路由的方法和剛剛略有區別,我們先來R3上配置預設路由:
R3(config)#no ip route 0.0.0.0 0.0.0.0 f0/0
R3(config)#ip route 4.0.0.0 255.0.0.0 f0/0
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/435200] via 192.168.2.1, 00:23:47, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.2.1, 00:23:17, FastEthernet0/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
S 4.0.0.0/8 is directly connected, FastEthernet0/0
D 192.168.1.0/24 [90/307200] via 192.168.2.1, 00:23:47, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R3(config)#ip default-network 4.0.0.0
R3(config)#do show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is not set
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/435200] via 192.168.2.1, 00:24:07, FastEthernet0/1
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.2.1, 00:23:36, FastEthernet0/1
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
S* 4.0.0.0/8 is directly connected, FastEthernet0/0
D 192.168.1.0/24 [90/307200] via 192.168.2.1, 00:24:07, FastEthernet0/1
C 192.168.2.0/24 is directly connected, FastEthernet0/1
C 192.168.3.0/24 is directly connected, FastEthernet0/0
R3(config)#router ei 100
R3(config-router)#net 4.0.0.0 0.255.255.255
我們為了和0.0.0.0(預設路由)區別,我們使用4.0.0.0來配置這個預設路由(R4的環回口4.4.4.4被包含在內),首先我們將4.0.0.0這條路由寫入為靜態,然後我們使用ip default-network命令來使它成為預設路由,之後我們再在EIGRP上通過network將其宣告出去
我們再在R1上檢視路由表,並且pingR4:
R1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route
Gateway of last resort is 192.168.1.2 to network 4.0.0.0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/409600] via 192.168.1.2, 00:28:15, FastEthernet0/0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/435200] via 192.168.1.2, 00:28:07, FastEthernet0/0
D* 4.0.0.0/8 [90/332800] via 192.168.1.2, 00:04:40, FastEthernet0/0
C 192.168.1.0/24 is directly connected, FastEthernet0/0
D 192.168.2.0/24 [90/307200] via 192.168.1.2, 00:29:14, FastEthernet0/0
D 192.168.3.0/24 [90/332800] via 192.168.1.2, 00:28:46, FastEthernet0/0
R1#ping 4.4.4.4
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 32/58/76 ms
接收到了這條路由並且可以聯通