Skip to main content


Introdução


Neste laboratório, vamos simular uma rede para compreender na prática como funciona o roteamento Anycast com IPv6. O ambiente contará com cinco roteadores principais, cada um pertencente a um sistema autônomo (ASN) distinto, representando diferentes provedores (ISPs). Atuaremos como o ASN 64320, que hospedará o roteador e o servidor que responderá por um endereço IPv6 anycast.


O roteador do ASN 64320 será conectado a um switch dentro de cada um dos quatro ASNs simulados. Em cada caso, receberemos um endereço IPv6 do respectivo provedor para estabelecer uma sessão BGP com aquele ASN. A partir dessas conexões, anunciaremos o prefixo do nosso ASN e cada ISP será responsável por redistribuí-lo, permitindo que o endereço anycast seja acessado de diferentes pontos da rede.


A seguir, apresentamos a tabela com os prefixos e blocos utilizados por cada roteador no cenário:


RoteadorASNPrefixo BaseSubrede LoopbackLoopback IPRede LANRouter Network Interface
Router1650012001:db8:1::/482001:db8:1:1::/642001:db8:1:1::1/1282001:db8:1:10::/642001:db8:1:17::/64
Router2650022001:db8:2::/482001:db8:2:1::/642001:db8:2:1::2/1282001:db8:2:10::/642001:db8:2:17::/64
Router3650032001:db8:3::/482001:db8:3:1::/642001:db8:3:1::3/1282001:db8:3:10::/642001:db8:3:17::/64
Router4650042001:db8:4::/482001:db8:4:1::/642001:db8:4:1::4/1282001:db8:4:10::/642001:db8:4:17::/64
Router5650052001:db8:5::/482001:db8:5:1::/642001:db8:5:1::5/1282001:db8:5:10::/642001:db8:5:17::/64
Router anycast643202001:db8:ffff::/642001:db8:ffff::/642001:db8:ffff::9/128
Servidor anycast(n/a)(usa do roteador acima)2001:db8:ffff::100/128

Abaixo, deixo as conexões ponto a ponto entre os roteadores, especificando as interfaces utilizadas, os endereços IP configurados e os roteadores vizinhos. Essa tabela é essencial para visualizar a topologia e verificar as sessões BGP.


RoteadorInterfaceIP LocalConectado aIP Remoto
router1_65001Gig0/02001:db8:1:18::1/64router5_650052001:db8:1:18::5/64
router1_65001Gig0/12001:db8:1:17::1/64router2_650022001:db8:1:17::2/64

RoteadorInterfaceIP LocalConectado aIP Remoto
router2_65002Gig0/02001:db8:2:17::2/64router3_650032001:db8:2:17::3/64
router2_65002Gig0/12001:db8:1:17::2/64router1_650012001:db8:1:17::1/64

RoteadorInterfaceIP LocalConectado aIP Remoto
router3_65003Gig0/02001:db8:3:17::3/64router4_650042001:db8:3:17::4/64
router3_65003Gig0/12001:db8:2:17::3/64router2_650022001:db8:2:17::2/64

RoteadorInterfaceIP LocalConectado aIP Remoto
router4_65004Gig0/02001:db8:4:17::4/64router5_650052001:db8:4:17::5/64
router4_65004Gig0/12001:db8:3:17::4/64router3_650032001:db8:3:17::3/64

RoteadorInterfaceIP LocalConectado aIP Remoto
router5_65005Gig0/02001:db8:1:18::5/64router1_650012001:db8:1:18::1/64
router5_65005Gig0/12001:db8:4:17::5/64router4_650042001:db8:4:17::4/64

ipv4_mapeado

A imagem acima ilustra a topologia da rede utilizada neste exemplo..



Switches


Vamos começar configurando os switches de cada ISP, todos possuem as mesmas portas em uso, para simplificar, a porta G0/0 que terá um Roteador conectado, vou deixar a descrição apenas como router, assim podemos reutilizar a mesma configuração (isso vale para o nome do switch).

# Para a maioria dos Switches:
enable
conf t
!
hostname switch
!
interface GigabitEthernet0/0
description router
switchport mode access
no shut
!
interface GigabitEthernet0/1
description router anycast
switchport mode access
no shut
!
interface GigabitEthernet0/2
description client
switchport mode access
no shut
!
end
!
wr




# Para ao Switch do Router3:
enable
conf t
!
hostname switch
!
interface GigabitEthernet0/0
description router
switchport mode access
no shut
!
interface GigabitEthernet0/2
description client
switchport mode access
no shut
!
end
!
wr


Router 1


Vamos configurar o router1.

enable 
conf t
!
hostname router1_65001
!
ipv6 unicast-routing
!
! Vamos anunciar o /48 que nao esta em nenhuma interface:
ipv6 route 2001:db8:1::/48 Null0
!
interface Loopback0
ipv6 address 2001:db8:1:1::1/128

interface GigabitEthernet0/0
description BGP com router5_65005
ipv6 address 2001:db8:1:18::1/64
ipv6 enable
no shut

interface GigabitEthernet0/1
description BGP com router2_65002
ipv6 address 2001:db8:1:17::1/64
ipv6 enable
no shut

interface GigabitEthernet0/2
description LAN
ipv6 address 2001:db8:1:10::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:1:10::/64 1800 1800
ipv6 nd prefix default
no shut

router bgp 65001
bgp router-id 1.1.1.1
no bgp default ipv4-unicast
neighbor 2001:db8:1:17::2 remote-as 65002
neighbor 2001:db8:1:18::5 remote-as 65005
neighbor 2001:db8:1:10::100 remote-as 64320
!
address-family ipv6
network 2001:db8:1::/48
neighbor 2001:db8:1:17::2 activate
neighbor 2001:db8:1:18::5 activate
neighbor 2001:db8:1:10::100 activate
exit-address-family
!
end
wr


Router 2


Vamos configurar o router2.

enable 
conf t
!
hostname router2_65002
!
ipv6 unicast-routing
!
! Vamos anunciar o /48 que nao esta em nenhuma interface:
ipv6 route 2001:db8:2::/48 Null0
!
interface Loopback0
ipv6 address 2001:db8:2:1::2/128

interface GigabitEthernet0/0
description BGP com router3_65003
ipv6 address 2001:db8:2:17::2/64
ipv6 enable
no shut

interface GigabitEthernet0/1
description BGP com router1_65001
ipv6 address 2001:db8:1:17::2/64
ipv6 enable
no shut

interface GigabitEthernet0/2
description LAN
ipv6 address 2001:db8:2:10::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:2:10::/64 1800 1800
ipv6 nd prefix default
no shut

router bgp 65002
bgp router-id 1.1.1.2
no bgp default ipv4-unicast
neighbor 2001:db8:1:17::1 remote-as 65001
neighbor 2001:db8:2:17::3 remote-as 65003
neighbor 2001:db8:2:10::100 remote-as 64320
!
address-family ipv6
network 2001:db8:2::/48
neighbor 2001:db8:1:17::1 activate
neighbor 2001:db8:2:17::3 activate
neighbor 2001:db8:2:10::100 activate
exit-address-family
!
end
wr


Router 3


Vamos configurar o router3.

enable 
conf t
!
hostname router3_65003
!
ipv6 unicast-routing
!
! Vamos anunciar o /48 que nao esta em nenhuma interface:
ipv6 route 2001:db8:3::/48 Null0
!
interface Loopback0
ipv6 address 2001:db8:3:1::3/128

interface GigabitEthernet0/0
description BGP com router4_65004
ipv6 address 2001:db8:3:17::3/64
ipv6 enable
no shut

interface GigabitEthernet0/1
description BGP com router2_65002
ipv6 address 2001:db8:2:17::3/64
ipv6 enable
no shut

interface GigabitEthernet0/2
description LAN
ipv6 address 2001:db8:3:10::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:3:10::/64 1800 1800
ipv6 nd prefix default
no shut

router bgp 65003
bgp router-id 1.1.1.3
no bgp default ipv4-unicast
neighbor 2001:db8:2:17::2 remote-as 65002
neighbor 2001:db8:3:17::4 remote-as 65004
neighbor 2001:db8:3:10::100 remote-as 64320
!
address-family ipv6
network 2001:db8:3::/48
neighbor 2001:db8:2:17::2 activate
neighbor 2001:db8:3:17::4 activate
neighbor 2001:db8:3:10::100 activate
exit-address-family
!
end
wr


Router 4


Vamos configurar o router4.

enable 
conf t
!
hostname router4_65004
!
ipv6 unicast-routing
!
! Vamos anunciar o /48 que nao esta em nenhuma interface:
ipv6 route 2001:db8:4::/48 Null0
!
interface Loopback0
ipv6 address 2001:db8:4:1::4/128

interface GigabitEthernet0/0
description BGP com router5_65005
ipv6 address 2001:db8:4:17::4/64
ipv6 enable
no shut

interface GigabitEthernet0/1
description BGP com router3_65003
ipv6 address 2001:db8:3:17::4/64
ipv6 enable
no shut

interface GigabitEthernet0/2
description LAN
ipv6 address 2001:db8:4:10::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:4:10::/64 1800 1800
ipv6 nd prefix default
no shut

router bgp 65004
bgp router-id 1.1.1.4
no bgp default ipv4-unicast
neighbor 2001:db8:3:17::3 remote-as 65003
neighbor 2001:db8:4:17::5 remote-as 65005
neighbor 2001:db8:4:10::100 remote-as 64320
!
address-family ipv6
network 2001:db8:4::/48
neighbor 2001:db8:3:17::3 activate
neighbor 2001:db8:4:17::5 activate
neighbor 2001:db8:4:10::100 activate
exit-address-family
!
end
wr


Router 5


Vamos configurar o router5.

enable 
conf t
!
hostname router5_65005
!
ipv6 unicast-routing
!
! Vamos anunciar o /48 que nao esta em nenhuma interface:
ipv6 route 2001:db8:5::/48 Null0
!
interface Loopback0
ipv6 address 2001:db8:5:1::5/128

interface GigabitEthernet0/0
description BGP com router1_65001
ipv6 address 2001:db8:1:18::5/64
ipv6 enable
no shut

interface GigabitEthernet0/1
description BGP com router4_65004
ipv6 address 2001:db8:4:17::5/64
ipv6 enable
no shut

interface GigabitEthernet0/2
description LAN
ipv6 address 2001:db8:5:10::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:5:10::/64 1800 1800
ipv6 nd prefix default
no shut

router bgp 65005
bgp router-id 1.1.1.5
no bgp default ipv4-unicast
neighbor 2001:db8:1:18::1 remote-as 65001
neighbor 2001:db8:4:17::4 remote-as 65004
neighbor 2001:db8:5:10::100 remote-as 64320
!
address-family ipv6
network 2001:db8:5::/48
neighbor 2001:db8:1:18::1 activate
neighbor 2001:db8:4:17::4 activate
neighbor 2001:db8:5:10::100 activate
exit-address-family
!
end
wr


Verificando status do BGP


Nesse momento podemos ver as sessões BGP em cada Router. A sessão com nosso AS 64320 está como idle porque ainda não configuramos ele.

##################
### No Router1 ###
##################

router1_65001#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.1, local AS number 65001
BGP table version is 6, main routing table version 6
5 network entries using 840 bytes of memory
6 path entries using 648 bytes of memory
6/5 BGP path/bestpath attribute entries using 960 bytes of memory
5 BGP AS-PATH entries using 120 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2568 total bytes of memory
BGP activity 5/0 prefixes, 6/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:DB8:1:10::100
4 64320 0 0 1 0 0 never Active
2001:DB8:1:17::2
4 65002 29 29 6 0 0 00:21:51 2
2001:DB8:1:18::5
4 65005 28 28 6 0 0 00:20:53 3



router1_65001#show bgp ipv6 unicast
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:1::/48 :: 0 32768 i
*> 2001:DB8:2::/48 2001:DB8:1:17::2
0 0 65002 i
* 2001:DB8:3::/48 2001:DB8:1:18::5
0 65005 65004 65003 i
*> 2001:DB8:1:17::2
0 65002 65003 i
* 2001:DB8:4::/48 2001:DB8:1:17::2
0 65002 65003 65004 i
*> 2001:DB8:1:18::5
0 65005 65004 i
*> 2001:DB8:5::/48 2001:DB8:1:18::5
Network Next Hop Metric LocPrf Weight Path
0 0 65005 i



router1_65001#show ipv6 route bgp
IPv6 Routing Table - default - 13 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
B 2001:DB8:2::/48 [20/0]
via FE80::5200:FF:FE02:1, GigabitEthernet0/1
B 2001:DB8:3::/48 [20/0]
via FE80::5200:FF:FE02:1, GigabitEthernet0/1
B 2001:DB8:4::/48 [20/0]
via FE80::5200:FF:FE05:0, GigabitEthernet0/0
B 2001:DB8:5::/48 [20/0]
via FE80::5200:FF:FE05:0, GigabitEthernet0/0



##################
### No Router2 ###
##################

router2_65002#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.2, local AS number 65002
BGP table version is 7, main routing table version 7
5 network entries using 840 bytes of memory
7 path entries using 756 bytes of memory
7/5 BGP path/bestpath attribute entries using 1120 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2860 total bytes of memory
BGP activity 5/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:DB8:1:17::1
4 65001 32 33 7 0 0 00:25:00 3
2001:DB8:2:10::100
4 64320 0 0 1 0 0 never Idle
2001:DB8:2:17::3
4 65003 31 33 7 0 0 00:24:39 3



router2_65002#show bgp ipv6 unicast
BGP table version is 7, local router ID is 1.1.1.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:1::/48 2001:DB8:1:17::1
0 0 65001 i
*> 2001:DB8:2::/48 :: 0 32768 i
*> 2001:DB8:3::/48 2001:DB8:2:17::3
0 0 65003 i
*> 2001:DB8:4::/48 2001:DB8:2:17::3
0 65003 65004 i
* 2001:DB8:1:17::1
0 65001 65005 65004 i
* 2001:DB8:5::/48 2001:DB8:2:17::3
0 65003 65004 65005 i
Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:1:17::1
0 65001 65005 i



router2_65002#show ipv6 route bgp
IPv6 Routing Table - default - 13 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
B 2001:DB8:1::/48 [20/0]
via FE80::5200:FF:FE01:1, GigabitEthernet0/1
B 2001:DB8:3::/48 [20/0]
via FE80::5200:FF:FE04:1, GigabitEthernet0/0
B 2001:DB8:4::/48 [20/0]
via FE80::5200:FF:FE04:1, GigabitEthernet0/0
B 2001:DB8:5::/48 [20/0]
via FE80::5200:FF:FE01:1, GigabitEthernet0/1



##################
### No Router3 ###
##################

router3_65003#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.3, local AS number 65003
BGP table version is 6, main routing table version 6
5 network entries using 840 bytes of memory
7 path entries using 756 bytes of memory
7/5 BGP path/bestpath attribute entries using 1120 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2860 total bytes of memory
BGP activity 5/0 prefixes, 8/1 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:DB8:2:17::2
4 65002 34 33 6 0 0 00:25:45 3
2001:DB8:3:10::100
4 64320 0 0 1 0 0 never Idle
2001:DB8:3:17::4
4 65004 33 33 6 0 0 00:25:24 3



router3_65003#show bgp ipv6 unicast
BGP table version is 6, local router ID is 1.1.1.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
* 2001:DB8:1::/48 2001:DB8:3:17::4
0 65004 65005 65001 i
*> 2001:DB8:2:17::2
0 65002 65001 i
*> 2001:DB8:2::/48 2001:DB8:2:17::2
0 0 65002 i
*> 2001:DB8:3::/48 :: 0 32768 i
*> 2001:DB8:4::/48 2001:DB8:3:17::4
0 0 65004 i
* 2001:DB8:5::/48 2001:DB8:2:17::2
0 65002 65001 65005 i
Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:3:17::4
0 65004 65005 i



router3_65003#show ipv6 route bgp
IPv6 Routing Table - default - 13 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
B 2001:DB8:1::/48 [20/0]
via FE80::5200:FF:FE02:0, GigabitEthernet0/1
B 2001:DB8:2::/48 [20/0]
via FE80::5200:FF:FE02:0, GigabitEthernet0/1
B 2001:DB8:4::/48 [20/0]
via FE80::5200:FF:FE06:1, GigabitEthernet0/0
B 2001:DB8:5::/48 [20/0]
via FE80::5200:FF:FE06:1, GigabitEthernet0/0



##################
### No Router4 ###
##################

router4_65004#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.4, local AS number 65004
BGP table version is 6, main routing table version 6
5 network entries using 840 bytes of memory
7 path entries using 756 bytes of memory
7/5 BGP path/bestpath attribute entries using 1120 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2860 total bytes of memory
BGP activity 5/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:DB8:3:17::3
4 65003 34 34 6 0 0 00:26:34 3
2001:DB8:4:10::100
4 64320 0 0 1 0 0 never Active
2001:DB8:4:17::5
4 65005 34 34 6 0 0 00:26:15 3



router4_65004#show bgp ipv6 unicast
BGP table version is 6, local router ID is 1.1.1.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
* 2001:DB8:1::/48 2001:DB8:3:17::3
0 65003 65002 65001 i
*> 2001:DB8:4:17::5
0 65005 65001 i
* 2001:DB8:2::/48 2001:DB8:4:17::5
0 65005 65001 65002 i
*> 2001:DB8:3:17::3
0 65003 65002 i
*> 2001:DB8:3::/48 2001:DB8:3:17::3
0 0 65003 i
*> 2001:DB8:4::/48 :: 0 32768 i
*> 2001:DB8:5::/48 2001:DB8:4:17::5
0 0 65005 i



router4_65004#show ipv6 route bgp
IPv6 Routing Table - default - 13 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
B 2001:DB8:1::/48 [20/0]
via FE80::5200:FF:FE05:1, GigabitEthernet0/0
B 2001:DB8:2::/48 [20/0]
via FE80::5200:FF:FE04:0, GigabitEthernet0/1
B 2001:DB8:3::/48 [20/0]
via FE80::5200:FF:FE04:0, GigabitEthernet0/1
B 2001:DB8:5::/48 [20/0]
via FE80::5200:FF:FE05:1, GigabitEthernet0/0



##################
### No Router5 ###
##################

router5_65005#show bgp ipv6 unicast summary
BGP router identifier 1.1.1.5, local AS number 65005
BGP table version is 6, main routing table version 6
5 network entries using 840 bytes of memory
7 path entries using 756 bytes of memory
7/5 BGP path/bestpath attribute entries using 1120 bytes of memory
6 BGP AS-PATH entries using 144 bytes of memory
0 BGP route-map cache entries using 0 bytes of memory
0 BGP filter-list cache entries using 0 bytes of memory
BGP using 2860 total bytes of memory
BGP activity 5/0 prefixes, 7/0 paths, scan interval 60 secs

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
2001:DB8:1:18::1
4 65001 37 37 6 0 0 00:29:36 3
2001:DB8:4:17::4
4 65004 38 37 6 0 0 00:29:35 3
2001:DB8:5:10::100
4 64320 0 0 1 0 0 never Idle



router5_65005#show bgp ipv6 unicast
BGP table version is 6, local router ID is 1.1.1.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
x best-external, a additional-path, c RIB-compressed,
t secondary path,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:1::/48 2001:DB8:1:18::1
0 0 65001 i
* 2001:DB8:2::/48 2001:DB8:4:17::4
0 65004 65003 65002 i
*> 2001:DB8:1:18::1
0 65001 65002 i
* 2001:DB8:3::/48 2001:DB8:1:18::1
0 65001 65002 65003 i
*> 2001:DB8:4:17::4
0 65004 65003 i
*> 2001:DB8:4::/48 2001:DB8:4:17::4
0 0 65004 i
*> 2001:DB8:5::/48 :: 0 32768 i



router5_65005#show ipv6 route bgp
IPv6 Routing Table - default - 13 entries
Codes: C - Connected, L - Local, S - Static, U - Per-user Static route
B - BGP, HA - Home Agent, MR - Mobile Router, R - RIP
H - NHRP, I1 - ISIS L1, I2 - ISIS L2, IA - ISIS interarea
IS - ISIS summary, D - EIGRP, EX - EIGRP external, NM - NEMO
ND - ND Default, NDp - ND Prefix, DCE - Destination, NDr - Redirect
RL - RPL, O - OSPF Intra, OI - OSPF Inter, OE1 - OSPF ext 1
OE2 - OSPF ext 2, ON1 - OSPF NSSA ext 1, ON2 - OSPF NSSA ext 2
la - LISP alt, lr - LISP site-registrations, ld - LISP dyn-eid
lA - LISP away, a - Application
B 2001:DB8:1::/48 [20/0]
via FE80::5200:FF:FE01:0, GigabitEthernet0/0
B 2001:DB8:2::/48 [20/0]
via FE80::5200:FF:FE01:0, GigabitEthernet0/0
B 2001:DB8:3::/48 [20/0]
via FE80::5200:FF:FE06:0, GigabitEthernet0/1
B 2001:DB8:4::/48 [20/0]
via FE80::5200:FF:FE06:0, GigabitEthernet0/1


Configurando nosso AS 64320


Agora vamos configurar nosso roteador que está dentro das redes dos provedores.

###################################
### Roteador na rede do Router1 ###
###################################
enable
!
terminal length 0
!
conf t
!
hostname router1_anycast_64320
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
description servidor anycast
ipv6 address 2001:db8:ffff::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:ffff::/64 1800 1800
ipv6 nd prefix default
no shut
!
interface GigabitEthernet0/1
description Rede do ISP
ipv6 address 2001:db8:1:10::100/64
ipv6 enable
no shut
!
router bgp 64320
bgp router-id 100.100.100.100
no bgp default ipv4-unicast
neighbor 2001:db8:1:10::1 remote-as 65001
!
address-family ipv6
network 2001:db8:ffff::/64
neighbor 2001:db8:1:10::1 activate
exit-address-family
!
end
wr



###################################
### Roteador na rede do Router2 ###
###################################
enable
!
terminal length 0
!
conf t
!
hostname router2_anycast_64320
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
description servidor anycast
ipv6 address 2001:db8:ffff::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:ffff::/64 1800 1800
ipv6 nd prefix default
no shut
!
interface GigabitEthernet0/1
description Rede do ISP
ipv6 address 2001:db8:2:10::100/64
ipv6 enable
no shut
!
router bgp 64320
bgp router-id 100.100.100.100
no bgp default ipv4-unicast
neighbor 2001:db8:2:10::1 remote-as 65002
!
address-family ipv6
network 2001:db8:ffff::/64
neighbor 2001:db8:2:10::1 activate
exit-address-family
!
end
wr



###################################
### Roteador na rede do Router4 ###
###################################
enable
!
terminal length 0
!
conf t
!
hostname router4_anycast_64320
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
description servidor anycast
ipv6 address 2001:db8:ffff::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:ffff::/64 1800 1800
ipv6 nd prefix default
no shut
!
interface GigabitEthernet0/1
description Rede do ISP
ipv6 address 2001:db8:4:10::100/64
ipv6 enable
no shut
!
router bgp 64320
bgp router-id 100.100.100.100
no bgp default ipv4-unicast
neighbor 2001:db8:4:10::1 remote-as 65004
!
address-family ipv6
network 2001:db8:ffff::/64
neighbor 2001:db8:4:10::1 activate
exit-address-family
!
end
wr



###################################
### Roteador na rede do Router5 ###
###################################
enable
!
terminal length 0
!
conf t
!
hostname router5_anycast_64320
!
ipv6 unicast-routing
!
interface GigabitEthernet0/0
description servidor anycast
ipv6 address 2001:db8:ffff::1/64
ipv6 enable
ipv6 nd ra interval 30
ipv6 nd prefix 2001:db8:ffff::/64 1800 1800
ipv6 nd prefix default
no shut
!
interface GigabitEthernet0/1
description Rede do ISP
ipv6 address 2001:db8:5:10::100/64
ipv6 enable
no shut
!
router bgp 64320
bgp router-id 100.100.100.100
no bgp default ipv4-unicast
neighbor 2001:db8:5:10::1 remote-as 65005
!
address-family ipv6
network 2001:db8:ffff::/64
neighbor 2001:db8:5:10::1 activate
exit-address-family
!
end
wr


Verificando o prefixo do anycast


Vamos ver o anuncio da rede do anycast em todos os routers:

##################
### No Router1 ###
##################

router1_65001#show bgp ipv6 unicast 2001:db8:ffff::/64 longer-prefixes | begin Network
Network Next Hop Metric LocPrf Weight Path
* 2001:DB8:FFFF::/64
2001:DB8:1:17::2
0 65002 64320 i
* 2001:DB8:1:18::5
0 65005 64320 i
*> 2001:DB8:1:10::100
0 0 64320 i



##################
### No Router2 ###
##################

router2_65002#show bgp ipv6 unicast 2001:db8:ffff::/64 longer-prefixes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:FFFF::/64
2001:DB8:2:10::100
0 0 64320 i
* 2001:DB8:2:17::3
0 65003 65004 64320 i
* 2001:DB8:1:17::1
0 65001 64320 i




##################
### No Router3 ###
##################

router3_65003#show bgp ipv6 unicast 2001:db8:ffff::/64 longer-prefixes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:FFFF::/64
2001:DB8:3:17::4
0 65004 64320 i
* 2001:DB8:2:17::2
0 65002 64320 i



##################
### No Router4 ###
##################

router4_65004#show bgp ipv6 unicast 2001:db8:ffff::/64 longer-prefixes | begin Network
Network Next Hop Metric LocPrf Weight Path
*> 2001:DB8:FFFF::/64
2001:DB8:4:10::100
0 0 64320 i
* 2001:DB8:4:17::5
0 65005 64320 i



##################
### No Router5 ###
##################

router5_65005#show bgp ipv6 unicast 2001:db8:ffff::/64 longer-prefixes | begin Network
Network Next Hop Metric LocPrf Weight Path
* 2001:DB8:FFFF::/64
2001:DB8:4:17::4
0 65004 64320 i
*> 2001:DB8:5:10::100
0 0 64320 i
* 2001:DB8:1:18::1
0 65001 64320 i


Configurando o servidor Ubuntu


Todos os servidores Ubuntu localizados no ASN 64320 devem ser configurados com a seguinte configuração de rede, utilizando Netplan (porque é um Ubuntu):

cat << 'EOF' > /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eth0:
addresses:
- 2001:db8:ffff::100/128
routes:
- to: ::/0
via: 2001:db8:ffff::1
on-link: true
scope: link
accept-ra: no
EOF

netplan apply

Essa configuração atribui ao servidor o IP 2001:db8:ffff::100/128 e define uma rota default via o gateway 2001:db8:ffff::1, que é o roteador local no ASN 64320. O parâmetro on-link: true é essencial para permitir o uso de um endereço de gateway que pertence à mesma sub-rede sem depender de descoberta de vizinhança. Além disso, accept-ra: no desabilita o recebimento de anúncios de rota via RA, garantindo controle total da configuração estática.


Podemos realizar um teste com mtr a partir de um cliente localizado atrás do roteador3_65003, com destino ao IP anycast do servidor:


ipv4_mapeado

A imagem acima mostra o caminho percorrido até o servidor anycast, confirmando que a topologia está roteando corretamente os pacotes para o ASN mais próximo.