Перейти к основному содержимому

2.16 Настройка Hash Load-balance

2.16.1 Настройка хэширования Linkagg

Linkagg (link aggregation) может агрегировать несколько физических интерфейсов в один логический канал для повышения производительности и отказоустойчивости. При передаче пакетов через Linkagg может возникнуть проблема передачи одинакового потока данных по разным физическим интерфейсам, что приводит к нарушению порядка пакетов на принимающем устройстве. Чтобы избежать этой проблемы, Linkagg может использовать свойства пакетов для получения хэш-значения и выбирать соответствующий физический интерфейс для передачи пакетов, что также улучшает балансировку нагрузки.

Настройка Linkagg Hash Globally

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите глобальное значение хэширования

Switch(config)# hash-value global
Switch(config-hash-value-global)# port-channel select user
Switch(config-hash-value-global)# end

Шаг 4: Проверка

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value global 
LBT:load balance type LBM :load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value global
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel - all user xor
ecmp - all ecmp xor
ecmp flow id all ecmp xor
entropy - all ecmp xor
----------------------------------------------------------------------
Efd hash field select:
macsa macda
ipsa ipda
sourceport destport
ip-protocol

Настройка Linkagg Hash Input

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования

Switch(config)# hash-value aaa
Switch(config-hash-value)# port-channel unicast select user
Switch(config-hash-value)# exit

Шаг 4: Установите значение хэширования на интерфейсе

Switch(config)# interface range eth-0-1 - 2
Switch(config-if-range)# no shutdown
Switch(config-if-range)# static-channel-group 1
Switch(config-if-range)# exit Switch(config)# interface agg 1
Switch(config-if)# load-balance hash-value aaa input
Switch(config-if)# exit
Switch(config)# interface eth-0-3
Switch(config-if)# load-balance hash-value aaa input
Switch(config-if)# end

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value aaa
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: aaa
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all user xor
port-channel non-unicast all NOCFG NOCFG
ecmp - all NOCFG NOCFG
ecmp flow id all NOCFG NOCFG

Используйте следующую команду, чтобы отобразить применение значения хеширования к порту:

Switch# show hash-value interface-applied 
eth-0-3
hash-value aaa input
agg1
hash-value aaa input

Настройка Linkagg Hash output

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования

Switch(config)# hash-value aaa
Switch(config-hash-value)# port-channel unicast select user
Switch(config-hash-value)# exit

Шаг 4: Установите значение хэширования на интерфейсе

Switch(config)# interface range eth-0-1 - 2
Switch(config-if-range)# no shutdown
Switch(config-if-range)# static-channel-group 1
Switch(config-if-range)# exit
Switch(config)# interface agg 1
Switch(config-if)# load-balance hash-value aaa output
Switch(config-if)# exit

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value aaa
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: aaa
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all user xor
port-channel non-unicast all NOCFG NOCFG
ecmp - all NOCFG NOCFG
ecmp flow id all NOCFG NOCFG

Используйте следующую команду, чтобы отобразить применение значения хеширования к порту:

Switch# show hash-value interface-applied 
agg1
hash-value aaa output

Настройка Linkagg Hash ACL

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования

Switch(config)# hash-value aaa
Switch(config-hash-value)# port-channel unicast select user
Switch(config-hash-value)# exit

Шаг 4: Добавьте действие ACL на интерфейс и установите значение хэширования на интерфейсе

Switch(config)# mac access-list mac
Switch(config-mac-acl)# permit src-mac host 0.0.1 dest-mac any
Switch(config-mac-acl)# exit
Switch(config)# class-map cmap1
Switch(config-cmap)# match access-group mac
Switch(config-cmap)# exit
Switch(config)# policy-map pmap1
Switch(config-pmap)# class cmap1
Switch(config-pmap-c)# load-balance hash-value aaa
Switch(config-pmap-c)# port-channel load-balance round-robin disable
Switch(config-pmap-c)# exit
Switch(config-pmap)# exit
Switch(config)# interface eth-0-3
Switch(config-if)# no shutdown
Switch(config-if)# service-policy input pmap1
Switch(config-if)# end

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value aaa
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: aaa
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all user xor
port-channel non-unicast all NOCFG NOCFG
ecmp - all NOCFG NOCFG
ecmp flow id all NOCFG NOCFG

Используйте команды для отображения информации о значении ACL:

Switch# show running-config
mac access-list mac
10 permit src-mac host 0000.0000.0001 dest-mac any
!
hash-field user
l2 macsa
ip ipsa
!
hash-value aaa
port-channel unicast select user
!
class-map match-any cmap1
match access-group mac
!
policy-map pmap1
class cmap1
port-channel load-balance round-robin disable
load-balance hash-value aaa
!
interface eth-0-3
service-policy input pmap1
!
interface null0
!

Настройка Non-unicast Linkagg Hash

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования.

Switch(config)# hash-value aaa
Switch(config-hash-value)# port-channel non-unicast select user
Switch(config-hash-value)# exit

Шаг 4: Установите значение хэширования на интерфейсе

Switch(config)# interface range eth-0-1 - 2
Switch(config-if-range)# no shutdown
Switch(config-if-range)# static-channel-group 1
Switch(config-if-range)# exit
Switch(config)# interface agg 1
Switch(config-if)# load-balance hash-value aaa input
Switch(config-if)# exit
Switch(config)# interface eth-0-3
Switch(config-if)# load-balance hash-value aaa input
Switch(config-if)# end

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value aaa
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: aaa
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all NOCFG NOCFG
port-channel non-unicast all user xor
ecmp - all NOCFG NOCFG
ecmp flow id all NOCFG NOCFG

Используйте следующую команду, чтобы отобразить применение значения хеширования к порту:

Switch# show hash-value interface-applied 
eth-0-3
hash-value aaa input
agg1
hash-value aaa input

2.16.2 Настройка ECMP Hash

ECMP (Equal-cost multi-path routing) — стратегия маршрутизации, при которой пересылка пакетов к одному назначению может происходить через несколько путей с одинаковыми метриками, что существенно увеличивает пропускную способность за счет балансировки трафика.

Настройка глобального хэширования ECMP

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите глобальное значение хэширования

Switch(config)# hash-value global
Switch(config-hash-value-global)# ecmp select user
Switch(config-hash-value-global)# end

Шаг 4: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value global 
LBT:load balance type LBM :load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value global
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel - all port-channel xor
ecmp - all user xor
ecmp flow id all user xor
entropy - all ecmp xor
----------------------------------------------------------------------
Efd hash field select:
macsa macda
ipsa ipda
sourceport destport
ip-protocol

Настройка ECMP Hash Input

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования

Switch(config)# hash-value bbb
Switch(config-hash-value)# ecmp select user
Switch(config-hash-value)# exit

Шаг 4: Установите значение хэширования на интерфейсе

Switch(config)# interface eth-0-1
Switch(config-if)# no shutdown
Switch(config-if)# load-balance hash-value bbb input
Switch(config-if)# end

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о глобальном значении хэширования:

Switch# show hash-value bbb
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: bbb
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all NOCFG NOCFG
port-channel non-unicast all NOCFG NOCFG
ecmp - all user xor
ecmp flow id all NOCFG NOCFG

Используйте следующую команду, чтобы отобразить применение значения хеширования к порту:

Switch# show hash-value interface-applied 
eth-0-1
hash-value bbb input

Настройка ECMP Hash input

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите поле хэширования

Switch(config)# hash-field user
Switch(config-hash-field)# l2 macsa
Switch(config-hash-field)# ip ipsa
Switch(config-hash-field)# exit

Шаг 3: Установите значение хэширования

Switch(config)# hash-value bbb
Switch(config-hash-value)# ecmp select user
Switch(config-hash-value)# exit

Шаг 4: Добавьте действие ACL на интерфейс и установите значение хэширования на интерфейсе

Switch(config)# mac access-list mac
Switch(config-mac-acl)# permit src-mac host 0.0.1 dest-mac any
Switch(config-mac-acl)# exit
Switch(config)# class-map cmap1
Switch(config-cmap)# match access-group mac
Switch(config-cmap)# exit
Switch(config)# policy-map pmap1
Switch(config-pmap)# class cmap1
Switch(config-pmap-c)# load-balance hash-value bbb
Switch(config-pmap-c)# ecmp load-balance round-robin disable
Switch(config-pmap-c)# exit
Switch(config-pmap)# exit
Switch(config)# interface eth-0-1
Switch(config-if)# no shutdown
Switch(config-if)# service-policy input pmap1
Switch(config-if)# end

Шаг 5: Проверка

Используйте команды для отображения информации о поле хэширования:

Switch# show hash-field user
hash-field name: user
Option Control type
----------------------------------------------------------------------
ipv6 address compress xor
hash seed user set (0)
hash arithmetic xor
hash symmetry disable
ip enable
ipv6 enable
mpls enable
----------------------------------------------------------------------
hash field select
Packet HashField
----------------------------------------------------------------------
l2: macsa

ip: ipsa

ipv6: ipsa ipda
l4-sourceport l4-destport
ip-protocol

gre: ipsa ipda
gre-key

vxlan: vni outer-l4-sourceport
outer-ipda outer-ipsa

nvgre: vsid outer-ipda
outer-ipsa

mpls: top-label 2nd-label

vpws: top-label 2nd-label

vpls(inner-l2): inner-macda inner-macsa

vpls(inner-l3): inner-ipda inner-ipsa

l3vpn: inner-ipsa inner-ipda
inner-ip-protocol inner-l4-sourceport
inner-l4-destport

Используйте команды для отображения информации о значении хэширования:

Switch# show hash-value bbb
LBT:load balance type LBM:load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value name: bbb
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel unicast all NOCFG NOCFG
port-channel non-unicast all NOCFG NOCFG
ecmp - all user xor
ecmp flow id all NOCFG NOCFG

Используйте команды для отображения информации о ACL:

mac access-list mac
10 permit src-mac host 0000.0000.0001 dest-mac any
!
hash-field user
l2 macsa
ip ipsa
!
hash-value bbb
ecmp select user
!
class-map match-any cmap1
match access-group mac
!
policy-map pmap1
class cmap1
ecmp load-balance round-robin disable
load-balance hash-value bbb
!
interface eth-0-1
service-policy input pmap1
!
interface null0
!

2.16.3 Настройка EFD Hash

EFD (Elephant Flow Detection) — механизм для обнаружения "тяжелых" потоков (elephant flow), которые занимают большую часть пропускной способности сети. Хэширование EFD используется для распознавания и обработки таких потоков с целью минимизации их воздействия на сеть.

Глобальная настройка хэширования EFD

Шаг 1: Войдите в режим конфигурации

Switch# configure terminal

Шаг 2: Установите глобальное значение хэширования

Switch(config)# hash-value global
Switch(config-hash-value-global)# efd select ipsa macsa
Switch(config-hash-value-global)# end

Шаг 3: Проверка

Используйте команду для отображения информации о глобальном значении хэширования.

Switch# show hash-value global 
LBT:load balance type LBM :load balance mode
PT :packet type HF :hash field
HA :hash arithmetic
hash-value global
LBT LBM PT HF HA
----------------------------------------------------------------------
port-channel - all port-channel xor
ecmp - all ecmp xor
ecmp flow id all ecmp xor
entropy - all ecmp xor
----------------------------------------------------------------------
Efd hash field select:
macsa ipsa