先看拓扑:
R1:
iinterface Serial2/0
ip address 12.1.1.1 255.255.255.0
serial restart-delay 0
clock rate 64000
!
interface Serial2/1
ip address 13.1.1.1 255.255.255.0
serial restart-delay 0
clock rate 64000
router eigrp 100
network 0.0.0.0
no auto-summary
R2:
interface FastEthernet0/0
ip address 23.1.1.1 255.255.255.0
duplex auto
speed auto
interface Serial2/0
ip address 12.1.1.2 255.255.255.0
serial restart-delay 0
router eigrp 100
network 0.0.0.0
no auto-summary
R3:
interface FastEthernet0/0
ip address 23.1.1.2 255.255.255.0
duplex auto
speed auto
interface Serial2/1
ip address 13.1.1.2 255.255.255.0
serial restart-delay 0
router eigrp 100
network 0.0.0.0
no auto-summary
R3路由表:
R3#show ip rou
Gateway of last resort is not set
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
D 12.1.1.0 [90/2172416] via 23.1.1.1, 00:01:06, FastEthernet0/0 //去12.1.1.0网段via f0/0
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial2/1
R3#show ip eigrp to
IP-EIGRP Topology Table for AS(100)/ID(23.1.1.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 12.1.1.0/24, 1 successors, FD is 2172416
via 23.1.1.1 (2172416/2169856), FastEthernet0/0
via 13.1.1.1 (2681856/2169856), Serial2/1
P 13.1.1.0/24, 1 successors, FD is 2169856
via Connected, Serial2/1
P 23.1.1.0/24, 1 successors, FD is 28160
via Connected, FastEthernet0/0
//拓扑表中有两条可以到12.1.1.0网段的路径,F0/0和S1/1,经过s1/1那条路径的AD小于正在使用路由条目的FD2172416,所以被选为FS放在拓扑表中.
要想实验负载均衡,可以用的办法:
等价负载均衡(1):使得metric值相同
1.改带宽(不推荐,因为改带宽要用107 去除,会得到小数,)
2.改延迟,在R3上改f0/0 或s1/1其中的一个
R3#show inter f0/0
FastEthernet0/0 is up, line protocol is up
Hardware is AmdFE, address is cc02.07fc.0000 (bia cc02.07fc.0000)
Internet address is 23.1.1.2/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
-----------------------------------------------------------------------
R3#show int s2/1
Serial2/1 is up, line protocol is up
Hardware is M4T
Internet address is 13.1.1.2/24
MTU 1500 bytes, BW 1544 Kbit, DLY 20000 usec,
先改s2/1
R3(config-if)#delay ?
<1-16777215> Throughput delay (tens of microseconds)
延迟路由器会自动乘以10所以这里要改成和f0/0 的DLY一样只需
R3(config-if)#delay 10
R3#clear ip eigrp neighbors
邻居关系重新建立
R3#show ip eigrp to
IP-EIGRP Topology Table for AS(100)/ID(23.1.1.2)
Codes: P - Passive, A - Active, U - Update, Q - Query, R - Reply,
r - reply Status, s - sia Status
P 12.1.1.0/24, 2 successors, FD is 2172416
via 13.1.1.1 (2172416/2169856), Serial2/1
via 23.1.1.1 (2172416/2169856), FastEthernet0/0
P 13.1.1.0/24, 1 successors, FD is 1660416
via Connected, Serial2/1
P 23.1.1.0/24, 1 successors, FD is 28160
via Connected, FastEthernet0/0
R3#show ip route
Gateway of last resort is not set
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
D 12.1.1.0 [90/2172416] via 23.1.1.1, 00:01:08, FastEthernet0/0
[90/2172416] via 13.1.1.1, 00:01:08, Serial2/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial2/1
metric值已经相同,路由表中有两条路由,负载均衡成功!
当然也可以修改f0/0
R3(config)#int f0/0
R3(config-if)#delay 2000 一样可能达到负载均衡的效果
等价负载均衡(2): offset-list
P 12.1.1.0/24, 1 successors, FD is 2172416
via 23.1.1.1 (2172416/2169856), FastEthernet0/0
via 13.1.1.1 (2681856/2169856), Serial2/1
R3(config)#access-list 1 permit 12.1.1.0
R3(config)#router eigrp 100
R3(config-router)#offset-list 1 in 509440 f0/0
在这里只能改小的,大的减小的即为偏移的值,其中有个参数”in”,如果对自己产生影响用”in”如果对外面产生影响用”out”,509440是偏移值,后面还有个接口,是说,在这个接口上加上偏移值,如果不定义接口,默认在所有接口加偏移值.
R3#show ip rout
Gateway of last resort is not set
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
D 12.1.1.0 [90/2681856] via 23.1.1.1, 00:00:04, FastEthernet0/0
[90/2681856] via 13.1.1.1, 00:00:04, Serial2/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial2/1
不等价负载均衡:variance
P 12.1.1.0/24, 1 successors, FD is 2172416
via 23.1.1.1 (2172416/2169856), FastEthernet0/0
via 13.1.1.1 (2681856/2169856), Serial2/1
R3(config)#router eigrp 100
R3(config-router)#var
R3(config-router)#variance ?
<1-128> Metric variance multiplier
R3(config-router)#variance 2
R3#show ip rou
Gateway of last resort is not set
23.0.0.0/24 is subnetted, 1 subnets
C 23.1.1.0 is directly connected, FastEthernet0/0
12.0.0.0/24 is subnetted, 1 subnets
D 12.1.1.0 [90/2172416] via 23.1.1.1, 00:00:45, FastEthernet0/0
[90/2681856] via 13.1.1.1, 00:00:45, Serial2/1
13.0.0.0/24 is subnetted, 1 subnets
C 13.1.1.0 is directly connected, Serial2/1
Variance 默认为1,以最小的取一个倍数大于或者等于最大的.就可以实现不等价负载均衡
负载均衡默认时最大支持4条,修改后最大支持6条路径
当两条路负载均衡的时候,是不是各走一个包呢?不是,以前是按6:1算,即一条走6个另外一条走1个,现在新版本的IOS按实际的带宽得出一个比例
R3#show ip route 12.1.1.0
Routing entry for 12.1.1.0/24
Known via "eigrp 100", distance 90, metric 2172416, type internal
Redistributing via eigrp 100
Last update from 13.1.1.1 on Serial2/1, 00:02:12 ago
Routing Descriptor Blocks:
* 23.1.1.1, from 23.1.1.1, 00:02:12 ago, via FastEthernet0/0
Route metric is 2172416, traffic share count is 120
Total delay is 20100 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
13.1.1.1, from 13.1.1.1, 00:02:12 ago, via Serial2/1
Route metric is 2681856, traffic share count is 97
Total delay is 40000 microseconds, minimum bandwidth is 1544 Kbit
Reliability 255/255, minimum MTU 1500 bytes
Loading 1/255, Hops 1
带”*”说明下一个包走这个路,关掉快速转发
R3(config)#no ip cef
用扩展PING
当PING到第N个包时就会走下面的13.1.1.1
为了只要我们PING的目的网段的包,可以加一条扩展的ACL
R3(config)#access-list 100 permit icmp any any
R3#debug ip packet 100
*Mar 1 01:04:54.543: IP: s=23.1.1.1 (FastEthernet0/0), d=23.1.1.2 (FastEthernet0/0), len 100, rcvd 3
*Mar 1 01:04:55.367: IP: s=13.1.1.2 (local), d=12.1.1.0 (Serial2/1), len 100, sending
*Mar 1 01:04:55.427: IP: tableid=0, s=13.1.1.1 (Serial2/1), d=13.1.1.2 (Serial2/1), routed via RIB
*Mar 1 01:04:55.431: IP: s=13.1.1.1 (Serial2/1), d=13.1.1.2 (Serial2/1), len 100, rcvd 3
*Mar 1 01:04:55.475: IP: tableid=0, s=13.1.1.2 (local), d=12.1.1.0 (Serial2/1), routed via RIB