R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#no ip domain-lookup
R1(config)#line console 0
R1(config-line)#login
% Login disabled on line 0, until ‘password‘ is set
R1(config-line)#pass
R1(config-line)#password 11223344
R1(config-line)#logging synchronous
R1(config-line)#no exec-timeout
R1(config-line)#exit
R1(config)#int s0/0
R1(config-if)#ip add 12.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#int s0/1
R1(config-if)#ip add 13.1.1.1 255.255.255.0
R1(config-if)#no shu
R1(config-if)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#exit
R1(config)#router eigrp 90
R1(config-router)#net 12.1.1.0 0.0.0.255
R1(config-router)#net 13.1.1.0 0.0.0.255
R1(config-router)#net 1.1.1.0 0.0.0.255
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#no ip domain-lookup
R2(config)#line console 0
R2(config-line)#login
% Login disabled on line 0, until ‘password‘ is set
R2(config-line)#password 11223344
R2(config-line)#no exec-timeout
R2(config-line)#logging synchronous
R2(config-line)#end
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#int s0/0
R2(config-if)#ip address 12.1.1.2 255.255.255.0
R2(config-if)#no shu
R2(config-if)#int lo 0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#end
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#router eigrp 90
R2(config-router)#network 12.1.1.0 0.0.0.255
R2(config-router)#net 2.2.2.0 0.0.0.255
R3#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R3(config)#no ip domain-lookup
R3(config)#line console 0
R3(config-line)#login
% Login disabled on line 0, until ‘password‘ is set
R3(config-line)#pass 11223344
R3(config-line)#logging synchronous
R3(config-line)#no exec-timeout
R3(config-line)#exit
R3(config)#int s0/1
R3(config-if)#ip add 13.1.1.3 255.255.255.0
R3(config-if)#no shu
R3(config-if)#int lo 0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#exit
R3(config)#router eigrp 90
R3(config-router)#net 13.1.1.0 0.0.0.255
R3(config-router)#net 3.3.3.0 0.0.0.255
查看R1路由表
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
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback0
D 1.0.0.0/8 is a summary, 00:08:26, Null0
D 2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:08:51, Serial0/0
D 3.0.0.0/8 [90/2297856] via 13.1.1.3, 00:06:06, Serial0/1
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 12.1.1.0/24 is directly connected, Serial0/0
D 12.0.0.0/8 is a summary, 00:08:26, Null0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 13.1.1.0/24 is directly connected, Serial0/1
D 13.0.0.0/8 is a summary, 00:07:02, Null0
R1#show ip route eigrp
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 1.0.0.0/8 is a summary, 00:08:37, Null0
D 2.0.0.0/8 [90/2297856] via 12.1.1.2, 00:09:02, Serial0/0
D 3.0.0.0/8 [90/2297856] via 13.1.1.3, 00:06:17, Serial0/1
12.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 12.0.0.0/8 is a summary, 00:08:37, Null0
13.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
D 13.0.0.0/8 is a summary, 00:07:11, Null0
可以看见eigrp自动汇总了直连路由和所学习到的路由。
下面关闭自动汇总后,比较前后两次的路由表。
no auto-summary
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
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/24 is subnetted, 1 subnets
D 2.2.2.0 [90/2297856] via 12.1.1.2, 00:01:03, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2297856] via 13.1.1.3, 00:00:31, Serial0/1
12.0.0.0/24 is subnetted, 1 subnets
C 12.1.1.0 is directly connected, Serial0/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial0/1
-----------------------------------------------------------------------------------------------------------
R1#show ip eigrp neighbors
IP-EIGRP neighbors for process 90
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 13.1.1.3 Se0/1 14 00:12:14 164 984 0 16
0 12.1.1.2 Se0/0 12 00:14:48 181 1086 0 17
这里的H是建立邻居的先后顺序;interface是本地接口;address是邻居的地址;hold是保持时间,默认为hello时间的三倍
,超过三倍时间没收到邻居的ACK就认为邻居down了;up-time是建立邻居持续了多久;SRTT是平均往返时间,单位ms。越小
,就说明链路更加畅通无阻。RTO是重传超时时间,默认重传16次,否则重建邻居。
R1#show ip eigrp interface
IP-EIGRP interfaces for process 90
Xmit Queue Mean Pacing Time Multicast Pending
Interface Peers Un/Reliable SRTT Un/Reliable Flow Timer Routes
Se0/0 1 0/0 181 0/15 711 0
Se0/1 1 0/0 164 0/15 719 0
Lo0 0 0/0 0 0/1 0 0
该命令可以查看本地哪些接口被宣告出去。便于troubleshoot。
------------------------------------------------------------------------------------------------------------
eigrp影响建立邻居的三个因素是:AS号,password,K值。Hello时间被改,不会影响邻居。
更改hello时间的命令如下:
R1(config)#int s0/0
R1(config-if)#ip hello-interval eigrp 90 10
------------------------------------------------------------------------------------------------------------
下面探究K值对eigrp metric值的影响。
R2#show ip route eigrp
1.0.0.0/24 is subnetted, 1 subnets
D 1.1.1.0 [90/2297856] via 12.1.1.1, 00:15:13, Serial0/0
3.0.0.0/24 is subnetted, 1 subnets
D 3.3.3.0 [90/2809856] via 12.1.1.1, 00:14:06, Serial0/0
13.0.0.0/24 is subnetted, 1 subnets
D 13.1.1.0 [90/2681856] via 12.1.1.1, 00:15:13, Serial0/0
R2#show interface s0/0
Serial0/0 is up, line protocol is up
Hardware is M4T
Internet address is 12.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
reliability 255/255, txload 1/255, rxload 1/255
(略)
R3#show int lo 0
Loopback0 is up, line protocol is up
Hardware is Loopback
Internet address is 3.3.3.3/24
MTU 1514 bytes, BW 8000000 Kbit, DLY 5000 usec,
(略)
这里看到R2到R3的环回口metric值为2809856 。计算公式为:(10的七次方/1544 +(20000+20000+5000) /10 )*256 =2809856 。 注意10的七次方/1544的结果不要四舍五入,只取整。带宽的单位为kbps,延迟单位为usec 。
-----------------------------------------------------------------------------------------------------------
更改带宽和延迟的命令:
R3(config)#int s0/1
R3(config-if)#bandwidth ?
<1-10000000> Bandwidth in kilobits
inherit Specify that bandwidth is inherited
receive Specify receive-side bandwidth
R3(config-if)#delay ?
<1-16777215> Throughput delay (tens of microseconds)
这注意这里的带宽单位依然是kbps,但是延迟的单位是10倍的usec 。
------------------------------------------------------------------------------------------------------------
下面更改K值,会发现邻居down了。
R3#show ip protocols
Routing Protocol is "eigrp 90"
Outgoing update filter list for all interfaces is not set
Incoming update filter list for all interfaces is not set
Default networks flagged in outgoing updates
Default networks accepted from incoming updates
EIGRP metric weight K1=1, K2=0, K3=1, K4=0, K5=0
EIGRP maximum hopcount 100
EIGRP maximum metric variance 1
Redistributing: eigrp 90
EIGRP NSF-aware route hold timer is 240s
Automatic network summarization is not in effect
Maximum path: 4
Routing for Networks:
3.3.3.0/24
13.1.1.0/24
Routing Information Sources:
Gateway Distance Last Update
(this router) 90 00:33:18
13.1.1.1 90 00:22:41
Distance: internal 90 external 170
这里的K1到K5是默认值。下面更改K值大小。
R3(config)#router eigrp 90
R3(config-router)#metric weight ?
<0-8> Type Of Service (Only TOS 0 supported)
R3(config-router)#metric weight 0 ?
<0-255> K1
R3(config-router)#metric weight 0 1 1 1 0 0
R3(config-router)#
*Mar 1 00:51:56.411: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 90: Neighbor 13.1.1.1 (Serial0/1) is down: metric changed
R3(config-router)#
*Mar 1 00:51:58.239: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 90: Neighbor 13.1.1.1 (Serial0/1) is down: K-value mismatch
R3(config-router)#
*Mar 1 00:52:02.671: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 90: Neighbor 13.1.1.1 (Serial0/1) is down: K-value mismatch
R3(config-router)#
*Mar 1 00:52:07.131: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 90: Neighbor 13.1.1.1 (Serial0/1) is down: K-value mismatch
R3#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
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial0/1