[GTER] BGP de borda com redundância de Caixa e apenas uma sessão BGP

Humberto Galiza humbertogaliza at gmail.com
Wed Dec 19 17:16:08 -02 2012


Excelente post Douglas!
Seria ótimo você apresentar esse case num GTER da vida :)

Abs,

Humberto Galiza



Em 18 de dezembro de 2012 21:56, Douglas Fischer
<fischerdouglas at gmail.com>escreveu:

> Senhores,
> quero aqui compartilhar uma gambiarra com o "q" de elegância que desenvolvi
> para atender o cenário de nossa empresa.
>
> Nossa empresa, dentro outros serviços, opera dois datacenteres com foco em
> serviços gerenciados.
> Por causa desse nicho de mercado, a nossa maior premissa é redundância.
> E sendo assim temos TUDO duplicado.
>
> E na parte de borda temos dois conjuntos de Switch-DMZ,
> Firewall-em-fail-over, e Router de Borda.
>
> Na implantação do ASN de nossa empresa nosso maior desafio foi implementar
> algum mecanismo que provesse redundância automática em caso de falha de uma
> das caixas.
>
> A receita de bolo padrão para esses casos: Router_A só faz BGP com
> Operadora_A e Router_B só faz BGP com Operadora_B e um iBGP entre eles, não
> atendia o requisito abaixo:
>    "Caso uma das caixas pare,
>     mas os 2 links estiverem operacionais,
>     a outra caixa deve tocar os dois links."
>
> As operadoras vinham sempre com o papinho mole de que "duas sessões BGP
> oneram os nossos PE em processamento e memória, blá blá blá..." e que por
> isso não poderiam liberar as duas sessões BGP.
> A verdade é que como somos nanicos perto dos grande nomes do mercado, eles
> não se dispunham a trabalhar isso comercialmente.
>
> Então bolei uma forma de subir uma sessão BGP apenas e garantir H.A.
> Fiz isso usando:
> - e-BGP e VRRP(means /29) na rede WAN da Operadora
> - Loopbacks do e-BGP exclusivas para cada operadora
> - Embeeded Event Manager para aplicar e desaplicar comandos conforme o
> cenário muda.
>
> Para isso o cenário abaixo foi montado:
> - Dois sites, A e B.
> - Um router Cisco ISR-G2 c/ 2.5GB de memória em cada Site.
> - Um switch de DMZ em cada Site, interligados por fibra.
> - Um link de cada operadora chegando em cada Site.
>    - Link da Operadora A na Vlan 2000
>       - Rede WAN com a operadora sendo um /29
>         - A.A.A.1 IP do Borda da Operadora
>         - A.A.A.2 IP Virtual entre os nossos dois routers.
>         - A.A.A.5 IP do nosso router A
>         - A.A.A.6 IP do nosso router B
>       - Borda da Operadora estabelecendo e-BGP um um IP do meu bloco que
> está em uma loopback /32
>       - O Borda da Operadora tem uma rota para esse IP da loopback
> apontando para o IP Virtual(VRRP) que roda entre os nossos dois bordas.
>    - Link da Operadora B na Vlan 3000
>       - Rede WAN com a operadora sendo um /29
>         - B.B.B.1 IP do Borda da Operadora
>         - B.B.B.2 IP Virtual entre os nossos dois routers.
>         - B.B.B.5 IP do nosso router A
>         - B.B.B.6 IP do nosso router B
>       - Borda da Operadora estabelecendo e-BGP um um IP do meu bloco que
> está em uma loopback /32
>       - O Borda da Operadora tem uma rota para esse IP da loopback
> apontando para o IP Virtual(VRRP) que roda entre os nossos dois bordas.
>
> P.S.: A maior encrenca foi conseguir o famigerado /29 na rede WAN junto a
> operadora.
>       Pensa numa briga quase infindável.
>
>
> Seguem abaixo as configurações resumidas ao que realmente importa do router
> primário e secundário.
>
> Como o foco aqui era alta disponibilidade, a parte de filtros de BGP e
> roteamento para dentro foi resumida ao máximo.
>
> O itens <entre_maior_menor> são variáveis a serem substituídas para
> realidade de cada um.
>
> O Bloco que me foi alocado é representado por 177.???.???/22, com as
> sub-redea 177.???.??0.0/24 177.???.??0.1/24 177.???.??0.2/24
> 177.???.??3.0/24.
>
> Foi criada uma Vlan para inter-routing rodando uma sub-rede /31 só para
> roda o iBGP, pois na sub-interface de DMZ eu tinha controles de
> traffic-shaping e também route-map para redirecionar trafego conforme a
> necessidade.
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!!!!!!Router Primário!!!!!!!!!!!!
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> interface Loopback<MEU_ASN>
>  description Loopback p/ definir Router-ID
>  ip address 177.???.?0.0 255.255.255.255
> !
> interface Loopback<ASN_OPERADORA_A>
>  description Loopback p/ e-BGP com operadora A
>  ip address 177.???.?0.2 255.255.255.255
> !
> interface Loopback<ASN_OPERADORA_B>
>  description Loopback p/ e-BGP com operadora B
>  ip address 177.???.?0.3 255.255.255.255
> !
> interface GigabitEthernet0/0
>  description Redes Internas - DMZ
>  no ip address
>  ip nbar protocol-discovery
>  ip flow ingress
>  load-interval 30
>  duplex auto
>  speed auto
> !
> interface GigabitEthernet0/0.1100
>  description DMZ
>  encapsulation dot1Q 1100
>  ip address 177.???.??0.34 255.255.255.224
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 1 ip 177.???.??0.33
>  vrrp 1 priority 150
> !
> interface GigabitEthernet0/0.1150
>  description Inter-Routing
>  encapsulation dot1Q 1150
>  ip address 177.???.??2.0 255.255.255.254
>  ip nbar protocol-discovery
>  ip flow ingress
> !
> interface GigabitEthernet0/1
>  description Redes Externas - Operadoras, PTT, etc...
>  no ip address
>  ip nbar protocol-discovery
>  ip flow ingress
>  load-interval 30
>  duplex auto
>  speed auto
> !
> interface GigabitEthernet0/1.2000
>  encapsulation dot1Q 2000
>  ip address A.A.A.5 255.255.255.248
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 1 ip A.A.A.2
>  vrrp 1 priority 150
> !
> interface GigabitEthernet0/1.3000
>  encapsulation dot1Q 3000
>  ip address B.B.B.5 255.255.255.248
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 250 ip B.B.B.2
>  vrrp 250 priority 150
> !
> router bgp <MEU_ASN>
>  bgp router-id 177.???.??0.0
>  bgp log-neighbor-changes
>  network 177.??.??.0 mask 255.255.252.0
>  neighbor 177.??.?+2.1 remote-as <MEU_ASN>
>  neighbor 177.??.?+2.1 update-source GigabitEthernet0/0.1150
>  neighbor 177.??.?+2.1 next-hop-self
>  neighbor 177.??.?+2.1 soft-reconfiguration inbound
>  neighbor A.A.A.1 remote-as <ASN_OPERADORA_A>
>  neighbor A.A.A.1 ebgp-multihop 3
>  neighbor A.A.A.1 update-source Loopback<ASN_OPERADORA_A>
>  neighbor A.A.A.1 soft-reconfiguration inbound
>  neighbor A.A.A.1 prefix-list MEUS-BLOCOS out
>  neighbor B.B.B.1 remote-as <ASN_OPERADORA_B>
>  neighbor B.B.B.1 ebgp-multihop 3
>  neighbor B.B.B.1 update-source Loopback<ASN_OPERADORA_B>
>  neighbor B.B.B.1 soft-reconfiguration inbound
>  neighbor B.B.B.1 prefix-list MEUS-BLOCOS out
> !
> ip local policy route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE
> !
> ip route 177.???.???.0 255.255.252.0 Null0
> ip route 177.???.??0.0 255.255.255.255 177.???.??2.1
> !
> ip access-list extended NET-<OPERADORA-A>-WAN
>  permit ip A.A.A.0 0.0.0.7 any
> ip access-list extended NET-<OPERADORA-B>-WAN
>  permit ip B.B.B.0 0.0.0.7 any
> !
> !
> ip prefix-list MEUS-BLOCOS seq 5 permit 177.??.??.0/22
> !
> route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE permit <ASN_OPERADORA_A>
>  match ip address NET-<OPERADORA-A>-WAN
>  set ip next-hop A.A.A.1
> !
> route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE permit <ASN_OPERADORA_B>
>  match ip address NET-<OPERADORA-B>-WAN
>  set ip next-hop B.B.B.1
> !
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-A>_EVENT_UP
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.2000 Grp 1 state .* ->
> Master"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-A>: This Router is now MASTER"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_A>"
>  action 2.4 cli command "no shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "no neighbor A.A.A.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-A>_EVENT_DOWN
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.2000 Grp 1 state Master ->
> .*"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-A>: This Router is NOT MASTER
> anymore"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_A>"
>  action 2.4 cli command "shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "neighbor A.A.A.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-B>_EVENT_UP
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.3000 Grp 250 state .* ->
> Master"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-B>: This Router is now MASTER"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_B>"
>  action 2.4 cli command "no shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "no neighbor B.B.B.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-B>_EVENT_DOWN
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.3000 Grp 250 state Master
> -> .*"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-B>: This Router is NOT MASTER
> anymore"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_B>"
>  action 2.4 cli command "shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "neighbor B.B.B.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> !
>
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!!!!!!Router Secundário!!!!!!!!!!
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> interface Loopback<MEU_ASN>
>  description Loopback p/ definir Router-ID
>  ip address 177.???.??0.1 255.255.255.255
> !
> interface Loopback<ASN_OPERADORA_A>
>  description Loopback p/ e-BGP com operadora A
>  shutdown
>  ip address 177.???.??0.2 255.255.255.255
> !
> interface Loopback<ASN_OPERADORA_B>
>  description Loopback p/ e-BGP com operadora B
>  shutdown
>  ip address 177.???.??0.3 255.255.255.255
> !
> interface GigabitEthernet0/0
>  description Redes Internas - DMZ
>  no ip address
>  ip nbar protocol-discovery
>  ip flow ingress
>  load-interval 30
>  duplex auto
>  speed auto
> !
> interface GigabitEthernet0/0.1100
>  description DMZ
>  encapsulation dot1Q 1100
>  ip address 177.???.??0.35 255.255.255.224
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 1 ip 177.???.??0.33
>  vrrp 1 priority 125
> !
> interface GigabitEthernet0/0.1150
>  description Inter-Routing
>  encapsulation dot1Q 1150
>  ip address 177.???.??2.1 255.255.255.254
>  ip nbar protocol-discovery
>  ip flow ingress
> !
> interface GigabitEthernet0/1
>  description Redes Externas - Operadoras, PTT, etc...
>  no ip address
>  ip nbar protocol-discovery
>  ip flow ingress
>  load-interval 30
>  duplex auto
>  speed auto
> !
> interface GigabitEthernet0/1.2000
>  encapsulation dot1Q 2000
>  ip address A.A.A.6 255.255.255.248
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 1 ip A.A.A.2
>  vrrp 1 priority 125
> !
> interface GigabitEthernet0/1.3000
>  encapsulation dot1Q 3000
>  ip address B.B.B.6 255.255.255.248
>  ip nbar protocol-discovery
>  ip flow ingress
>  vrrp 250 ip B.B.B.2
>  vrrp 250 priority 125
> !
> router bgp <MEU_ASN>
>  bgp router-id 177.???.??0.1
>  bgp log-neighbor-changes
>  network 177.???.???.0 mask 255.255.252.0
>  neighbor 177.???.??2.0 remote-as <MEU_ASN>
>  neighbor 177.???.??2.0 update-source GigabitEthernet0/0.1150
>  neighbor 177.???.??2.0 next-hop-self
>  neighbor 177.???.??2.0 soft-reconfiguration inbound
>  neighbor A.A.A.1 remote-as <ASN_OPERADORA_A>
>  neighbor A.A.A.1 shutdown
>  neighbor A.A.A.1 ebgp-multihop 3
>  neighbor A.A.A.1 update-source Loopback<ASN_OPERADORA_A>
>  neighbor A.A.A.1 soft-reconfiguration inbound
>  neighbor A.A.A.1 prefix-list MEUS-BLOCOS out
>  neighbor B.B.B.1 remote-as <ASN_OPERADORA_B>
>  neighbor B.B.B.1 shutdown
>  neighbor B.B.B.1 ebgp-multihop 3
>  neighbor B.B.B.1 update-source Loopback<ASN_OPERADORA_B>
>  neighbor B.B.B.1 soft-reconfiguration inbound
>  neighbor B.B.B.1 prefix-list MEUS-BLOCOS out
> !
> ip local policy route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE
> !
> ip route 177.???.???.0 255.255.252.0 Null0
> ip route 177.???.??0.1 255.255.255.255 177.???.??2.0
> !
> ip access-list extended NET-<OPERADORA-A>-WAN
>  permit ip A.A.A.0 0.0.0.7 any
> ip access-list extended NET-<OPERADORA-B>-WAN
>  permit ip B.B.B.0 0.0.0.7 any
> !
> !
> ip prefix-list MEUS-BLOCOS seq 5 permit 177.??.??.0/22
> !
> route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE permit <ASN_OPERADORA_A>
>  match ip address NET-<OPERADORA-A>-WAN
>  set ip next-hop A.A.A.1
> !
> route-map FORCE-LOCAL-PACKETS-ROUTING-BY-SOURCE permit <ASN_OPERADORA_B>
>  match ip address NET-<OPERADORA-B>-WAN
>  set ip next-hop B.B.B.1
> !
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-A>_EVENT_UP
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.2000 Grp 1 state .* ->
> Master"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-A>: This Router is now MASTER"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_A>"
>  action 2.4 cli command "no shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "no neighbor A.A.A.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-A>_EVENT_DOWN
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.2000 Grp 1 state Master ->
> .*"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-A>: This Router is NOT MASTER
> anymore"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_A>"
>  action 2.4 cli command "shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "neighbor A.A.A.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-B>_EVENT_UP
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.3000 Grp 250 state .* ->
> Master"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-B>: This Router is now MASTER"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_B>"
>  action 2.4 cli command "no shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "no neighbor B.B.B.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> event manager applet SYSLOG_VRRP_WAN-<OPERADORA-B>_EVENT_DOWN
>  event syslog pattern "VRRP-6-STATECHANGE: Gi0/1.3000 Grp 250 state Master
> -> .*"
>  action 1.1 syslog msg "VRRP WAN <OPERADORA-B>: This Router is NOT MASTER
> anymore"
>  action 2.1 cli command "enable"
>  action 2.2 cli command "configure terminal"
>  action 2.3 cli command "interface Loopback<ASN_OPERADORA_B>"
>  action 2.4 cli command "shutdown"
>  action 2.5 cli command "router bgp <MEU_ASN>"
>  action 2.6 cli command "neighbor B.B.B.1 shutdown"
>  action 2.7 cli command "end"
>  action 2.8 cli command "exit"
> !
>
>
> --
> Douglas Fernando Fischer
> Engº de Controle e Automação
> --
> gter list    https://eng.registro.br/mailman/listinfo/gter
>



More information about the gter mailing list