Chinaunix首页 | 论坛 | 博客
  • 博客访问: 231831
  • 博文数量: 47
  • 博客积分: 776
  • 博客等级: 军士长
  • 技术积分: 514
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-18 12:04
文章分类

全部博文(47)

文章存档

2016年(1)

2015年(18)

2013年(28)

我的朋友

分类: 网络与安全

2015-07-02 16:44:11

缺省的方式是基于前缀的负载均衡,从多个等价路径中随机选择。
但可以配置基于包(per-packet)的负载均衡。
负载均衡和硬件系统密切相关:
internet processor 1 :缺省最大8条进行负载均衡。配置了per-packet以后按照逐包负载均衡。
internet processor 2: 缺省最大16条进行负载均衡。配置了pre-packet后按照逐流(pre-flow)方式,相同的流走相同的下一跳。

JUNOS的pfe表里体现不出负载均衡来。
对于未启用逐包均衡的情况:
admin@jr4# run show route table inet.0

inet.0: 10 destinations, 10 routes (10 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32        *[OSPF/10] 02:01:43, metric 2
                    > to 10.24.0.2 via ge-1/3/0.201
                      to 10.34.0.3 via ge-1/3/0.202
10.0.0.2/32        *[OSPF/10] 02:01:43, metric 1
                    > to 10.24.0.2 via ge-1/3/0.201
10.0.0.3/32        *[OSPF/10] 02:02:21, metric 1
                    > to 10.34.0.3 via ge-1/3/0.202
10.0.0.4/32        *[Direct/0] 02:03:06
                    > via lo0.0
10.24.0.0/24       *[Direct/0] 02:03:07
                    > via ge-1/3/0.201
10.24.0.4/32       *[Local/0] 02:03:07
                      Local via ge-1/3/0.201
10.34.0.0/24       *[Direct/0] 02:03:06
                    > via ge-1/3/0.202
10.34.0.4/32       *[Local/0] 02:03:06
                      Local via ge-1/3/0.202
10.123.0.0/24      *[OSPF/10] 02:01:43, metric 2
                      to 10.24.0.2 via ge-1/3/0.201
                    > to 10.34.0.3 via ge-1/3/0.202
224.0.0.5/32       *[OSPF/10] 02:03:07, metric 1
                      MultiRecv

[edit]
admin@jr4# run show pfe route ip


IPv4 Route Table 0, default.0, 0x0:
Destination   NH IP Addr      Type     NH ID Interface
------------  --------------- -------- ----- ---------
default                                             Reject    36 RT-ifl 0
0.0.0.0                                            Discard    34 RT-ifl 0
10.0.0.1                          10.24.0.2        Unicast   546 RT-ifl 0 ge-1/3/0.201 ifl 67
10.0.0.2                          10.24.0.2        Unicast   546 RT-ifl 0 ge-1/3/0.201 ifl 67
10.0.0.3                          10.34.0.3        Unicast   545 RT-ifl 0 ge-1/3/0.202 ifl 68
10.0.0.4                          10.0.0.4           Local   544 RT-ifl 0
10.24.0/24                                         Resolve   537 RT-ifl 67 ge-1/3/0.201 ifl 67
10.24.0.0                         10.24.0.0           Recv   535 RT-ifl 67 ge-1/3/0.201 ifl 67
10.24.0.2                         10.24.0.2        Unicast   546 RT-ifl 67 ge-1/3/0.201 ifl 67
10.24.0.4                         10.24.0.4          Local   536 RT-ifl 0
10.24.0.255                                          Bcast   534 RT-ifl 67 ge-1/3/0.201 ifl 67
10.34.0/24                                         Resolve   543 RT-ifl 68 ge-1/3/0.202 ifl 68
10.34.0.0                         10.34.0.0           Recv   541 RT-ifl 68 ge-1/3/0.202 ifl 68
10.34.0.3                         10.34.0.3        Unicast   545 RT-ifl 68 ge-1/3/0.202 ifl 68
10.34.0.4                         10.34.0.4          Local   542 RT-ifl 0
10.34.0.255                                          Bcast   540 RT-ifl 68 ge-1/3/0.202 ifl 68
10.123.0/24                       10.34.0.3        Unicast   545 RT-ifl 0 ge-1/3/0.202 ifl 68
224/4                                             mdiscard    35 RT-ifl 0
224.0.0.1                                            Mcast    31 RT-ifl 0
224.0.0.5                                            Mcast    31 RT-ifl 0
224.0.0.6                                           Mgroup   538 RT-ifl 0
255.255.255.255                                      Bcast    32 RT-ifl 0

对于启用了pre-packet均衡的情况:
admin@jr1# show
routing-options {
    forwarding-table {
        export lb;
    }
}
protocols {
    ospf {
        area 0.0.0.0 {
            interface lo0.0;
            interface ge-1/3/0.100;
        }
    }
}
policy-options {
    policy-statement lb {
        then {
            load-balance per-packet;
        }
    }
}

[edit]
admin@jr1# run show route table inet.0

inet.0: 9 destinations, 9 routes (9 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

10.0.0.1/32        *[Direct/0] 2d 23:05:55
                    > via lo0.0
10.0.0.2/32        *[OSPF/10] 2d 23:02:02, metric 1
                    > to 10.123.0.2 via ge-1/3/0.100
10.0.0.3/32        *[OSPF/10] 2d 23:02:07, metric 1
                    > to 10.123.0.3 via ge-1/3/0.100
10.0.0.4/32        *[OSPF/10] 02:03:13, metric 2
                    > to 10.123.0.2 via ge-1/3/0.100
                      to 10.123.0.3 via ge-1/3/0.100
10.24.0.0/24       *[OSPF/10] 02:03:18, metric 2
                    > to 10.123.0.2 via ge-1/3/0.100
10.34.0.0/24       *[OSPF/10] 02:07:44, metric 2
                    > to 10.123.0.3 via ge-1/3/0.100
10.123.0.0/24      *[Direct/0] 2d 23:05:55
                    > via ge-1/3/0.100
10.123.0.1/32      *[Local/0] 2d 23:05:55
                      Local via ge-1/3/0.100
224.0.0.5/32       *[OSPF/10] 2d 23:05:56, metric 1
                      MultiRecv
                                        
[edit]
admin@jr1# run show pfe route ip


IPv4 Route Table 0, default.0, 0x0:
Destination   NH IP Addr      Type     NH ID Interface
------------  --------------- -------- ----- ---------
default                                             Reject    36 RT-ifl 0
0.0.0.0                                            Discard    34 RT-ifl 0
10.0.0.1                          10.0.0.1           Local   540 RT-ifl 0
10.0.0.2                          10.123.0.2       Unicast   542 RT-ifl 0 ge-1/3/0.100 ifl 67
10.0.0.3                          10.123.0.3       Unicast   541 RT-ifl 0 ge-1/3/0.100 ifl 67
10.0.0.4                                           Unilist 262142 RT-ifl 0
10.24.0/24                        10.123.0.2       Unicast   542 RT-ifl 0 ge-1/3/0.100 ifl 67
10.34.0/24                        10.123.0.3       Unicast   541 RT-ifl 0 ge-1/3/0.100 ifl 67
10.123.0/24                                        Resolve   537 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.0                        10.123.0.0          Recv   535 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.1                        10.123.0.1         Local   536 RT-ifl 0
10.123.0.2                        10.123.0.2       Unicast   542 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.3                        10.123.0.3       Unicast   541 RT-ifl 67 ge-1/3/0.100 ifl 67
10.123.0.255                                         Bcast   534 RT-ifl 67 ge-1/3/0.100 ifl 67
224/4                                             mdiscard    35 RT-ifl 0
224.0.0.1                                            Mcast    31 RT-ifl 0
224.0.0.5                                            Mcast    31 RT-ifl 0
224.0.0.6                                           Mgroup   538 RT-ifl 0
255.255.255.255                                      Bcast    32 RT-ifl 0

[edit]
admin@jr1# run show pfe next-hop | match 262142
262142   Unilist  ge-1/3/0.100   -                      IPv4      Ethernet     0  0x00000000 0x00000000

[edit]
admin@jr1#

阅读(2666) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~