quinta-feira, 3 de junho de 2010

BGP - Load balance Multipath


1        Load Balance no BGP e no OSPF

O roteamento BGP usa uma seqüência de atributos (Local Preference, AS_PATH, origem, etc.) para seleção de rotas onde o balanceamento somente é feito quando ocorre empate de todos esses atributos. O empate ocorre para links paralelos entre os mesmos roteadores, porém para um destino para outro AS por caminhos diferentes o balanceamento não é feito devido ao critério de seleção da rota externa mais antiga.
Para que esse critério seja ignorado e o balanceamento ocorra existe no roteador um comando que inclui o multipath para load balance. Essa mesma configuração pode ser feita para fazer o balanceamento de mais que 6 links (o default da cisco é 4 e o máximo é 6) até 16 links.
No OSPF o mesmo pode ser feito com o comando “maximum-path”. O padrão são 4 links e pode ser configurado até 16 links paralelos.


2        Cenário

2.1           Objetivo

Seis roteadores (R1, R2, R3, R4, R5 e R6) são conectados fisicamente R1-R2-R3-R4-R5-R6-R1 e devem ser configurados com roteamento BGP seguindo os critérios abaixo:
         Os roteadores R1, R2 e R3 devem possuir como IGP o OSPF na área 0 divulgando suas interfaces físicas;
         Os roteadores R4, R5 e R6 devem possuir como IGP o OSPF na área 0 divulgando suas interfaces físicas e suas loopbacks. O tráfego deve ser balanceado entre todos os links seriais;
         O R1 (AS 123) deverá fazer conexão EBGP com o R4 (AS 456) e IBGP com o R2 (AS 123) divulgando somente a sua loopback (1.1.1.1);
         O R3 (AS 123) deverá fazer conexão EBGP com o R6 (AS 456) e IBGP com o R2 (AS 123) divulgando somente a sua loopback (3.3.3.3);
         A conexão iBGP entre R4xR5 e R5xR6 devem ser feitas pelas loopbacks;
         Os roteadores R2 e R5 deverão ser Router-reflectors dos seus respectivos AS;

2.2           Topologia

Figure-01:              Topologia

2.3           IOS utilizados

         R1, R2, R3, R4, R5 e R6 – c7200-js-mz.123-7.T.bin

2.4           Configuração dos Roteadores

Em todos os roteadores, antes de configurar o roteamento BGP, deve-se configurar o IGP, ou seja, o roteamento interno para que os roteadores possam conhecer o endereço IP para fechar a conexão BGP e também para que a rota seja divulgada na tabela de roteamento BGP. Esse IGP pode ser OSPF, ISIS, estático, etc.

2.4.1      Configurações do OSPF

Para o OSPF a configuração é feita pelo comando “router ospf ” onde o “processo” é um numero do processo OSPF. Para adicionar interfaces usa-se o comando “network
area ”. Para o roteador fazer vizinhança OSPF é necessário que a rede da interface esteja no comando “network” e a interface não esteja configurada como “passive-interface”.
As interfaces de borda dos roteadores de borda são configuradas como “passive-interface” dentro das configurações de roteamento.
Por default o OSPF faz balanceamento de 4 links do mesmo custo. Para aumentar essa quantidade usa-se o comando “maximum-path ”.

2.4.2      Configurações do BGP

No BGP, agora que os roteadores conhecem os endereços IPs de seus vizinhos pelo IGP, configura-se-o em todos os roteadores pelo comando “router bgp ” onde o “AS” é o Autonomous System do provedor. Dentro da configuração de BGP adicionam-se os vizinhos estaticamente com o comando “neighbor remote-as ”, onde se o for igual ao AS do roteador a conexão é IBGP, se for diferente será EBGP.
Para ser feita a conexão BGP na loopback, configura-se a origem com as loopback na conexão BGP com o comando “neighbor update-source loopback0”.
Adiciona-se o IP da interface loopback como Router-ID pelo comando “router-id ”. Para divulgar rede no BGP é necessário que a rede exista na tabela de roteamento interna e ou adicionar o comando “network mask ” ou redistribuindo rotas para o BGP com o comando “redistribute ”.
Os roteadores dentro do mesmo AS não divulgarão as rotas IBGP entre eles, pois o BGP só divulga para o vizinho rotas aprendidas por EBGP, ou seja, rotas externas. Para isso ou faz-se o full-mesh de conexão BGP ou configuram-se os roteadores centrais como Router-reflectors adicionando os demais roteadores como clientes pelo comando “neighbor router-reflector-client”.
Para que seja feito o load balance adiciona-se o comando “maximum-paths ibgp ” dentro das configurações do roteamento BGP.

2.5           Observações e Bugs

Observe que, caso não fosse incluído o comando de multipath, a rota preferencial seria escolhida baseada na rota externa mais antiga que entrou na tabela de rotamento.
Se for alterado algum atributo da rota para prefir uma delas, o multipath será desconsiderado. O Multipath só é valido para empates feitos do Weight, Local preference AS_PATH, Origem e IGP.
Documentação:
https://www.cisco.com/en/US/docs/ios/12_3t/12_3t2/feature/guide/gt_mpg6.html

2.6           Comandos Importantes de Verificação

R5#show ip bgp 1.1.1.1
BGP routing table entry for 1.1.1.1/32, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Multipath: iBGP
  Not advertised to any peer
  123
    36.36.36.3 (metric 65) from 6.6.6.6 (6.6.6.6)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath
  123
    14.14.14.1 (metric 65) from 4.4.4.4 (4.4.4.4)
      Origin IGP, metric 0, localpref 100, valid, internal, multipath, best

R5#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/32 is subnetted, 1 subnets
B       1.1.1.1 [200/0] via 36.36.36.3, 00:30:41
                [200/0] via 14.14.14.1, 00:31:10
     4.0.0.0/32 is subnetted, 1 subnets
O       4.4.4.4 [110/65] via 45.45.45.22, 00:28:30, Serial2/5
                [110/65] via 45.45.45.18, 00:28:30, Serial2/4
                [110/65] via 45.45.45.14, 00:28:30, Serial2/3
                [110/65] via 45.45.45.10, 00:28:30, Serial2/2
                [110/65] via 45.45.45.6, 00:28:30, Serial2/1
                [110/65] via 45.45.45.2, 00:28:30, Serial2/0
     5.0.0.0/32 is subnetted, 1 subnets
C       5.5.5.5 is directly connected, Loopback0
     36.0.0.0/24 is subnetted, 1 subnets
O       36.36.36.0 [110/65] via 56.56.56.22, 00:28:31, Serial1/5
                   [110/65] via 56.56.56.18, 00:28:31, Serial1/4
                   [110/65] via 56.56.56.14, 00:28:31, Serial1/3
                   [110/65] via 56.56.56.10, 00:28:31, Serial1/2
                   [110/65] via 56.56.56.6, 00:28:31, Serial1/1
                   [110/65] via 56.56.56.2, 00:28:31, Serial1/0
     6.0.0.0/32 is subnetted, 1 subnets
O       6.6.6.6 [110/65] via 56.56.56.22, 00:28:31, Serial1/5
                [110/65] via 56.56.56.18, 00:28:31, Serial1/4
                [110/65] via 56.56.56.14, 00:28:31, Serial1/3
                [110/65] via 56.56.56.10, 00:28:31, Serial1/2
                [110/65] via 56.56.56.6, 00:28:31, Serial1/1
                [110/65] via 56.56.56.2, 00:28:31, Serial1/0
     56.0.0.0/8 is variably subnetted, 12 subnets, 2 masks
C       56.56.56.16/30 is directly connected, Serial1/4
C       56.56.56.18/32 is directly connected, Serial1/4
C       56.56.56.20/30 is directly connected, Serial1/5
C       56.56.56.22/32 is directly connected, Serial1/5
C       56.56.56.8/30 is directly connected, Serial1/2
C       56.56.56.10/32 is directly connected, Serial1/2
C       56.56.56.12/30 is directly connected, Serial1/3
C       56.56.56.14/32 is directly connected, Serial1/3
C       56.56.56.0/30 is directly connected, Serial1/0
C       56.56.56.2/32 is directly connected, Serial1/0
C       56.56.56.4/30 is directly connected, Serial1/1
C       56.56.56.6/32 is directly connected, Serial1/1
     14.0.0.0/24 is subnetted, 1 subnets
O       14.14.14.0 [110/65] via 45.45.45.22, 00:28:31, Serial2/5
                   [110/65] via 45.45.45.18, 00:28:31, Serial2/4
                   [110/65] via 45.45.45.14, 00:28:31, Serial2/3
                   [110/65] via 45.45.45.10, 00:28:31, Serial2/2
                   [110/65] via 45.45.45.6, 00:28:31, Serial2/1
                   [110/65] via 45.45.45.2, 00:28:31, Serial2/0
     45.0.0.0/8 is variably subnetted, 12 subnets, 2 masks
C       45.45.45.12/30 is directly connected, Serial2/3
C       45.45.45.14/32 is directly connected, Serial2/3
C       45.45.45.8/30 is directly connected, Serial2/2
C       45.45.45.10/32 is directly connected, Serial2/2
C       45.45.45.4/30 is directly connected, Serial2/1
C       45.45.45.6/32 is directly connected, Serial2/1
C       45.45.45.0/30 is directly connected, Serial2/0
C       45.45.45.2/32 is directly connected, Serial2/0
C       45.45.45.20/30 is directly connected, Serial2/5
C       45.45.45.22/32 is directly connected, Serial2/5
C       45.45.45.16/30 is directly connected, Serial2/4
C       45.45.45.18/32 is directly connected, Serial2/4

3        Configuração

3.1           R1

!
router ospf 1
 passive-interface FastEthernet1/0
 network 12.12.12.1 0.0.0.0 area 0
 network 14.14.14.1 0.0.0.0 area 0
!
router bgp 123
 network 1.1.1.1 mask 255.255.255.255
 neighbor 12.12.12.2 remote-as 123
 neighbor 14.14.14.4 remote-as 456
!

3.2           R2

!
router ospf 1
 network 12.12.12.2 0.0.0.0 area 0
 network 23.23.23.2 0.0.0.0 area 0
!
router bgp 123
 neighbor 12.12.12.1 remote-as 123
 neighbor 12.12.12.1 route-reflector-client
 neighbor 23.23.23.3 remote-as 123
 neighbor 23.23.23.3 route-reflector-client
!

3.3           R3

!
router ospf 1
 passive-interface FastEthernet0/0
 network 23.23.23.3 0.0.0.0 area 0
 network 36.36.36.3 0.0.0.0 area 0
!
router bgp 123
 neighbor 23.23.23.2 remote-as 123
 neighbor 36.36.36.6 remote-as 456
!

3.4           R4

!
router ospf 1
 passive-interface FastEthernet1/0
 network 4.4.4.4 0.0.0.0 area 0
 network 14.14.14.4 0.0.0.0 area 0
 network 45.45.45.0 0.0.0.3 area 0
 network 45.45.45.4 0.0.0.3 area 0
 network 45.45.45.8 0.0.0.3 area 0
 network 45.45.45.12 0.0.0.3 area 0
 network 45.45.45.16 0.0.0.3 area 0
 network 45.45.45.20 0.0.0.3 area 0
 maximum-paths 6
!
router bgp 456
 bgp router-id 4.4.4.4
 neighbor 5.5.5.5 remote-as 456
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 14.14.14.1 remote-as 123
!

3.5           R5

!
router ospf 1
 network 5.5.5.5 0.0.0.0 area 0
 network 45.45.45.0 0.0.0.3 area 0
 network 45.45.45.5 0.0.0.0 area 0
 network 45.45.45.4 0.0.0.3 area 0
 network 45.45.45.8 0.0.0.3 area 0
 network 45.45.45.12 0.0.0.3 area 0
 network 45.45.45.16 0.0.0.3 area 0
 network 45.45.45.20 0.0.0.3 area 0
 network 56.56.56.0 0.0.0.3 area 0
 network 56.56.56.5 0.0.0.0 area 0
 network 56.56.56.4 0.0.0.3 area 0
 network 56.56.56.8 0.0.0.3 area 0
 network 56.56.56.12 0.0.0.3 area 0
 network 56.56.56.16 0.0.0.3 area 0
 network 56.56.56.20 0.0.0.3 area 0
 maximum-paths 6
!
router bgp 456
 bgp router-id 5.5.5.5
 neighbor 4.4.4.4 remote-as 456
 neighbor 4.4.4.4 update-source Loopback0
 neighbor 6.6.6.6 remote-as 456
 neighbor 6.6.6.6 update-source Loopback0
 maximum-paths ibgp 16
!

3.6           R6

!
router ospf 1
 passive-interface FastEthernet0/0
 network 6.6.6.6 0.0.0.0 area 0
 network 36.36.36.6 0.0.0.0 area 0
 network 56.56.56.0 0.0.0.3 area 0
 network 56.56.56.6 0.0.0.0 area 0
 network 56.56.56.4 0.0.0.3 area 0
 network 56.56.56.8 0.0.0.3 area 0
 network 56.56.56.12 0.0.0.3 area 0
 network 56.56.56.16 0.0.0.3 area 0
 network 56.56.56.20 0.0.0.3 area 0
 maximum-paths 6
!
router bgp 456
 bgp router-id 6.6.6.6
 neighbor 5.5.5.5 remote-as 456
 neighbor 5.5.5.5 update-source Loopback0
 neighbor 36.36.36.3 remote-as 123
!

 

5 comentários:

Anônimo disse...

I vіѕіtеd multiple blogs but thе audio qualitу fοr аudio sοngs current at thіs web page iѕ reаlly fаbulous.



Fеel free tο ѕurf tо my website; Hemorrhoids Treatment
My web page :: bladder disease

Anônimo disse...

Αhaa, itѕ good conversation cοncerning this article at thіs place аt this web sіtе, I havе геaԁ all that, so now me also commenting at this plаce.



my ωеb blοg Haarausfall

Anônimo disse...

I am no lοnger сeгtain where you are getting your info, but greаt tοpic.
I must ѕpend sоme time fіndіng οut more
οr wοrκing out morе.
Thank уou foг magnificent infoгmation ӏ uѕеd to
be sеarchіng for this info fοr my mission.


Heге is mу web-ѕite ... chat rooms options

Anônimo disse...

І dοn't even know how I ended up here, but I thought this post was good. I don't know ωho you aгe but certainly уou аre
going tο a fаmouѕ bloggeг if уou аren't already ;) Cheers!

Feel free to surf to my web-site: providing hemorrhoids relief

Anônimo disse...

I must thanκ you for the efforts you have
put in writіng this site. Ӏ really hope tо see the same high-gradе cοntent bу уou in the future
аѕ well. Ιn fact, yοur сreatіvе wrіting abіlіties has encouraged me to get my νery oωn blog now ;)

Look into my homepage :: http://Lawfirmarticles.com/Amazing-Advantages-Of-Taking-Diet-Pills-For-Surplus-Fat-Loss.htm