动态路由协议 EIGRP

  • 高级距离矢量协议
  • 快速收敛
  • 管理距离:
    • 内部:90
    • 外部:170
    • 汇总:5
  • 组播地址:224.0.0.10
  • 协议号:88
  • 支持VLSM和不连续的子网
  • 局部更新
  • 支持多种网络层协议
  • 灵活的网络设计
  • 组播和单播代替广播更新
  • 在网络中任何地方实现手动汇总
  • 100%无环路的无类路由
  • 支持WANs and LANs
  • 等价和非等价负载均衡
  • 以前是cisco专有的路由协议,现在开源了,别的厂商的路由器也可以使用EIGRP协议了。

EIGRP关键技术

  • 邻居发现:使用hello包发现邻居

  • 可靠传输协议(RTP):保证EIGRP的包到达所有的邻居。

    保证到达的理由:hello包发送后,ack回应hello,OSPF在hello包后,没有ack回应,OSPF只有在LSU后,ack回应LSU

  • DUAL 弥散更新算法

    Selects lowest-cost,loop free,paths to each destination

    作用:

    • 无环路径
    • 无环备用路径,可立即使用
    • 快速收敛
    • 限定更新以使用最少带宽

    根据上图,说一下形成环路的具体情形:假设A要去E,A发现有3条路,到C的开销是10,开销最小,所以先到了C,然后C去判断,发现到E要130,但到A,再到B,再到E,加起来才是110,所以C又选择了A,就又回到了A,这就形成了环路。

  • DUAL术语

    • 后继路由器:successor

      最优的下一跳是后继路由器。

    • 可行距离:Feasible distance(FD)

      到达目的地的总开销

    • 可行后继路由器:Feasible successor(FS)

      最优的下一跳升级成后继路由器,那么剩下的也能到达目的地的下一跳,就是可行后继路由器。当successor坏掉了,FS就会被升级成successor,成为下一跳。由于有了FS,所以实现了快速收敛(不需要再次寻找路由,OSPF的话,就需要再次计算寻找新的路由)。

    • 报告距离:Reported Distance(RD)/通告距离(AD)

      邻居告诉我到达邻居的开销

    • 可行条件:Feasibility Condition(FC)

      能够成为FS的条件:自己的FD-自己的AD < successor的FD

      并不是所有的可行通路上的路由器都能成为FS.

      由于这个条件的存在,就防止了环路的形成。

  • 协议独立模块(PDMs)

    EIGRP支持网络层的IP,AppleTalk和Novell NetWare协议。

    每一种网络协议支持EIGRP都有自己独立的模块

  • 要维护3张表,而且表的创建顺序有要求必须要建立邻居表,然后是拓扑表,最好是路由表

    • 邻居表

    • 拓扑表:记录所有邻居发送过来的路由信息,起了备份的作用。

    • 路由表

  • EIGRP Packets

    • hello:建立邻居关系
    • update:发送路由更新信息。
    • query:当发现路由失效了后,向原来提供此路由条目的下一跳,发送查询16次,如果都没有回应则删除此跳路由。
    • reply:回应query的报文。
    • ack

EIGRP的度量值(Metric)

EIGRP metric is IGRP metric multiplied by 256

下面5项信息放在hello包里,是key字段,key1是Bandwidth。

  • Bandwidth:带宽
  • Reliability:可靠性
  • Delay:延迟
  • Loading:负载
  • MTU:最大传输单元

EIGRP Metric的计算公式:

一般情况下,计算metric时,只使用Bandwidth和delay,所以得出如下的公式:

metric = 256*[(10^7/链路中经过的最小带宽) + (所经过的链路延迟之和)]

建立邻居的必要条件

  • as号(autonomous system number)必须相同:启动EIGRP时,选择的号码。不同的号码代表不同的EIGRP的策略(使用的key不同,所以metric的计算就不同,metric计算方式不同,就不能成为邻居)
  • key的使用必须相同:路由器1使用key1和key3,那么路由器1的邻居也必须使用key1和key3。但是key1和key3的值当让可以不一样。
  • 认证必须相同

试验部分:

  • 网络拓扑:

    串口:用于和外网连接,优点是网线长度可以很长,但是带宽太小,现在快被淘汰了。

    直线:快速以太网的链路,网线有长度限制。

    折线:串口间的链路。

  • 配置ip

    R1:

    R1(config)#int f0/0
    R1(config-if)#ip add 12.1.1.1 255.255.255.0
    R1(config-if)#no sh
    R1(config-if)#int s1/0
    R1(config-if)#ip add 13.1.1.1 255.255.255.0
    R1(config-if)#no sh
    
    R1#show ip int b
    Interface                  IP-Address      OK? Method Status                Protocol
    FastEthernet0/0            12.1.1.1        YES manual up                    up    
    Serial1/0                  13.1.1.1        YES manual up                    up 
    

    R2:

    R2(config)#int f0/0
    R2(config-if)#ip add 12.1.1.2 255.255.255.0
    R2(config-if)#no sh
    R2(config-if)#int f1/0
    R2(config-if)#ip add 24.1.1.2 255.255.255.0
    R2(config-if)#no sh
    
    R2#show ip int b
    Interface                  IP-Address      OK? Method Status                Protocol
    FastEthernet0/0            12.1.1.2        YES manual up                    up  
    FastEthernet1/0            24.1.1.2        YES manual up                    up
    

    R3:

    R3(config)#int s0/0
    R3(config-if)#ip add 13.1.1.3 255.255.255.0
    R3(config-if)#no sh
    R3(config)#int s0/1
    R3(config-if)#ip add 34.1.1.3 255.255.255.0
    R3(config-if)#no sh
    
    R3#show ip int b
    Interface                  IP-Address      OK? Method Status                Protocol
    Serial0/0                  13.1.1.3        YES manual up                    up  
    Serial0/1                  34.1.1.3        YES manual up                    up
    

    R4:

    R4(config-if)#ip add 24.1.1.4 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#int s1/0
    R4(config-if)#ip add 34.1.1.4 255.255.255.0
    R4(config-if)#no sh
    R4(config-if)#int lo0
    R4(config-if)#ip add 4.4.4.4 255.255.255.255
    
    R4#show ip int b
    Interface                  IP-Address      OK? Method Status                Protocol
    FastEthernet0/0            24.1.1.4        YES manual up                    up  
    Serial1/0                  34.1.1.4        YES manual up                    up
    
  • 启动EIGRP协议

    在全局模式下启动,启动后,要先关闭自动汇总,然后宣告自己的网段。

    宣告网段时:RIP不需要指定子网掩码,OSPF必须指定反掩码,EIGRP可以指定子网掩码也可以不指定;可以指定反掩码也可以不指定。

    R1:

    R1(config)#router eig
    R1(config)#router eigrp ?
      <1-65535>  Autonomous system number
    
    R1(config)#router eigrp 100
    R1(config-router)#
    R1(config-router)#no auto-summary
    R1(config-router)#net 12.1.1.0 0.0.0.255(反掩码)
    R1(config-router)#do show run | sec eigrp(查看掩码)
    router eigrp 100
     network 12.1.1.0 0.0.0.255
     no auto-summary
    R1(config-router)#no net 12.1.1.0 0.0.0.255(删除)
    R1(config-router)#net 12.1.1.0 255.255.255.0(再用掩码)
    R1(config-router)#do show run | sec eigrp(查看掩码)
    router eigrp 100
     network 12.1.1.0 0.0.0.255(还是反掩码,即使用掩码宣告)
     no auto-summary
    R1(config-router)#no net 12.1.1.0 255.255.255.0(删除)
    R1(config-router)#net 12.1.1.0(不指定掩码)
    R1(config-router)#do show run | sec eigrp
    router eigrp 100
     network 12.0.0.0
     no auto-summary
    R1(config-router)#net 13.1.1.1 0.0.0.255
    

    R2:

    R2(config)#router eigrp 100
    R2(config-router)#no au
    R2(config-router)#net 12.1.1.0 0.0.0.255
    R2(config-router)#
    *Mar  1 00:39:10.811: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 12.1.1.1 (FastEthernet0/0) is up: new adjacency
    R2(config-router)#net 24.1.1.0 0.0.0.255
    

    R3:

    R3(config)#router eigrp 100
    R3(config-router)#no au
    R3(config-router)#net 13.1.1.0 0.0.0.255
    R3(config-router)#net
    *Mar  1 00:41:32.223: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 13.1.1.1 (Serial0/0) is up: new adjacency
    R3(config-router)#net 34.1.1.0 0.0.0.255
    

    R4:

    R4(config)#router eigrp 100
    R4(config-router)#no au
    R4(config-router)#net 24.1.1.0 0.0.0.255
    *Mar  1 00:42:29.687: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 24.1.1.2 (FastEthernet0/0) is up: new adjacency
    R4(config-router)#net 34.1.1.0 0.0.0.255
    *Mar  1 00:42:38.787: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 34.1.1.3 (Serial1/0) is up: new adjacency
    R4(config-router)#net 4.4.4.4 0.0.0.0
    
  • 启动完eigrp后,查看邻居:show ip eigrp neighbors

    R1:

    R1#show ip eigrp neighbors
    IP-EIGRP neighbors for process 100
    H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                                (sec)         (ms)       Cnt Num
    1   13.1.1.3                Se1/0             14 00:02:46   61   366  0  11
    0   12.1.1.2                Fa0/0             13 00:05:04   60   360  0  13
    

    R2:

    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   24.1.1.4                Fa1/0             10 00:03:16   60   360  0  11
    0   12.1.1.1                Fa0/0             12 00:06:42   64   384  0  13
    

    R3:

    R3#show ip eigrp neighbors
    IP-EIGRP neighbors for process 100
    H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                                (sec)         (ms)       Cnt Num
    1   34.1.1.4                Se0/1             10 00:03:31   84   504  0  10
    0   13.1.1.1                Se0/0             13 00:04:49   58   348  0  12
    

    R4:

    R4#show ip eigrp neighbors
    IP-EIGRP neighbors for process 100
    H   Address                 Interface       Hold Uptime   SRTT   RTO  Q  Seq
                                                (sec)         (ms)       Cnt Num
    1   34.1.1.3                Se1/0             12 00:04:03   20   200  0  12
    0   24.1.1.2                Fa0/0             12 00:04:13  626  3756  0  14
    
  • 启动完eigrp后,查看拓扑表:show ip eigrp topology

    R1:发现到目的4.4.4.4只有一条路径,就是经过上面的12.1.1.2,下面的那条其实也是连通的,但由于是串口(折线)的带宽太小,导致不符合上面提到的【可行条件:Feasibility Condition(FC)】,所以没能成为FS。虽然没能成为FS,但使用show ip eigrp topology all-links,也能看到此通路。

    (158720/156160):前面的数字是可行距离(FD),后面的数字的通告距离(AD)

    由于2809856 - 2297856 = 512000 >158720,所以没能成为FS。

    R1#show ip eigrp topology
    IP-EIGRP Topology Table for AS(100)/ID(13.1.1.1)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 158720
            via 12.1.1.2 (158720/156160), FastEthernet0/0
    P 12.1.1.0/24, 1 successors, FD is 28160
            via Connected, FastEthernet0/0
    P 13.1.1.0/24, 1 successors, FD is 2169856
            via Connected, Serial1/0
    P 24.1.1.0/24, 1 successors, FD is 30720
            via 12.1.1.2 (30720/28160), FastEthernet0/0
    P 34.1.1.0/24, 1 successors, FD is 2174976
            via 12.1.1.2 (2174976/2172416), FastEthernet0/0
            via 13.1.1.3 (2681856/2169856), Serial1/0
            
    R1#show ip eigrp topology all-links
    IP-EIGRP Topology Table for AS(100)/ID(13.1.1.1)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 158720, serno 9
            via 12.1.1.2 (158720/156160), FastEthernet0/0
            via 13.1.1.3 (2809856/2297856), Serial1/0
    P 12.1.1.0/24, 1 successors, FD is 28160, serno 3
            via Connected, FastEthernet0/0
    P 13.1.1.0/24, 1 successors, FD is 2169856, serno 4
            via Connected, Serial1/0
    P 24.1.1.0/24, 1 successors, FD is 30720, serno 5
            via 12.1.1.2 (30720/28160), FastEthernet0/0
            via 13.1.1.3 (2684416/2172416), Serial1/0
    P 34.1.1.0/24, 1 successors, FD is 2174976, serno 7
            via 12.1.1.2 (2174976/2172416), FastEthernet0/0
            via 13.1.1.3 (2681856/2169856), Serial1/0
    R1#show ip route
         34.0.0.0/24 is subnetted, 1 subnets
    D       34.1.1.0 [90/2174976] via 12.1.1.2, 00:20:17, FastEthernet0/0
         4.0.0.0/32 is subnetted, 1 subnets
    D       4.4.4.4 [90/158720] via 12.1.1.2, 00:20:02, FastEthernet0/0
         24.0.0.0/24 is subnetted, 1 subnets
    D       24.1.1.0 [90/30720] via 12.1.1.2, 00:20:17, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    
    

    路由表里的[90/158720]:90是eigrp的内部管理距离;158720是计算出来的度量值

    R2:

    R2#show ip eigrp topology
    IP-EIGRP Topology Table for AS(100)/ID(24.1.1.2)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 156160
            via 24.1.1.4 (156160/128256), FastEthernet1/0
    P 12.1.1.0/24, 1 successors, FD is 28160
            via Connected, FastEthernet0/0
    P 13.1.1.0/24, 1 successors, FD is 2172416
            via 12.1.1.1 (2172416/2169856), FastEthernet0/0
    P 24.1.1.0/24, 1 successors, FD is 28160
            via Connected, FastEthernet1/0
    P 34.1.1.0/24, 1 successors, FD is 2172416
            via 24.1.1.4 (2172416/2169856), FastEthernet1/0
    R2#show ip eigrp topology all-links
    IP-EIGRP Topology Table for AS(100)/ID(24.1.1.2)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 156160, serno 7
            via 24.1.1.4 (156160/128256), FastEthernet1/0
    P 12.1.1.0/24, 1 successors, FD is 28160, serno 1
            via Connected, FastEthernet0/0
    P 13.1.1.0/24, 1 successors, FD is 2172416, serno 2
            via 12.1.1.1 (2172416/2169856), FastEthernet0/0
    P 24.1.1.0/24, 1 successors, FD is 28160, serno 3
            via Connected, FastEthernet1/0
    P 34.1.1.0/24, 1 successors, FD is 2172416, serno 6
            via 24.1.1.4 (2172416/2169856), FastEthernet1/0
    R2#show ip route
         34.0.0.0/24 is subnetted, 1 subnets
    D       34.1.1.0 [90/2172416] via 24.1.1.4, 00:19:50, FastEthernet1/0
         4.0.0.0/32 is subnetted, 1 subnets
    D       4.4.4.4 [90/156160] via 24.1.1.4, 00:19:35, FastEthernet1/0
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, FastEthernet1/0
         12.0.0.0/24 is subnetted, 1 subnets
    C       12.1.1.0 is directly connected, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    D       13.1.1.0 [90/2172416] via 12.1.1.1, 00:23:24, FastEthernet0/0
    

    R3:

    R3#show ip eigrp topology
    IP-EIGRP Topology Table for AS(100)/ID(34.1.1.3)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 2297856
            via 34.1.1.4 (2297856/128256), Serial0/1
            via 13.1.1.1 (2302976/158720), Serial0/0
    P 12.1.1.0/24, 1 successors, FD is 2172416
            via 13.1.1.1 (2172416/28160), Serial0/0
            via 34.1.1.4 (2174976/30720), Serial0/1
    P 13.1.1.0/24, 1 successors, FD is 2169856
            via Connected, Serial0/0
    P 24.1.1.0/24, 1 successors, FD is 2172416
            via 34.1.1.4 (2172416/28160), Serial0/1
            via 13.1.1.1 (2174976/30720), Serial0/0
    P 34.1.1.0/24, 1 successors, FD is 2169856
            via Connected, Serial0/1
    R3#show ip eigrp topology all-links
    IP-EIGRP Topology Table for AS(100)/ID(34.1.1.3)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 2297856, serno 6
            via 34.1.1.4 (2297856/128256), Serial0/1
            via 13.1.1.1 (2302976/158720), Serial0/0
    P 12.1.1.0/24, 1 successors, FD is 2172416, serno 2
            via 13.1.1.1 (2172416/28160), Serial0/0
            via 34.1.1.4 (2174976/30720), Serial0/1
    P 13.1.1.0/24, 1 successors, FD is 2169856, serno 1
            via Connected, Serial0/0
            via 34.1.1.4 (2686976/2174976), Serial0/1
    P 24.1.1.0/24, 1 successors, FD is 2172416, serno 5
            via 34.1.1.4 (2172416/28160), Serial0/1
            via 13.1.1.1 (2174976/30720), Serial0/0
    P 34.1.1.0/24, 1 successors, FD is 2169856, serno 4
            via Connected, Serial0/1
            via 13.1.1.1 (2686976/2174976), Serial0/0
    R3#show ip route
         34.0.0.0/24 is subnetted, 1 subnets
    C       34.1.1.0 is directly connected, Serial0/1
         4.0.0.0/32 is subnetted, 1 subnets
    D       4.4.4.4 [90/2297856] via 34.1.1.4, 00:19:26, Serial0/1
         24.0.0.0/24 is subnetted, 1 subnets
    D       24.1.1.0 [90/2172416] via 34.1.1.4, 00:19:42, Serial0/1
         12.0.0.0/24 is subnetted, 1 subnets
    D       12.1.1.0 [90/2172416] via 13.1.1.1, 00:19:42, Serial0/0
         13.0.0.0/24 is subnetted, 1 subnets
    C       13.1.1.0 is directly connected, Serial0/0
    

    R4:

    R4#show ip eigrp topology
    IP-EIGRP Topology Table for AS(100)/ID(4.4.4.4)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 128256
            via Connected, Loopback0
    P 12.1.1.0/24, 1 successors, FD is 30720
            via 24.1.1.2 (30720/28160), FastEthernet0/0
    P 13.1.1.0/24, 1 successors, FD is 2174976
            via 24.1.1.2 (2174976/2172416), FastEthernet0/0
            via 34.1.1.3 (2681856/2169856), Serial1/0
    P 24.1.1.0/24, 1 successors, FD is 28160
            via Connected, FastEthernet0/0
    P 34.1.1.0/24, 1 successors, FD is 2169856
            via Connected, Serial1/0
    R4#show ip eigrp topology all-links
    IP-EIGRP Topology Table for AS(100)/ID(4.4.4.4)
    
    Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
           r - reply Status, s - sia Status
    
    P 4.4.4.4/32, 1 successors, FD is 128256, serno 6
            via Connected, Loopback0
    P 12.1.1.0/24, 1 successors, FD is 30720, serno 2
            via 24.1.1.2 (30720/28160), FastEthernet0/0
            via 34.1.1.3 (2684416/2172416), Serial1/0
    P 13.1.1.0/24, 1 successors, FD is 2174976, serno 3
            via 24.1.1.2 (2174976/2172416), FastEthernet0/0
            via 34.1.1.3 (2681856/2169856), Serial1/0
    P 24.1.1.0/24, 1 successors, FD is 28160, serno 1
            via Connected, FastEthernet0/0
    P 34.1.1.0/24, 1 successors, FD is 2169856, serno 5
            via Connected, Serial1/0
    R4#show ip route
         34.0.0.0/24 is subnetted, 1 subnets
    C       34.1.1.0 is directly connected, Serial1/0
         4.0.0.0/32 is subnetted, 1 subnets
    C       4.4.4.4 is directly connected, Loopback0
         24.0.0.0/24 is subnetted, 1 subnets
    C       24.1.1.0 is directly connected, FastEthernet0/0
         12.0.0.0/24 is subnetted, 1 subnets
    D       12.1.1.0 [90/30720] via 24.1.1.2, 00:22:01, FastEthernet0/0
         13.0.0.0/24 is subnetted, 1 subnets
    D       13.1.1.0 [90/2174976] via 24.1.1.2, 00:22:01, FastEthernet0/0
    
    
  • 修改接口的带宽命令:进入接口后,执行bandwidth 数字

  • 修改接口的延迟命令:进入接口后,执行delay 数字(单位是毫秒)

# c/c++ 学习互助QQ群:877684253 ![](https://img2018.cnblogs.com/blog/1414315/201811/1414315-20181106214320230-961379709.jpg) # 本人微信:xiaoshitou5854
posted @ 2020-01-15 10:34  小石王  阅读(744)  评论(0编辑  收藏  举报