Postado originalmente por
parreira13
Configuração
No Router A:
# loopback interface
/interface bridge add name=lobridge
# addresses
/ip address add address=1.1.1.1/24 interface=ether1
/ip address add address=2.2.2.1/24 interface=ether2
/ip address add address=3.3.3.1/24 interface=ether3
/ip address add address=9.9.9.1/32 interface=lobridge
# ECMP route to peer's loopback
/ip route add dst-address=9.9.9.2/32 gateway=1.1.1.2,2.2.2.2,3.3.3.2
# BGP
/routing bgp instance set default as=65000
/routing bgp add name=peer1 remote-address=9.9.9.2 remote-as=65000 update-source=lobridge
No Router B:
# loopback interface
/interface bridge add name=lobridge
# addresses
/ip address add address=1.1.1.2/24 interface=ether1
/ip address add address=2.2.2.2/24 interface=ether2
/ip address add address=3.3.3.2/24 interface=ether3
/ip address add address=9.9.9.2/32 interface=lobridge
# ECMP route to peer's loopback
/ip route add dst-address=9.9.9.1/32 gateway=1.1.1.1,2.2.2.1,3.3.3.1
# BGP
/routing bgp instance set default as=65000
/routing bgp add name=peer1 remote-address=9.9.9.1 remote-as=65000 update-source=lobridge
# a route to advertise
/routing bgp network add network=4.4.4.0/24
Resultados
Checke esta BGP connection se esta estabelicida:
[filipe@B] > /routing bgp peer print status
Flags: X - disabled
0 name="peer1" instance=default remote-address=9.9.9.1 remote-as=65000
tcp-md5-key="" nexthop-choice=default multihop=no route-reflect=no hold-time=3m
ttl=255 in-filter="" out-filter="" address-families=ip
update-source=lobridge default-originate=no remote-id=1.1.1.1
local-address=9.9.9.2 uptime=28s prefix-count=0 updates-sent=1
updates-received=0 withdrawn-sent=0 withdrawn-received=0 remote-hold-time=3m
used-hold-time=3m used-keepalive-time=1m refresh-capability=yes
as4-capability=yes state=established
Route table no Router A:
[filipe@A] > /ip route print
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
# DST-ADDRESS PREF-SRC G GATEWAY DISTANCE INTER...
0 ADC 1.1.1.0/24 1.1.1.1 0 ether1
1 ADC 2.2.2.0/24 2.2.2.1 0 ether2
2 ADC 3.3.3.0/24 3.3.3.1 0 ether3
3 ADb 4.4.4.0/24 r 9.9.9.2 200 ether1
ether2
4 ADC 9.9.9.1/32 9.9.9.1 0 lobridge
5 A S 9.9.9.2/32 r 1.1.1.2 1 ether1
r 2.2.2.2 ether2
r 3.3.3.2 ether3
[filipe@A] > /ip route print detail
Flags: X - disabled, A - active, D - dynamic,
C - connect, S - static, r - rip, b - bgp, o - ospf, m - mme,
B - blackhole, U - unreachable, P - prohibit
0 ADC dst-address=1.1.1.0/24 pref-src=1.1.1.1 interface=ether1 distance=0 scope=10
1 ADC dst-address=2.2.2.0/24 pref-src=2.2.2.1 interface=ether2 distance=0 scope=10
2 ADC dst-address=3.3.3.0/24 pref-src=3.3.3.1 interface=ether3 distance=0 scope=10
3 ADb dst-address=4.4.4.0/24 gateway=9.9.9.2 interface=ether1,ether2,ether3
gateway-state=recursive distance=200 scope=40 target-scope=30
bgp-local-pref=100 bgp-origin=igp received-from=9.9.9.2
4 ADC dst-address=9.9.9.1/32 pref-src=9.9.9.1 interface=lobridge distance=0 scope=10
5 A S dst-address=9.9.9.2/32 gateway=1.1.1.2,2.2.2.2,3.3.3.2 interface=ether1,ether2,ether3
gateway-state=reachable,reachable distance=1 scope=30 target-scope=10
a routa 4.4.4.0./24 esta instalada em Linux kernel agora com tres nexthops: 1.1.1.2 (on ether1) ,
2.2.2.2 (on ether2) and 3.3.3.2 (on ether3).
Exemplo com eBGP
Configuracao
O exemplo dado acima é desenvolvido para o caso eBGP. Por padrão, os pares eBGP são obrigatórios
para ser acessado diretamente. Se estamos usando interfaces loopback, que tecnicamente não são, por
isso, multihop=yes configuração deve ser especificada.
No Router A:
/routing bgp instance set default as=65000
/routing bgp set peer1 remote-address=9.9.9.2 remote-as=65001 update-source=lobridge multihop=yes
No Router B:
/routing bgp instance set default as=65001
/routing bgp set peer1 remote-address=9.9.9.1 remote-as=65000 update-source=lobridge multihop=yes
Resultados
Se agora imprimir a tabela de roteamento no router A, vemos que a rota de Router B está lá, mas é
não ativo:
...
2 Db dst-address=4.4.4.0/24 gateway=9.9.9.2 interface="" gateway-state=unreachable
distance=20 scope=40 target-scope=10 bgp-as-path="65001" bgp-origin=igp
received-from=9.9.9.2
...
Isso ocorre porque as rotas eBGP são instalados com menor target-scope por padrão. Para resolver
isso, a configuração
filtro que define de maior escopo de destino de roteamento:
/routing filter add chain=bgp-in set-target-scope=30
/routing bgp set peer1 in-filter=bgp-in
Ou então, modificar atributo âmbito da rota estática:
/ip route set [find dst-address=9.9.9.2/32] scope=10
de qualquer a maenira a routa para 4.4.4.0/24 deveria estar ativo agora:
2 ADb dst-address=4.4.4.0/24 gateway=9.9.9.2 interface=ether1,ether2,ether3
gateway-state=recursive distance=20 scope=40 target-scope=10
bgp-as-path="65001" bgp-origin=igp received-from=9.9.9.2