eigrp协议-基础配置,和rip的比较

2020-05-30  本文已影响0人  小吉头

eigrp协议作用

是思科的私有协议,如果在网络设备混杂是不能使用eigrp的。作用是让路由器之间建立邻居关系,互相学习路由,再将直连路由和学到的路由传给其他路由器。

做个实验

R1 f0/0 10.1.12.1/24 f0/1 10.1.13.1/24
R2 f0/0 10.1.12.2/24 l0 2.2.2.2/24
R3 f0/0 10.1.13.3/24 l0 3.3.3.3/24

//R1 f0/0,f0/1启用eigrp示例,R3、R3省略
R1(config)#router eigrp ?
  <1-65535>  Autonomous system number
R1(config)#router eigrp 1
R1(config-router)#no auto-summary
R1(config-router)#network 10.1.12.0 0.0.0.255 //R1的接口ip地址如果在10.1.12.0这个网段范围内就开启eigrp协议。f0/0符合开启eigrp
R1(config-router)#network 10.1.13.1 0.0.0.0 //精确到ip匹配,f0/1符合开启eigrp

Autonomous system number是系统号,由16位二进制组成,范围从1-65535,如果路由器之间开启了eigrp想建立邻居关系,系统号必须一致。所以R3、R3上配置时系统号必须跟R1一样。
network 10.1.12.0 0.0.0.255:0.0.0.255是反掩码写法,0表示精确匹配,1表示任意。所以表示的范围是10.1.12.0-10.1.12.255。反掩码和正掩码都是连续的,不能穿插。以255为例,二进制1111 1111,不能写成1101 1111。
都开启eigrp后,查看路由表:

R1:
     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/409600] via 10.1.12.2, 00:00:49, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/409600] via 10.1.13.3, 00:00:08, FastEthernet0/1
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0
R2:
     2.0.0.0/24 is subnetted, 1 subnets
C       2.2.2.0 is directly connected, Loopback0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/435200] via 10.1.12.1, 00:00:40, FastEthernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
D       10.1.13.0 [90/307200] via 10.1.12.1, 00:01:28, FastEthernet0/0
C       10.1.12.0 is directly connected, FastEthernet0/0
R3:
     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/435200] via 10.1.13.1, 00:00:20, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
C       3.3.3.0 is directly connected, Loopback0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/0
D       10.1.12.0 [90/307200] via 10.1.13.1, 00:00:20, FastEthernet0/0

D 2.2.2.0 [90/409600] via 10.1.12.2, 00:00:49, FastEthernet0/0
D表示eigrp协议,10.1.12.2表示下一跳,00:00:49表示在路由表中已存在的时间,FastEthernet0/0 表示出接口

eigrp的四张表

1、接口列表

查看路由器下哪些接口开启了eigrp(rip协议没有这张表)

R1#show ip eigrp interfaces 
IP-EIGRP interfaces for process 1

                        Xmit Queue   Mean   Pacing Time   Multicast    Pending
Interface        Peers  Un/Reliable  SRTT   Un/Reliable   Flow Timer   Routes
Fa0/0              1        0/0       111       0/2          436           0
Fa0/1              1        0/0       116       0/2          460           0

2、邻居表

跟哪些设备建立了邻居关系(rip协议没有这张表,rip协议没有邻居表的概念,不管有没有路由器相连都会把自己的路由消息发出去,比较落后)

R1#show ip eigrp neighbors 
IP-EIGRP neighbors for process 1
H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                            (sec)         (ms)       Cnt Num
1   10.1.13.3               Fa0/1             13 00:04:50  116   696  0  5
0   10.1.12.2               Fa0/0             12 00:05:32  111   666  0  5

eigrp协议下,R1和R2想要路由信息共享,必须要先建立邻居关系
邻居表中Hold时间的作用:
以R1和R2为例,虽然已经成功建立邻居关系并实现路由共享,还是会每隔5秒互相发送一次hello包,防止对方网络断开,如果对方端口需要从自己路由表中删除断开的路由。不断刷新邻居表可以看到从14、13、12、11、10->接收到hello包->14、13、12、11、0->接收到hello包,不断循环。如果在15秒内没有收到对方的hello包,说明对方网络已断开。
测试,设置R2 f0/0接口down,查看R1的邻居表:
Hold时间从14、13、12、...、0,14一直倒计时到0,正好15秒,然后自动删除该失效的路由,并提示IP-EIGRP(0) 1: Neighbor 10.1.12.2 (FastEthernet0/0) is down: holding time expired
测试,再设置R2 f0/0接口up
R1会提示 IP-EIGRP(0) 1: Neighbor 10.1.12.2 (FastEthernet0/0) is up: new adjacency,又自动建立了新的邻居关系

3、数据库表(拓扑表)

R1#show ip eigrp topology 
IP-EIGRP Topology Table for AS(1)/ID(10.1.13.1)

Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
       r - reply Status, s - sia Status 

P 2.2.2.0/24, 1 successors, FD is 409600
        via 10.1.12.2 (409600/128256), FastEthernet0/0
P 3.3.3.0/24, 1 successors, FD is 409600
        via 10.1.13.3 (409600/128256), FastEthernet0/1
P 10.1.13.0/24, 1 successors, FD is 281600
        via Connected, FastEthernet0/1
P 10.1.12.0/24, 1 successors, FD is 281600
        via Connected, FastEthernet0/0

4、路由表

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 not set

     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/409600] via 10.1.12.2, 00:09:54, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/409600] via 10.1.13.3, 00:48:32, FastEthernet0/1
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0

eigrp中数据库表包含了路由表,数据库中会还存放备份路由,所以收敛速度比较快(本例中没有备份路由),路由表中只有最优的。而rip中数据库表跟路由表内容一样。

表之间的关系

先建立邻居表,然后把学到的路由放到数据库表中,最优的路由放到路由表中

同时开启eigrp和rip实验

R2新增环回口l1,4.4.4.0/24,ip是4。4.4.4.2



以R1和R2为例,R1 f0/0,f0/1已开启eigrp,R2 f0/0,l0已开启eigrp,l1没有开启任何协议。
设置R1 f0/0,f0/1开启rip,R2 f0/0,l0,l1开启rip

//R1 f0/0,f0/1开启rip
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#net 10.0.0.0
//R2 f0/0,l0,l1开启rip
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 2.0.0.0
R2(config-router)#network 4.0.0.0
R2(config-router)#network 10.0.0.0
//查看R1路由表
     2.0.0.0/24 is subnetted, 1 subnets
D       2.2.2.0 [90/409600] via 10.1.12.2, 00:01:51, FastEthernet0/0
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/409600] via 10.1.13.3, 00:01:51, FastEthernet0/1
     4.0.0.0/24 is subnetted, 1 subnets
R       4.4.4.0 [120/1] via 10.1.12.2, 00:00:16, FastEthernet0/0
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0

通过R1路由表看到l1接口只开了rip,4.4.4.0/24路由已经通过rip学到,2.2.2.0/24同时开启了rip和eigrp,最终路由表只选择管距小的。
管理距离越小越优先:
直连 0
静态 1
rip 120
eigrp 90
R2 l0同时开启了rip和eigrp,由于eigrp管距小,所以能进路由表。
现在关闭l0的eigrp,再看R1中2.2.2.0/24这条路由的变化:

//关闭R2 l0接口的eigrp
R2(config)#router eigrp 1
R2(config-router)#no network 2.2.2.2 0.0.0.0
//查看R1路由表2.2.2.0/24路由变化
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 10.1.12.2, 00:00:01, FastEthernet0/0

R1 2.2.2.0/24已经从eigrp变成了rip。同时开启路由协议相当于做了协议的备份,高级的协议关了,低级的协议能够替代。

显示不同协议的路由

R1#show ip route eigrp 
     3.0.0.0/24 is subnetted, 1 subnets
D       3.3.3.0 [90/409600] via 10.1.13.3, 00:19:18, FastEthernet0/1
R1#show ip route rip   
     2.0.0.0/24 is subnetted, 1 subnets
R       2.2.2.0 [120/1] via 10.1.12.2, 00:00:09, FastEthernet0/0
     4.0.0.0/24 is subnetted, 1 subnets
R       4.4.4.0 [120/1] via 10.1.12.2, 00:00:09, FastEthernet0/0
R1#show ip route connected 
     10.0.0.0/24 is subnetted, 2 subnets
C       10.1.13.0 is directly connected, FastEthernet0/1
C       10.1.12.0 is directly connected, FastEthernet0/0
上一篇 下一篇

猜你喜欢

热点阅读