BGP IPv6 Unnumbered with Extended Nexthop

BGP IPv6 unnumbered позволяет использовать IPv6 link-local адреса для BGP peering, упрощая конфигурацию datacenter fabric и spine-leaf топологий. Extended nexthop capability позволяет анонсировать IPv4 маршруты через IPv6 next-hop.

Сценарий использования

Применимость

  • Datacenter Fabric: Spine-leaf архитектура с минимальной конфигурацией
  • Cloud Datacenter: Yandex Cloud / VK Cloud multi-AZ networking
  • Campus Networks: L3 underlay для крупных сетей
  • Service Provider: Carrier-grade backbone с упрощенной адресацией

Преимущества

  1. Простота конфигурации: Не требуется назначение IP адресов на каждый линк
  2. Масштабируемость: Нет необходимости в IP address planning для point-to-point линков
  3. Dual-Stack: Одновременная поддержка IPv4 и IPv6 маршрутов через IPv6 peering
  4. ECMP: Автоматический Equal-Cost Multipath между multiple links
  5. Гибкость: Легкое добавление новых линков без реадресации

Топология сети

Базовая топология (2 роутера)

                    ┌─────────────────┐
                    │   Router A      │
                    │   AS 64496      │
                    │   RID: 192.168.0.1
                    │                 │
                    │ lo: 192.168.0.1 │
                    │ eth1: link-local│
                    │ eth2: link-local│
                    └────┬───────┬────┘
                         │       │
                    eth1 │       │ eth2
                         │       │
                    eth1 │       │ eth2
                    ┌────┴───────┴────┐
                    │   Router B      │
                    │   AS 64499      │
                    │   RID: 192.168.0.2
                    │                 │
                    │ lo: 192.168.0.2 │
                    │ eth1: link-local│
                    │ eth2: link-local│
                    └─────────────────┘

Datacenter Spine-Leaf

     ┌─────────┐           ┌─────────┐
     │ Spine 1 │           │ Spine 2 │
     │ AS 65000│           │ AS 65000│
     └───┬─┬─┬─┘           └─┬─┬─┬───┘
         │ │ │               │ │ │
    ┌────┘ │ └────┐     ┌────┘ │ └────┐
    │      │      │     │      │      │
 ┌──┴──┐ ┌─┴───┐ ┌┴────┐│ ┌───┴─┐ ┌──┴──┐
 │Leaf1│ │Leaf2│ │Leaf3│  │Leaf4│ │Leaf5│
 │AS   │ │AS   │ │AS   │  │AS   │ │AS   │
 │65001│ │65002│ │65003│  │65004│ │65005│
 └─────┘ └─────┘ └─────┘  └─────┘ └─────┘

Требования

Минимальные требования

  • VyOS 1.4 (Sagitta) или новее
  • Поддержка IPv6 на всех интерфейсах
  • BGP capability extended-nexthop
  • Loopback интерфейсы для Router ID

Сетевые параметры (пример)

ПараметрRouter ARouter B
AS Number6449664499
Router ID192.168.0.1192.168.0.2
Loopback192.168.0.1/32192.168.0.2/32
eth1link-local onlylink-local only
eth2link-local onlylink-local only

Конфигурация Router A

Интерфейсы

configure

# Loopback для Router ID и анонса
set interfaces loopback lo address '192.168.0.1/32'
set interfaces loopback lo description 'Router ID + BGP announce'

# eth1 - IPv6 link-local only (auto-generated)
set interfaces ethernet eth1 description 'BGP peer to Router B eth1'
set interfaces ethernet eth1 ipv6 address autoconf

# eth2 - IPv6 link-local only (auto-generated)
set interfaces ethernet eth2 description 'BGP peer to Router B eth2'
set interfaces ethernet eth2 ipv6 address autoconf

commit

BGP Configuration

configure

# Базовые параметры BGP
set protocols bgp system-as '64496'
set protocols bgp parameters router-id '192.168.0.1'
set protocols bgp parameters default no-ipv4-unicast
set protocols bgp parameters bestpath as-path multipath-relax
set protocols bgp parameters bestpath compare-routerid

# Peer Group для fabric
set protocols bgp peer-group fabric remote-as 'external'
set protocols bgp peer-group fabric capability extended-nexthop
set protocols bgp peer-group fabric address-family ipv4-unicast
set protocols bgp peer-group fabric address-family ipv6-unicast

# Neighbors на интерфейсах (v6only = use IPv6 link-local)
set protocols bgp neighbor eth1 interface v6only peer-group 'fabric'
set protocols bgp neighbor eth2 interface v6only peer-group 'fabric'

# Announce connected networks
set protocols bgp address-family ipv4-unicast redistribute connected
set protocols bgp address-family ipv6-unicast redistribute connected

commit
save

Объяснение ключевых параметров

  • interface v6only: Использовать IPv6 link-local адрес интерфейса для BGP peering
  • capability extended-nexthop: Позволяет анонсировать IPv4 маршруты с IPv6 next-hop
  • no-ipv4-unicast: По умолчанию не активировать IPv4 AFI (активируется в peer-group)
  • multipath-relax: Разрешает ECMP между путями с разными AS-PATH length
  • compare-routerid: Используется Router ID для выбора best path при равных метриках

Конфигурация Router B

configure

# Loopback
set interfaces loopback lo address '192.168.0.2/32'
set interfaces loopback lo description 'Router ID + BGP announce'

# Интерфейсы
set interfaces ethernet eth1 description 'BGP peer to Router A eth1'
set interfaces ethernet eth1 ipv6 address autoconf

set interfaces ethernet eth2 description 'BGP peer to Router A eth2'
set interfaces ethernet eth2 ipv6 address autoconf

# BGP
set protocols bgp system-as '64499'
set protocols bgp parameters router-id '192.168.0.2'
set protocols bgp parameters default no-ipv4-unicast
set protocols bgp parameters bestpath as-path multipath-relax
set protocols bgp parameters bestpath compare-routerid

# Peer Group
set protocols bgp peer-group fabric remote-as 'external'
set protocols bgp peer-group fabric capability extended-nexthop
set protocols bgp peer-group fabric address-family ipv4-unicast
set protocols bgp peer-group fabric address-family ipv6-unicast

# Neighbors
set protocols bgp neighbor eth1 interface v6only peer-group 'fabric'
set protocols bgp neighbor eth2 interface v6only peer-group 'fabric'

# Redistribute
set protocols bgp address-family ipv4-unicast redistribute connected
set protocols bgp address-family ipv6-unicast redistribute connected

commit
save

Интеграция с Yandex Cloud

Сценарий: Multi-AZ datacenter в Yandex Cloud

┌─────────────────────────────────────────────┐
│         Yandex Cloud VPC                    │
│                                             │
│  ┌──────────────┐       ┌──────────────┐   │
│  │  Zone A      │       │  Zone B      │   │
│  │              │       │              │   │
│  │ ┌─────────┐  │       │ ┌─────────┐  │   │
│  │ │ Spine-A │  │       │ │ Spine-B │  │   │
│  │ │ VyOS    │◄─┼───────┼─┤ VyOS    │  │   │
│  │ └────┬────┘  │       │ └────┬────┘  │   │
│  │      │       │       │      │       │   │
│  │  ┌───┴───┐   │       │  ┌───┴───┐   │   │
│  │  │ Leaf  │   │       │  │ Leaf  │   │   │
│  │  │ VMs   │   │       │  │ VMs   │   │   │
│  │  └───────┘   │       │  └───────┘   │   │
│  └──────────────┘       └──────────────┘   │
└─────────────────────────────────────────────┘

Конфигурация Spine (Yandex Cloud)

configure

# Интерфейсы (eth0 = management)
set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 description 'Yandex Cloud VPC network'

# Loopback
set interfaces loopback lo address '10.255.0.1/32'

# eth1-eth5: link-local для BGP peers к Leaf роутерам
set interfaces ethernet eth1 ipv6 address autoconf
set interfaces ethernet eth2 ipv6 address autoconf
set interfaces ethernet eth3 ipv6 address autoconf
set interfaces ethernet eth4 ipv6 address autoconf
set interfaces ethernet eth5 ipv6 address autoconf

# BGP - Spine AS
set protocols bgp system-as '65000'
set protocols bgp parameters router-id '10.255.0.1'
set protocols bgp parameters default no-ipv4-unicast
set protocols bgp parameters bestpath as-path multipath-relax

# Peer Group для Leaf роутеров
set protocols bgp peer-group leafs remote-as 'external'
set protocols bgp peer-group leafs capability extended-nexthop
set protocols bgp peer-group leafs address-family ipv4-unicast
set protocols bgp peer-group leafs address-family ipv6-unicast

# Neighbors (Leaf 1-5)
set protocols bgp neighbor eth1 interface v6only peer-group 'leafs'
set protocols bgp neighbor eth2 interface v6only peer-group 'leafs'
set protocols bgp neighbor eth3 interface v6only peer-group 'leafs'
set protocols bgp neighbor eth4 interface v6only peer-group 'leafs'
set protocols bgp neighbor eth5 interface v6only peer-group 'leafs'

# Announce Loopback
set protocols bgp address-family ipv4-unicast network '10.255.0.1/32'

commit
save

Конфигурация Leaf (Yandex Cloud)

configure

# Loopback
set interfaces loopback lo address '10.255.1.1/32'

# eth1-2: link-local к Spine роутерам (ECMP)
set interfaces ethernet eth1 ipv6 address autoconf
set interfaces ethernet eth2 ipv6 address autoconf

# BGP - Leaf AS (unique per leaf)
set protocols bgp system-as '65001'
set protocols bgp parameters router-id '10.255.1.1'
set protocols bgp parameters default no-ipv4-unicast
set protocols bgp parameters bestpath as-path multipath-relax
set protocols bgp parameters bestpath compare-routerid

# Peer Group для Spines
set protocols bgp peer-group spines remote-as 'external'
set protocols bgp peer-group spines capability extended-nexthop
set protocols bgp peer-group spines address-family ipv4-unicast
set protocols bgp peer-group spines address-family ipv6-unicast

# Neighbors
set protocols bgp neighbor eth1 interface v6only peer-group 'spines'
set protocols bgp neighbor eth2 interface v6only peer-group 'spines'

# Announce Loopback + connected networks
set protocols bgp address-family ipv4-unicast redistribute connected

commit
save

Мониторинг через Yandex Monitoring

# CPU / Memory
yc monitoring metric-list --folder-id <folder-id>

# BGP sessions (custom metrics)
show ip bgp summary | grep -c Established > /tmp/bgp_sessions_up.txt

Интеграция с VK Cloud

Конфигурация с учетом VK Cloud Networking

configure

# VK Cloud использует OpenStack Neutron
# eth0 = управление (VK Cloud VPC)
set interfaces ethernet eth0 address dhcp
set interfaces ethernet eth0 description 'VK Cloud management'

# Floating IP для внешнего доступа (назначается в VK Cloud Console)
# Внутренние интерфейсы eth1-X для BGP fabric

# Остальная конфигурация аналогична Yandex Cloud примеру

commit
save

Особенности VK Cloud

  1. Security Groups: Разрешить BGP (TCP 179) и ICMPv6 между VM
  2. Floating IP: Используется только для management, не для BGP peering
  3. MTU: По умолчанию 1500, для overlay может потребоваться 1450

Проверка конфигурации

Проверка интерфейсов

# Link-local адреса (автоматически генерируются)
show interfaces ethernet eth1
show interfaces ethernet eth2

# Должны быть IPv6 link-local адреса (fe80::/10)
# Пример: fe80::5054:ff:fe12:3456/64

Проверка BGP сессий

# BGP summary
show ip bgp summary

# Ожидаемый вывод:
# IPv4 Unicast Summary (VRF default):
# BGP router identifier 192.168.0.1, local AS number 64496
# RIB entries 3, using 576 bytes of memory
# Peers 2, using 1433 KiB of memory
# Peer groups 1, using 64 bytes of memory
#
# Neighbor        V         AS   MsgRcvd   MsgSent   TblVer  InQ OutQ  Up/Down State/PfxRcd   PfxSnt Desc
# eth1            4      64499        45        46        0    0    0 00:20:15            1        2 N/A
# eth2            4      64499        43        44        0    0    0 00:20:10            1        2 N/A

# Детали BGP neighbor
show ip bgp neighbors eth1

# Проверка extended-nexthop capability
show ip bgp neighbors eth1 | grep "Extended nexthop"
# Должно быть: Extended nexthop: advertised and received

Проверка IPv4 маршрутов через IPv6 nexthop

# Routing table
show ip route bgp

# Пример вывода:
# B>* 192.168.0.2/32 [20/0] via fe80::5054:ff:fe12:5678, eth1, weight 1, 00:15:20
#                            via fe80::5054:ff:fe12:9abc, eth2, weight 1, 00:15:15

# Обратите внимание: IPv4 маршрут с IPv6 link-local next-hop (extended nexthop)

Проверка IPv6 маршрутов

show ipv6 route bgp

# Пример:
# B>* ::/0 [20/0] via fe80::5054:ff:fe12:5678, eth1, weight 1, 00:20:00

Тест связности

# Ping до loopback соседа
ping 192.168.0.2 count 4

# Traceroute
traceroute 192.168.0.2

# MTU Path Discovery
ping 192.168.0.2 size 1400 do-not-fragment

Детальная отладка

# BGP updates
show ip bgp neighbors eth1 advertised-routes
show ip bgp neighbors eth1 received-routes

# BGP attributes
show ip bgp 192.168.0.2/32

# FRR vtysh для глубокой отладки
vtysh
show bgp ipv4 unicast summary
show bgp ipv6 unicast summary
show bgp neighbors eth1 capabilities
exit

Troubleshooting

Проблема 1: BGP сессии не устанавливаются

Симптомы:

show ip bgp summary
# State/PfxRcd = "Active" или "Connect"

Причины и решения:

  1. Нет IPv6 link-local адреса:

    # Проверка
    show interfaces ethernet eth1 | grep inet6
    
    # Решение: включить autoconf
    set interfaces ethernet eth1 ipv6 address autoconf
    commit
  2. Firewall блокирует BGP:

    # Проверить firewall
    show firewall
    
    # Разрешить BGP
    set firewall ipv6-name WAN_LOCAL rule 100 action 'accept'
    set firewall ipv6-name WAN_LOCAL rule 100 protocol 'tcp'
    set firewall ipv6-name WAN_LOCAL rule 100 destination port '179'
    set firewall ipv6-name WAN_LOCAL rule 100 source port '179'
    commit
  3. Неправильный AS number:

    # Проверить конфигурацию
    show configuration commands | grep "bgp system-as"
    show configuration commands | grep "remote-as"

Проблема 2: Extended nexthop не работает

Симптомы: IPv4 маршруты не принимаются через IPv6 BGP сессию

Решение:

# Проверить capability
show ip bgp neighbors eth1 | grep "Extended nexthop"

# Если нет "advertised and received":
configure
set protocols bgp peer-group fabric capability extended-nexthop
commit

Проблема 3: ECMP не работает

Симптомы:

show ip route 192.168.0.2/32
# Показывает только один путь, хотя должно быть два

Решение:

configure
set protocols bgp parameters bestpath as-path multipath-relax
set protocols bgp parameters bestpath compare-routerid
commit

# Проверка FRR maximum-paths
vtysh
conf t
router bgp 64496
address-family ipv4 unicast
maximum-paths 64
exit
exit
exit

Проблема 4: Медленная конвергенция

Решение: Уменьшить BGP timers

configure
set protocols bgp peer-group fabric timers keepalive '3'
set protocols bgp peer-group fabric timers holdtime '9'
commit

Проблема 5: MTU issues

Симптомы: Connectivity есть, но большие пакеты не проходят

Решение:

# Проверить MTU
show interfaces ethernet eth1

# Установить MTU (если нужен меньший)
set interfaces ethernet eth1 mtu '1500'
set interfaces ethernet eth2 mtu '1500'
commit

# Path MTU Discovery test
ping 192.168.0.2 size 1400 do-not-fragment
ping 192.168.0.2 size 1450 do-not-fragment
ping 192.168.0.2 size 1500 do-not-fragment

Best Practices

1. Router ID Planning

  • Используйте RFC1918 адреса для Router ID (10.x.x.x или 192.168.x.x)
  • Назначайте loopback адреса из единого /16 блока для всей fabric
  • Router ID должен быть уникален для всех BGP роутеров

2. AS Number Design

Spine-Leaf:

  • Spine: одинаковый AS для всех spine (например, 65000)
  • Leaf: уникальный AS для каждого leaf (65001, 65002, 65003…)

Преимущества:

  • Автоматическая loop prevention (AS-PATH)
  • Простота конфигурации (remote-as external)

3. Timers

Production:

set protocols bgp peer-group fabric timers keepalive '3'
set protocols bgp peer-group fabric timers holdtime '9'

Обеспечивает быстрое обнаружение отказов (~9 секунд).

4. Security

# TTL security (рекомендуется для eBGP)
set protocols bgp peer-group fabric ebgp-multihop '2'
set protocols bgp peer-group fabric ttl-security hops '1'

Объяснение:

  • ttl-security hops 1: Принимать только пакеты с TTL=255 (direct connected)
  • Защита от BGP hijacking с удаленных хостов

5. Prefix Limits

# Ограничить количество принимаемых prefixes
set protocols bgp neighbor eth1 address-family ipv4-unicast maximum-prefix '1000'
set protocols bgp neighbor eth1 address-family ipv6-unicast maximum-prefix '500'

6. Graceful Restart

# Для maintenance без полной потери связности
set protocols bgp parameters graceful-restart stalepath-time '300'

7. BFD для быстрого failover

# Включить BFD на интерфейсах
set interfaces ethernet eth1 ip enable-bfd
set interfaces ethernet eth2 ip enable-bfd

# BFD для BGP neighbors
set protocols bgp neighbor eth1 bfd
set protocols bgp neighbor eth2 bfd

# BFD параметры
set protocols bfd peer fe80::5054:ff:fe12:5678 multihop local-address 'fe80::5054:ff:fe12:1234'
set protocols bfd peer fe80::5054:ff:fe12:5678 interval transmit '300'
set protocols bfd peer fe80::5054:ff:fe12:5678 interval receive '300'
set protocols bfd peer fe80::5054:ff:fe12:5678 interval multiplier '3'

Преимущество: Sub-second failover (300ms * 3 = 900ms)

8. Logging и мониторинг

# BGP logging
set system syslog global facility protocols level 'info'

# Логировать BGP neighbor changes
vtysh
conf t
log syslog informational
log record-priority
router bgp 64496
bgp log-neighbor-changes
exit
exit
exit

# Мониторинг
watch show ip bgp summary

Advanced Configuration

Route Reflectors для больших fabric

Для fabric > 50 роутеров:

# Route Reflector (Spine)
configure
set protocols bgp neighbor eth1 address-family ipv4-unicast route-reflector-client
set protocols bgp neighbor eth1 address-family ipv6-unicast route-reflector-client
# Повторить для всех leaf neighbors
commit

iBGP между Spines

# Spine-to-Spine iBGP (для redundancy)
set protocols bgp neighbor 10.255.0.2 remote-as '65000'
set protocols bgp neighbor 10.255.0.2 update-source 'lo'
set protocols bgp neighbor 10.255.0.2 address-family ipv4-unicast
set protocols bgp neighbor 10.255.0.2 address-family ipv4-unicast next-hop-self
commit

Anycast Gateway

# Одинаковый loopback IP на всех Leaf (для Anycast GW)
set interfaces loopback lo address '10.255.255.1/32'

# Announce через BGP
set protocols bgp address-family ipv4-unicast network '10.255.255.1/32'
commit

Ссылки