> 文章列表 > EIGRP配置邻居关系详解

EIGRP配置邻居关系详解

EIGRP配置邻居关系详解

1.2 EIGRP 邻居关系

1.2.1 实验目的

通过 EIGRP 邻居建立的相关实验,学习到如何调整 EIGRP 的 HELLO 和 HOLD 时间,使用
被动接口阻止不必要的邻居关系,认证 EIGRP 邻居,静态邻居的配置以及哪些参数影响 EIGRP
邻居建立。

1.2.2 实验拓扑

EIGRP配置邻居关系详解

1.2.3 实验步骤

  1. 首先在 R1,R2,R3 相关接口配置好 IP 地址,并且各自配置一个环回口,R1 的环
    回口 loopback 0 地址为 1.1.1.1/24,R2 的环回口 loopback 0 地址为 2.2.2.2/24,依
    次类推。注意保证直连接口的连通性。

  2. 在 R1 和 R2 上分别配置 EIGRP 100,并且将各自相关接口加入 EIGRP 进程中,相互
    学习到路由。
    R1(config)#router eigrp 100
    R1(config-router)#no auto-summary
    R1(config-router)#network 1.1.1.0 0.0.0.255
    R1(config-router)#network 10.10.12.0 0.0.0.255
    R2(config)#router eigrp 100
    R2(config-router)#no auto-summary
    R2(config-router)#network 2.2.2.0 0.0.0.255
    R2(config-router)#network 10.10.12.0 0.0.0.255
    R2(config-router)#
    *Mar 1 00:02:52.587: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 10.10.12.1
    (Ethernet0/1) is up: new adjacency //日志显示邻居正常建立

  3. 在 R1 上,更改对于 R2 的 EIGRP 的 Hello 和 hold 时间。
    R1(config)#int e0/0
    R1(config-if)#ip hello-interval eigrp 100 3 //将 Hello 时间更改为 3s
    R1(config-if)#ip hold-time eigrp 100 9 //将 Hold 时间更改为 9s

  4. 在 R1 上使用命令 show ip eigrp interfaces detail 可以验证 hello 时间已经被更改为
    3s。
    同时在 R2 上使用命令 show ip eigrp neighbor 可以查看到 R1 的 hold 时间。
    最大为 8s,则 hold 时间被更改为 9s。

  5. 要求R1路由表需要10.10.23.0/24的路由,因此R2上可以加入一条network命令。
    R2(config)#router eigrp 100
    R2(config-router)#network 10.10.23.0 0.0.0.255
    R2(config-router)#exit
    但是一旦加入该命令,就会使得 R2 的 E0/0 接口加入 EIGRP 100 进程,会正常收
    发 EIGRP 的 Hello 包。为了阻止 R2 和 R3 建立邻居,我们可以使用被动接口
    (passive-interface),其原理就是被动接口不发送 Hello 包,从而无法正常建立邻
    居关系。

  6. 将 R2 的 E0/0 接口设置为被动接口。
    R2(config)#router eigrp 100
    R2(config-router)#passive-interface e0/0 //将 E0/0 设置为被动接口
    通过命令 debug eigrp packets hello 我们可以发现,R2 确实没有在 E0/0 接口发送
    Hello 包。
    R2#debug eigrp packets hello
    EIGRP Packets debugging is on
    (HELLO)
    *Mar 1 00:21:36.311: EIGRP: Sending HELLO on Ethernet0/1
    *Mar 1 00:21:36.311: AS 100, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0
    *Mar 1 00:21:36.615: EIGRP: Received HELLO on Ethernet0/1 nbr 10.10.12.1
    *Mar 1 00:21:36.619: AS 100, Flags 0x0, Seq 0/0 idbQ 0/0 iidbQ un/rely 0/0 peerQ
    un/rely 0/0
    新版 CCNP 实验手册
    14
    还存在另一种配置形式。
    R2(config)#router eigrp 100
    R2(config-router)#passive-interface default //使所有接口成为被动接口
    R2(config-router)#no passive-interface e0/1 //开启所需要的非被动接口

  7. 为 R1 和 R2 配置 EIGRP 认证。
    首先需要在各自路由器上配置 key chain(钥匙串),然后定义钥匙串上的钥匙,以
    编号来区分。
    R1(config)#key chain CCNP
    R1(config-keychain)#key 1
    R1(config-keychain-key)#key-string CCNP
    上述步骤定义了一个名为 CCNP 的钥匙串,并且该钥匙串上编号为 1 的钥匙为
    CCNP。
    R1(config-keychain-key)#?
    Key-chain key configuration commands:
    accept-lifetime Set accept lifetime of key
    default Set a command to its defaults
    exit Exit from key-chain key configuration mode
    key-string Set key string
    no Negate a command or set its defaults
    send-lifetime Set send lifetime of key
    还可以通过可选项accept-lifetime和send-lifetime来设置该编号钥匙的接受和发送
    时间,从而达到根据不同时间采用不同编号钥匙的目的。(这里对于基于时间变换
    钥匙的实验就不验证了)
    然后在需要认证的接口启用 EIGRP 认证,并且关联到相关的 key chain 上。
    R1(config)#int e0/0
    R1(config-if)#ip authentication mode eigrp 100 md5 //开启 EIGRP 的 MD5 认证
    R1(config-if)#ip authentication key-chain eigrp 100 CCNP //认证材料为钥匙串
    CCNP
    *Mar 1 00:33:54.083: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 10.10.12.2
    (Ethernet0/0) is down: authentication mode changed
    由于 R2 目前尚未配置认证信息,因此 R1 和 R2 的邻居关系 down 掉。
    在 R2 上配置一个钥匙串,配置好相关编号钥匙,并且在相应接口启用。
    R2(config)#key chain CCNA //R2 上的钥匙串名为 CCNA
    R2(config-keychain)#key 1 //钥匙编号依然为 1
    R2(config-keychain-key)#key-string CCNP //内容一致,为 CCNP
    R2(config-keychain-key)#exit
    R2(config-keychain)#exit
    R2(config)#int e0/1
    R2(config-if)#ip authentication mode eigrp 100 md5
    新版 CCNP 实验手册
    15
    R2(config-if)#ip authentication key-chain eigrp 100 CCNA
    R2(config-if)#
    *Mar 1 00:38:28.415: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 10.10.12.1
    (Ethernet0/1) is up: new adjacency //邻居重新正常建立。
    通过上述实验可以总结出,EIGRP 支持 MD5 密文认证,并且依靠钥匙串的支持。
    同时在认证的过程中,钥匙串的名称只是本地起效的,双方不需要一致,但钥匙
    编号和钥匙内容必须要一致!

  8. 在某些不支持组播或者广播的链路上时,如果需要建立 EIGRP 邻居,那么可以采
    用单播方式。这个时候就需要静态的指定邻居。
    要求 R2 和 R3 之间通过静态指定邻居的方式建立邻居。
    首先删去之前 R2 上被 passive 掉的接口。
    R2(config)#router eigrp 100
    R2(config-router)#no passive-interface e0/0
    然后在 R2 上静态的指定 R3 作为其邻居。
    R2(config-router)#neighbor 10.10.23.3 e0/0 //注意,该命令所指邻居必须和自己
    在同一子网,并且需要给出接口。
    R3 的配置如下:
    R3(config)#router eigrp 100
    R3(config-router)#no au
    R3(config-router)#network 10.10.23.0 0.0.0.255
    R3(config-router)#nei 10.10.23.2 e0/1
    *Mar 1 00:48:47.431: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 10.10.23.2
    (Ethernet0/1) is up: new adjacency //邻居成功建立。
    通过如下命令可以验证该邻居为静态邻居。
    如果在某个接口指定了静态邻居,那么该接口的动态邻居将会全部丢失!

  9. 总结上述实验,影响 EIGRP 邻居建立的相关参数有:
    l 两台路由器能够相互通信
    l AS 号必须一致
    l Hello 和 Hold 间隔不影响邻居建立
    l 如果有认证,认证必须一致
    l 度量计算的 K 值必须一致(将在下一实验中详细介绍)

EIGRP配置邻居关系详解