缺省状态下,转发表中只安装路由表里的最佳路径,lab@juniper# run show route 6.6.6.6 inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden)+ = Active Route, - = Last Active, * = Both
作者:zdnet安全频道 来源:论坛整理 2008年10月27日
关键字: 负载均衡
缺省状态下,转发表中只安装路由表里的最佳路径
lab@juniper# run show route 6.6.6.6
inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
6.6.6.6/32 *[IS-IS/18] 00:03:33, metric 42
to 10.0.0.2 via fxp1.1
> to 10.0.1.2 via fxp1.2
[edit]
lab@juniper# run show route forwarding-table
5.5.5.5/32 user 0 10.0.1.2 ucst 490 7 fxp1.2
6.6.6.6/32 user 0 10.0.1.2 ucst 490 7 fxp1.2
10.0.0.0/30 intf 0 rslv 459 1 fxp1.1
现在进行配置将路由表里的所有路径都安装进转发表
lab@juniper# show routing-options
forwarding-table {
export load-balance-route;
}
lab@juniper#show policy-options
policy-statement load-balance-route {
then {
load-balance per-packet;
}
}
查看路由表,路由器选择10.0.1.2作为最佳路由
lab@juniper# run show route 6.6.6.6
inet.0: 19 destinations, 22 routes (19 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both
6.6.6.6/32 *[IS-IS/18] 00:03:33, metric 42
to 10.0.0.2 via fxp1.1
> to 10.0.1.2 via fxp1.2
转发表里对其所有前缀安装了多条路径
(注:安装的条目和PFE有关,IP-ASIC最多安装8条等价路径,以每个包为单位进行负载均衡
IP-II-ASIC最多安装16条,以每个流为单位进行负载均衡)
lab@juniper# run show route forwarding-table
1.1.1.1/32 intf 0 1.1.1.1 locl 468 1
2.2.2.2/32 user 0 ulst 489 11
10.0.0.2 ucst 497 2 fxp1.1
10.0.1.2 ucst 490 2 fxp1.2
3.3.3.3/32 user 0 ulst 489 11
10.0.0.2 ucst 497 2 fxp1.1
10.0.1.2 ucst 490 2 fxp1.2
4.4.4.4/32 user 0 ulst 489 11
10.0.0.2 ucst 497 2 fxp1.1
10.0.1.2 ucst 490 2 fxp1.2
5.5.5.5/32 user 0 ulst 489 11
10.0.0.2 ucst 497 2 fxp1.1
10.0.1.2 ucst 490 2 fxp1.2
6.6.6.6/32 user 0 ulst 489 11
10.0.0.2 ucst 497 2 fxp1.1
10.0.1.2 ucst 490 2 fxp1.2
10.0.0.0/30 intf 0 rslv 459 1 fxp1.1
配置路由器,只对特定前缀的多条路径安装进转发表,6.0.0.0/8,4.0.0.0/8,2.0.0.0/8
[edit]
lab@juniper# show policy-options policy-statement load-balance-route
from {
route-filter 6.0.0.0/8 orlonger;
route-filter 2.0.0.0/8 orlonger;
route-filter 4.0.0.0/8 orlonger;
}
then {
load-balance per-packet;
}
lab@juniper# show routing-options
forwarding-table {
export load-balance-route;
}
观察转发表,只对其特定前缀安装了多条路径, 6.0.0.0/8,4.0.0.0/8,2.0.0.0/8
lab@juniper# run show route forwarding-table
1.1.1.1/32 intf 0 1.1.1.1 locl 468 1
2.2.2.2/32 user 0 ulst 489 3
10.0.0.2 ucst 497 6 fxp1.1
10.0.1.2 ucst 490 6 fxp1.2
3.3.3.3/32 user 0 10.0.1.2 ucst 490 6 fxp1.2
4.4.4.4/32 user 0 ulst 489 3
10.0.0.2 ucst 497 6 fxp1.1
10.0.1.2 ucst 490 6 fxp1.2
5.5.5.5/32 user 0 10.0.1.2 ucst 490 6 fxp1.2
6.6.6.6/32 user 0 ulst 489 3
10.0.0.2 ucst 497 6 fxp1.1
10.0.1.2 ucst 490 6 fxp1.2
10.0.0.0/30 intf 0 rslv 459 1 fxp1.1
10.0.0.0/32 dest 0 10.0.0.0 recv 457 1 fxp1.1
对5.5.5.5进行traceroute,每次都使用相同的下一跳
lab@juniper> traceroute 5.5.5.5
traceroute to 5.5.5.5 (5.5.5.5), 30 hops max, 40 byte packets
1 10.0.1.2 (10.0.1.2) 0.457 ms 0.774 ms 0.224 ms
2 10.0.2.2 (10.0.2.2) 0.317 ms 0.360 ms 0.287 ms
3 10.0.3.2 (10.0.3.2) 0.398 ms 0.439 ms 0.383 ms
4 5.5.5.5 (5.5.5.5) 0.495 ms 0.533 ms 1.149 ms
lab@juniper> traceroute 5.5.5.5
traceroute to 5.5.5.5 (5.5.5.5), 30 hops max, 40 byte packets
1 10.0.1.2 (10.0.1.2) 0.431 ms 0.380 ms 0.225 ms
2 10.0.2.2 (10.0.2.2) 0.320 ms 0.367 ms 0.310 ms
3 10.0.3.2 (10.0.3.2) 0.402 ms 0.438 ms 0.392 ms
4 5.5.5.5 (5.5.5.5) 0.495 ms 0.546 ms 0.491 ms
lab@juniper> traceroute 5.5.5.5
traceroute to 5.5.5.5 (5.5.5.5), 30 hops max, 40 byte packets
1 10.0.1.2 (10.0.1.2) 0.427 ms 0.381 ms 0.220 ms
2 10.0.2.2 (10.0.2.2) 0.315 ms 0.362 ms 0.305 ms
3 10.0.3.2 (10.0.3.2) 0.401 ms 0.431 ms 0.383 ms
4 5.5.5.5 (5.5.5.5) 0.492 ms 0.529 ms 0.479 ms
lab@juniper>
对6.6.6.6进行traceroute, 每次都使用不同的下一跳
lab@juniper> traceroute 6.6.6.6
traceroute to 6.6.6.6 (6.6.6.6), 30 hops max, 40 byte packets
1 10.0.1.2 (10.0.1.2) 0.427 ms 0.375 ms 10.0.0.2 (10.0.0.2) 0.224 ms
2 10.0.2.2 (10.0.2.2) 0.364 ms 0.349 ms 0.292 ms
3 10.0.3.2 (10.0.3.2) 0.385 ms 0.433 ms 0.386 ms
4 10.0.5.2 (10.0.5.2) 0.467 ms 0.518 ms 0.462 ms
5 6.6.6.6 (6.6.6.6) 0.572 ms 0.622 ms 0.567 ms
lab@juniper> traceroute 6.6.6.6
traceroute to 6.6.6.6 (6.6.6.6), 30 hops max, 40 byte packets
1 10.0.0.2 (10.0.0.2) 0.436 ms 10.0.1.2 (10.0.1.2) 0.382 ms 0.355 ms
2 10.0.2.2 (10.0.2.2) 0.316 ms 0.372 ms 0.315 ms
3 10.0.3.2 (10.0.3.2) 0.394 ms 0.443 ms 0.391 ms
4 10.0.5.2 (10.0.5.2) 0.473 ms 0.519 ms 0.465 ms
5 6.6.6.6 (6.6.6.6) 0.572 ms 0.610 ms 0.586 ms
lab@juniper# run traceroute 6.6.6.6
traceroute to 6.6.6.6 (6.6.6.6), 30 hops max, 40 byte packets
1 10.0.1.2 (10.0.1.2) 7.488 ms 0.511 ms 10.0.0.2 (10.0.0.2) 0.243 ms
2 10.0.2.2 (10.0.2.2) 0.367 ms 0.351 ms 0.299 ms
3 10.0.3.2 (10.0.3.2) 0.404 ms 0.435 ms 0.384 ms
4 10.0.5.2 (10.0.5.2) 0.478 ms 0.542 ms 0.470 ms
5 6.6.6.6 (6.6.6.6) 0.589 ms 0.615 ms 0.572 ms
[edit logical-routers]
lab@juniper# run traceroute 6.6.6.6
traceroute to 6.6.6.6 (6.6.6.6), 30 hops max, 40 byte packets
1 10.0.0.2 (10.0.0.2) 0.429 ms 10.0.1.2 (10.0.1.2) 0.388 ms 0.363 ms
2 10.0.2.2 (10.0.2.2) 0.322 ms 0.361 ms 0.304 ms
3 10.0.3.2 (10.0.3.2) 0.393 ms 0.452 ms 0.387 ms
4 10.0.5.2 (10.0.5.2) 0.471 ms 0.522 ms 0.471 ms
5 6.6.6.6 (6.6.6.6) 0.594 ms 0.632 ms 0.571 ms
[edit logical-routers]