视频教程:https://edu.csdn.net/course/detail/30858
视频教程:https://edu.csdn.net/course/detail/31400
文章每日实时更新
实验目的
- 了解 EIGRP 基本配置;
- 了解 EIGRP 自动汇总机制;
- 了解 EIGRP 手工汇总方式;
- 所有的设备完成基本配置(hostname、接口 IP 等)
R1 的配置如下:
Router> enable
Router# configure terminal
Router(config)# hostname R1
R1(config)# interface serial0/0
R1(config-if)# ip address 192.168.12.1 255.255.255.0
R1(config-if)# no shutdown
R1(config-if)# interface FastEthernet1/0
R1(config-if)# ip address 172.16.1.254 255.255.255.0
R1(config-if)# no shutdown
R2 的配置如下:
Router>configure terminal
Router(config)# hostname R2
R2(config)# interface serial0/0
R2(config-if)# clock rate 64000
R2(config-if)# ip address 192.168.12.2 255.255.255.0
R2(config-if)# no shutdown
R2(config-if)# interface serial0/1
R2(config-if)# clock rate 64000
R2(config-if)# ip address 192.168.23.2 255.255.255.0
R2(config-if)# no shutdown
R3 的配置如下:
Router>configure terminal
Router(config)# hostname R3
R3(config)# interface serial0/0
R3(config-if)# ip address 192.168.23.3 255.255.255.0
R3(config-if)# no shutdown
R3(config)# interface loopback1
R3(config-if)# ip address 172.16.32.1 255.255.255.0
R3(config-if)# interface loopback2
R3(config-if)# ip address 172.16.33.1 255.255.255.0
R3(config-if)# interface loopback3
R3(config-if)# ip address 172.16.34.1 255.255.255.0
PC1 的配置如下:
Router> enable
Router# configure terminal
Router(config)# hostname PC1
PC1(config)# no ip routing
PC1(config)# ip default-gateway 172.16.1.254
PC1(config)# interface fastethernet 0/0
PC1(config-if)# ip address 172.16.1.1 255.255.255.0
PC1(config-if)# no shutdown - 在 R1、R2、R3 上运行 EIGRP
R1 的配置如下:
R1(config)# router eigrp 100
R1(config-router)# network 192.168.12.0 0.0.0.255
R1(config-router)# network 172.16.1.0 0.0.0.255
R2 的配置如下:
R2(config)# router eigrp 100
R2(config-router)# network 192.168.12.0 0.0.0.255
R2(config-router)# network 192.168.23.0 0.0.0.255
R3 的配置如下:
R3(config)# router eigrp 100
R3(config-router)# network 192.168.23.0 0.0.0.255
R3(config-router)# network 172.16.0.0 0.0.255.255
!!方便起见,用一条命令在所有环回接口上激活 EIGRP
完成配置后先检查一下协议的运行情况:
R2#show ip eigrp neighbors
IP-EIGRP neighbors for process 100
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 192.168.23.3 Se0/1 14 00:02:47 86 516 0 5
0 192.168.12.1 Se0/0 11 00:03:00 54 324 0 3
上面就是 R2 的 EIGRP 邻居表,可以看到 R2 已经与 R1 及 R3 建立了 EIGRP 邻居关系。
H 邻居的顺序号。
Address 邻居路由器的接口地址。
Interface 本地连接该邻居的接口。
Hold 保持时间,在收到邻居任何分组时,认为邻居 down 前等待的最长时间
计时器在收到邻居发送的任何报文后复位。
Uptime 邻居关系已经建立了多长时间。
SRTT 向邻居路由器发送一个数据包后本路由器收到确认包的时间。
RTO 当发了 update 包之后,对方在该时间内没有回应(确认)则需要进行重传。
Q Cnt 队列中等待发送的报文数量,正常情况下应该为 0。
Seq Num 从邻居收到的最后一个更新、查询或应答分组的序列号。
完成上述配置后,我们测试一下 PC1 去 ping 172.16.32.1,结果不通,问题和我们在 RIP 实
验中是一样的,EIGRP 也有自动汇总机制,因此 R1 及 R3 都会将本地的 172.16 的子网汇总
成 B 类的 172.16.0.0/16 的汇总路由公告出去。我们看一下 R1 的路由表:
R1#show ip route
C 192.168.12.0/24 is directly connected, Serial0/0
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.0.0/16 is a summary, 00:00:37, Null0
C 172.16.1.0/24 is directly connected, FastEthernet1/0
D 192.168.23.0/24 [90/2681856] via 192.168.12.2, 00:00:30, Serial0/0
R1 已经学习到了 192.168.23.0,但是有一条奇怪的路由 172.16.0.0/16 指向的是 null0。这条
路由是 R1 自动产生的,EIGRP 在路由汇总后,会在本地路由表里自动产生一条指向 Null0 的
汇总路由,这是为了防环。
R2#show ip route
C 192.168.12.0/24 is directly connected, Serial0/0
D 172.16.0.0/16 [90/2172416] via 192.168.12.1, 00:11:49, Serial0/0
C 192.168.23.0/24 is directly connected, Serial0/1
看到 R2 的路由表中,仅有一条汇总路由,学习自 R1。但是为什么没有从 R3 学习到汇总路
由呢?实际上 R2 已经学习到了,但是由于从 R3 那学到的 172.16.0.0/16 的路由度量值更大,
因此没有被优选,从 R2 的 EIGRP 拓扑数据库里能够看到从 R3 学习到的汇总路由:
R2#show ip eigrp topology
IP-EIGRP Topology Table for AS(100)/ID(192.168.23.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 192.168.12.0/24, 1 successors, FD is 2169856
via Connected, Serial0/0
P 192.168.23.0/24, 1 successors, FD is 2169856
via Connected, Serial0/1
P 172.16.0.0/16, 1 successors, FD is 2172416
via 192.168.12.1 (2172416/28160), Serial0/0
via 192.168.23.3 (2297856/128256), Serial0/1 !! 通告距离更大,Metric更大
由于 R3 下挂的 172.16 的那些子网是来自 Loopback 接口的,而 R1 下挂的子网是来自快速
以太网接口的,因此 R3 产生的汇总路由度量值要大于 R1 产生的那条,故 R2 优选来自 R1
的路由。而 R3 的那条就成了可行后继。现在我们在三台路由器上都关闭 EIGRP 自动汇总。
R1 的配置如下:
R1(config)# router eigrp 100
R1(config-router)# no auto-summary
R2 的配置如下:
R2(config)#router eigrp 100
R2(config-router)# no auto-summary
R3 的配置如下:
R3(config)#router eigrp 100
R3(config-router)# no auto-summary
在关闭了自动汇总后,R1 下联的 172.16.1.0/24 子网及 R3 底下的 Loopback 明细路由就能过
来了,网络通信也就正常了。
R2#show ip route
C 192.168.12.0/24 is directly connected, Serial0/0
172.16.0.0/24 is subnetted, 4 subnets
D 172.16.32.0 [90/2297856] via 192.168.23.3, 00:00:22, Serial0/1
D 172.16.33.0 [90/2297856] via 192.168.23.3, 00:00:22, Serial0/1
D 172.16.34.0 [90/2297856] via 192.168.23.3, 00:00:22, Serial0/1
D 172.16.1.0 [90/2172416] via 192.168.12.1, 00:00:32, Serial0/0
C 192.168.23.0/24 is directly connected, Serial0/1 - 配置 EIGRP 手工汇总
现在,我们在 R3 上,为这条三 Loopback 路由进行手工汇总,经过计算,网络号 172.16.32.0/22
正好可以将这三条 Loopback 明细路由囊括住。现在,R3 增加如下配置:
R3(config)#interface Serial0/0
R3(config-if)# ip summary-address eigrp 100 172.16.32.0 255.255.252.0
EIGRP 的手工汇总,是配置在接口上的,注意要跟上 eigrp 的 AS 号 100,然后我们上 R2 看
看去:
R2#show ip route
C 192.168.12.0/24 is directly connected, Serial0/0
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
D 172.16.32.0/22 [90/2297856] via 192.168.23.3, 00:00:45, Serial0/1
D 172.16.1.0/24 [90/2172416] via 192.168.12.1, 00:01:02, Serial0/0
C 192.168.23.0/24 is directly connected, Serial0/1
这样一来 PC1 访问 R3 及其下的 Loopback 就没有问题了,同时,网络中的路由条目也做到
了优化。
视频教程:https://edu.csdn.net/course/detail/30858
视频教程:https://edu.csdn.net/course/detail/31400
文章每日实时更新