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的結果不要四捨五入,只取整。帶寬的單位爲kb/s,延遲單位爲usec 。計算鏈路metric,是路由的入方向。
-------------------------------------------------------------------------------------------------------
更改帶寬和延遲的命令:
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)
注意這裏的帶寬單位依然是kb/s,但是延遲的單位卻是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