呵呵,我又来了,今天来做一下Cisco私有的路由协议——EIGRP基本配置。
EIGRP用AS(自治系统)编号来指定拥有相同路由的路由器集合,凡是属于同一区域的网段,都要求拥有相同的AS号,范围是1-65535。AS号不同的路由器之间不能建立邻接关系,无法同一路由信息,除非做再发布。
实验环境:
R1基本配置:
Router>
Router>en
Router#conf t
Router1(config)#hostname R1
R1(config)#interface loopback 0
R1(config-if)#ip address 1.1.1.1 255.255.255.255
R1(config-if)#interface s1/0
R1(config-if)#ip address 12.12.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#int fa0/0
R1(config-if)#ip address 13.13.13.1 255.255.255.0
R1(config-if)#no shutdown
R2基本配置:
Router>
Router>en
Router(config)#hostname R2
R2(config)#interface loopback 0
R2(config-if)#ip address 2.2.2.2 255.255.255.255
R2(config-if)#int s1/0
R2(config-if)#ip address 12.12.12.2 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#int s1/1
R2(config-if)#ip address 23.23.23.1 255.255.255.0
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config-if)#exit
R3基本配置:
Router>
Router>en
Router#conf t
Router(config)#hostname R3
R3(config)#interface loopback 0
R3(config-if)#ip address 3.3.3.3 255.255.255.255
R3(config-if)#int s1/1
R3(config-if)#ip address 23.23.23.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#int fa0/0
R3(config-if)#ip address 13.13.13.2 255.255.255.0
R3(config-if)#no shutdown
R3(config-if)#exit
基本配置已近完成,下面在各路由器上起EIGRP协议,
R1(config-if)#exit
R1(config)#router eigrp 100
R1(config-router)#network 1.1.1.1 0.0.0.0
R1(config-router)#network 12.12.12.0 0.0.0.255
//宣告允许发布的直连网段,用通配符掩码定义范围
R1(config-router)#network 13.13.13.0 0.0.0.255
R1(config-router)#no auto-summary //关闭自动汇总
R1(config-router)#exit
R2(config)#router eigrp 100
R2(config-router)#no network 2.2.2.2 0.0.0.0
R2(config-router)#network 12.12.12.0 0.0.0.255
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 12.12.12.1 (Serial1/0) is up: new adjacenc
//提示邻居建立
R2(config-router)#network 23.23.23.0 0.0.0.255
R2(config-router)#no auto-summary
R2(config-router)#exit
R3(config)#router eigrp 100
R3(config-router)#network 3.3.3.3 0.0.0.0
R3(config-router)#network 23.23.23.0 0.0.0.255
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 23.23.23.1 (Serial1/1) is up: new adjacency
R3(config-router)#network 13.13.13.0 0.0.0.255
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 13.13.13.1 (FastEthernet0/0) is up: new adjacency
R3(config-router)#no auto-summary
R3(config-router)#exit
我们来查看EIGRP信息,
R1#show ip eigrp neighbors //查看R1的EIGRP邻居表
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
0 12.12.12.2 Ser1/0 12 00:12:06 40 1000 0 31
1 13.13.13.2 Fa0/0 12 00:08:28 40 1000 0 32
R1#show ip eigrp interfaces
IP-EIGRP interfaces for process 100
Xmit Queue Mean Pacing Time Multicast Pending
Interface Peers Un/Reliable SRTT Un/Reliable Flow Timer Routes
Lo0 0 0/0 1236 0/10 0 0
Ser1/0 1 0/0 1236 0/10 0 0
Fa0/0 1 0/0 1236 0/10 0 0
R1#show ip eigrp topology
IP-EIGRP Topology Table for AS 100
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - Reply status
P 1.1.1.1/32, 1 successors, FD is 128256
via Connected, Loopback0
P 12.12.12.0/24, 1 successors, FD is 20512000
via Connected, Serial1/0
P 1.0.0.0/8, 1 successors, FD is 128256
via Summary (128256/0), Null0
P 12.0.0.0/8, 1 successors, FD is 20512000
via Summary (20512000/0), Null0
P 13.13.13.0/24, 1 successors, FD is 28160
via Connected, FastEthernet0/0
P 13.0.0.0/8, 1 successors, FD is 28160
via Summary (28160/0), Null0
P 2.2.2.2/32, 1 successors, FD is 20640000
via 12.12.12.2 (20640000/20640000), Serial1/0
via 13.13.13.2 (20642560/20640000), FastEthernet0/0
P 2.0.0.0/8, 1 successors, FD is 20640000
via 12.12.12.2 (20640000/128256), Serial1/0
via 13.13.13.2 (20642560/20640000), FastEthernet0/0
P 23.23.23.0/24, 1 successors, FD is 20514560
via 13.13.13.2 (20514560/20512000), FastEthernet0/0
via 12.12.12.2 (4294967295/20512000), Serial1/0
//去往23.23.23.0/24网段的可行继任者
P 23.0.0.0/8, 1 successors, FD is 20514560
via 13.13.13.2 (20514560/20512000), FastEthernet0/0
P 3.0.0.0/8, 1 successors, FD is 156160
via 13.13.13.2 (156160/128256), FastEthernet0/0
P 3.3.3.3/32, 1 successors, FD is 156160
via 13.13.13.2 (156160/128256), FastEthernet0/0
R1#show ip route eigrp
D 1.0.0.0/8 is a summary, 00:42:11, Null0
D 2.0.0.0/8 [90/20640000] via 12.12.12.2, 00:32:43, Serial1/0
D 2.2.2.2/32 [90/20640000] via 12.12.12.2, 00:04:53, Serial1/0
D 3.0.0.0/8 [90/156160] via 13.13.13.2, 00:29:08, FastEthernet0/0
D 3.3.3.3/32 [90/156160] via 13.13.13.2, 00:29:08, FastEthernet0/0
D 12.0.0.0/8 is a summary, 00:42:11, Null0
D 13.0.0.0/8 is a summary, 00:42:02, Null0
D 23.0.0.0/8 [90/20514560] via 13.13.13.2, 00:29:08, FastEthernet0/0
D 23.23.23.0/24 [90/20514560] via 13.13.13.2, 00:29:08, FastEthernet0/0
R1#show ip route
Codes: C - connected, S - static, I - IGRP, 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, E - EGP
i - IS-IS, 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/8 is variably subnetted, 2 subnets, 2 masks
D 1.0.0.0/8 is a summary, 00:42:56, Null0
C 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 2.0.0.0/8 [90/20640000] via 12.12.12.2, 00:33:29, Serial1/0
D 2.2.2.2/32 [90/20640000] via 12.12.12.2, 00:05:38, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.0.0.0/8 [90/156160] via 13.13.13.2, 00:29:53, FastEthernet0/0
D 3.3.3.3/32 [90/156160] via 13.13.13.2, 00:29:53, FastEthernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 12.0.0.0/8 is a summary, 00:42:56, Null0
C 12.12.12.0/24 is directly connected, Serial1/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 13.0.0.0/8 is a summary, 00:42:47, Null0
C 13.13.13.0/24 is directly connected, FastEthernet0/0
23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 23.0.0.0/8 [90/20514560] via 13.13.13.2, 00:29:53, FastEthernet0/0
D 23.23.23.0/24 [90/20514560] via 13.13.13.2, 00:29:53, FastEthernet0/0
//路由表中没有可行继任者,只有继任者条目
下面我们做EIGRP路由汇总,
先在R3上激活4个loopback口,
R3(config)#interface loopback 1
R3(config-if)#ip address 192.168.0.1 255.255.255.0
R3(config)#interface loopback 2
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config)#interface loopback 3
R3(config-if)#ip address 192.168.2.1 255.255.255.0
R3(config)#interface loopback 4
R3(config-if)#ip address 192.168.3.1 255.255.255.0
在R3上宣告网段,
R3(config-router)#network 192.168.0.1 0.0.0.255
R3(config-router)#network 192.168.1.1 0.0.0.255
R3(config-router)#network 192.168.2.1 0.0.0.255
R3(config-router)#network 192.168.3.1 0.0.0.255
在R1上查看路由表,
R1# sh ip rou
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 1.0.0.0/8 is a summary, 00:59:15, Null0
C 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 2.0.0.0/8 [90/20640000] via 12.12.12.2, 00:05:46, Serial1/0
D 2.2.2.2/32 [90/20640000] via 12.12.12.2, 00:21:57, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.0.0.0/8 [90/156160] via 13.13.13.2, 00:05:47, FastEthernet0/0
D 3.3.3.3/32 [90/156160] via 13.13.13.2, 00:05:47, FastEthernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 12.0.0.0/8 is a summary, 00:59:15, Null0
C 12.12.12.0/24 is directly connected, Serial1/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 13.0.0.0/8 is a summary, 00:59:06, Null0
C 13.13.13.0/24 is directly connected, FastEthernet0/0
23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 23.0.0.0/8 [90/20514560] via 13.13.13.2, 00:05:47, FastEthernet0/0
D 23.23.23.0/24 [90/20514560] via 13.13.13.2, 00:05:47, FastEthernet0/0
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
D 192.168.0.0/22 [90/20514560] via 13.13.13.2, 00:05:47, FastEthernet0/0
D 192.168.0.0/24 [90/156160] via 13.13.13.2, 00:02:44, FastEthernet0/0
D 192.168.1.0/24 [90/156160] via 13.13.13.2, 00:02:17, FastEthernet0/0
D 192.168.2.0/24 [90/156160] via 13.13.13.2, 00:00:22, FastEthernet0/0
D 192.168.3.0/24 [90/156160] via 13.13.13.2, 00:01:34, FastEthernet0/0
D 192.168.4.0/24 [90/44765440] via 13.13.13.2, 00:03:53, FastEthernet0/0
//可见到4条详细的路由信息,都来自fa0/0
下面在R3接口上开启路由汇总,
R3(config-if)#int fa0/0
R3(config-if)#ip summary-address eigrp 100 192.168.0.0 255.255.252.0
%DUAL-5-NBRCHANGE: IP-EIGRP 100: Neighbor 13.13.13.1 (FastEthernet0/0) is up: new adjacency //这里会重新建立一次邻居
R3(config-if)#int s1/1
R3(config-if)#ip summary-address eigrp 100 192.168.0.0 255.255.252.0
再到R1上查看路由表,
R1#sh ip route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 1.0.0.0/8 is a summary, 01:03:54, Null0
C 1.1.1.1/32 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 2.0.0.0/8 [90/20642560] via 13.13.13.2, 00:00:17, FastEthernet0/0
D 2.2.2.2/32 [90/20640000] via 12.12.12.2, 00:26:36, Serial1/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.0.0.0/8 [90/156160] via 13.13.13.2, 00:00:17, FastEthernet0/0
D 3.3.3.3/32 [90/156160] via 13.13.13.2, 00:00:17, FastEthernet0/0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 12.0.0.0/8 is a summary, 01:03:54, Null0
C 12.12.12.0/24 is directly connected, Serial1/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 13.0.0.0/8 is a summary, 01:03:45, Null0
C 13.13.13.0/24 is directly connected, FastEthernet0/0
23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 23.0.0.0/8 [90/20514560] via 13.13.13.2, 00:00:17, FastEthernet0/0
D 23.23.23.0/24 [90/20514560] via 13.13.13.2, 00:00:17, FastEthernet0/0
D 192.168.0.0/22 [90/30720] via 13.13.13.2, 00:00:17, FastEthernet0/0 //可见进行了路由汇总
再查看R3路由表,
R3#sh ip route
Gateway of last resort is not set
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 1.0.0.0/8 is a summary, 00:52:20, Null0
D 1.1.1.1/32 [90/156160] via 13.13.13.1, 00:00:41, FastEthernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 2.0.0.0/8 is a summary, 00:52:20, Null0
D 2.2.2.2/32 [90/20640000] via 23.23.23.1, 00:00:42, Serial1/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 3.0.0.0/8 is a summary, 00:52:36, Null0
C 3.3.3.3/32 is directly connected, Loopback0
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 12.0.0.0/8 is a summary, 00:52:20, Null0
D 12.12.12.0/24 [90/20514560] via 13.13.13.1, 00:00:41, FastEthernet0/0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 13.0.0.0/8 is a summary, 00:52:20, Null0
C 13.13.13.0/24 is directly connected, FastEthernet0/0
23.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 23.0.0.0/8 is a summary, 00:52:23, Null0
C 23.23.23.0/24 is directly connected, Serial1/1
192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
D 192.168.0.0/22 is a summary, 00:00:45, Null0
//由于路由汇总很容易产生环路,这里发布一条汇总指向null 0口,防止环路
C 192.168.0.0/24 is directly connected, Loopback1
C 192.168.1.0/24 is directly connected, Loopback2
C 192.168.2.0/24 is directly connected, Loopback3
C 192.168.3.0/24 is directly connected, Loopback4
实验结束。
转载于:https://blog.51cto.com/wumeng/277481