MPLS - Multiprotocol Label Switching

MPLS (Multiprotocol Label Switching) - технология коммутации пакетов на основе меток (labels), обеспечивающая высокую производительность, traffic engineering и VPN сервисы.

Обзор

MPLS - это парадигма пересылки пакетов, использующая короткие метки (32-bit) вместо длинных IP адресов для принятия решений о маршрутизации.

Что такое MPLS

Основные концепции:

  • Label Switching - коммутация на основе меток вместо IP lookup
  • LSP (Label Switched Path) - однонаправленный путь через MPLS сеть
  • Label Stack - иерархическая структура меток (для туннелирования)
  • FEC (Forwarding Equivalence Class) - группа пакетов с одинаковой обработкой

Архитектура:

[Ingress LER] ----> [LSR] ----> [LSR] ----> [Egress LER]
   (Push)           (Swap)      (Swap)        (Pop)
    |                |            |              |
    v                v            v              v
 IP packet      Label=100    Label=200      IP packet
 + Label=100                               (no label)

Компоненты MPLS сети

Label Edge Router (LER):

  • Граничный маршрутизатор MPLS сети
  • Ingress LER: добавляет метку (push)
  • Egress LER: удаляет метку (pop)
  • Выполняет IP lookup на границе

Label Switch Router (LSR):

  • Внутренний маршрутизатор MPLS сети
  • Выполняет только label switching (swap)
  • Не анализирует IP заголовок
  • Высокая производительность

Control Plane:

  • LDP (Label Distribution Protocol)
  • RSVP-TE (Traffic Engineering)
  • BGP (для L3VPN)
  • IGP (OSPF, IS-IS) для базовой маршрутизации

Data Plane:

  • Label Forwarding Information Base (LFIB)
  • Label Information Base (LIB)
  • Forwarding plane на основе меток

MPLS заголовок

Структура MPLS заголовка (32 бита):

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                Label                  | TC  |S|       TTL     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

Поля:

  • Label (20 bits) - значение метки (0-1048575)
  • TC/EXP (3 bits) - Traffic Class (QoS)
  • S (1 bit) - Bottom of Stack (последняя метка в стеке)
  • TTL (8 bits) - Time to Live

Зарезервированные метки:

  • 0 - IPv4 Explicit NULL
  • 1 - Router Alert
  • 2 - IPv6 Explicit NULL
  • 3 - Implicit NULL
  • 4-15 - Reserved
  • 16-1048575 - Доступны для использования

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

Производительность:

  • Быстрая коммутация по меткам (vs IP lookup)
  • Аппаратное ускорение label switching
  • Уменьшение нагрузки на CPU

Traffic Engineering:

  • Явное задание путей (explicit paths)
  • Резервирование полосы пропускания
  • Fast Reroute для отказоустойчивости
  • Load balancing по нескольким путям

VPN Services:

  • L2VPN (VPLS, VPWS)
  • L3VPN (MPLS VPN)
  • Изоляция трафика разных клиентов
  • Масштабируемость (тысячи VPN)

QoS:

  • Traffic Class в MPLS заголовке
  • DiffServ integration
  • Гарантированная полоса пропускания

Применение:

  • Service Provider сети
  • Enterprise WAN
  • Data Center Interconnect (DCI)
  • 5G Transport Network

Текущие ограничения VyOS

Реализовано:

  • LDP (Label Distribution Protocol)
  • MPLS на интерфейсах
  • Label switching (базовый)
  • Интеграция с OSPF/BGP

Не реализовано:

  • MPLS L2VPN (VPLS, VPWS)
  • MPLS L3VPN (VRF-lite поддерживается отдельно)
  • RSVP-TE (Traffic Engineering)
  • mVPN (Multicast VPN)
  • MPLS OAM (LSP Ping, Traceroute)

Статус: MPLS support в VyOS находится в стадии развития. Базовый LDP работает стабильно, но продвинутые функции пока недоступны.

Label Distribution Protocol (LDP)

LDP - протокол для автоматического распределения меток между MPLS маршрутизаторами.

Архитектура LDP

Принцип работы:

  1. LSR обнаруживают друг друга (hello messages)
  2. Устанавливается TCP сессия (порт 646)
  3. Обмен label bindings (FEC <-> Label)
  4. Построение LFIB на каждом LSR

Типы сообщений:

  • Discovery (UDP 646) - hello messages
  • Session (TCP 646) - установка сессии
  • Advertisement - распространение меток
  • Notification - ошибки и события

Label Distribution Mode:

  • Downstream Unsolicited - LSR посылает метки без запроса
  • Downstream on Demand - метки по запросу
  • VyOS использует Downstream Unsolicited (по умолчанию)

Label Retention Mode:

  • Liberal - сохранять метки от всех LSR
  • Conservative - только от next-hop
  • VyOS использует Liberal mode

Базовая конфигурация LDP

Минимальная конфигурация:

# Enable MPLS on interface
set protocols mpls interface eth1

# Configure LDP
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1

commit
save

Полная конфигурация:

# MPLS interfaces
set protocols mpls interface eth1
set protocols mpls interface eth2

# LDP configuration
set protocols mpls ldp router-id 10.255.255.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1

# LDP on interfaces
set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2

# Optional: IGP for reachability
set protocols ospf area 0 network 10.255.255.1/32
set protocols ospf area 0 network 10.0.0.0/24
set protocols ospf area 0 network 10.0.1.0/24

commit
save

Параметры:

  • router-id - уникальный идентификатор LSR (обязательно)
  • transport-ipv4-address - адрес для TCP сессий
  • interface - интерфейсы с активным LDP

LDP Router ID

Router ID - уникальный идентификатор LDP маршрутизатора (формат IPv4).

set protocols mpls ldp router-id 10.255.255.1
commit

Выбор Router ID:

  1. Явно заданный router-id
  2. Наибольший IP loopback интерфейса
  3. Наибольший IP физического интерфейса

Рекомендация: Используйте loopback адрес для стабильности.

Transport Address

Адрес для установки TCP сессий между LSR.

set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1
commit

Использование:

  • Обычно совпадает с router-id
  • Должен быть доступен через IGP
  • Loopback address для надежности

LDP Interfaces

Включение LDP на интерфейсах:

set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2
set protocols mpls ldp interface eth3
commit

Hello Parameters:

# Hello interval (default: 5 seconds)
set protocols mpls ldp discovery hello-interval 5

# Hold time (default: 15 seconds)
set protocols mpls ldp discovery hello-holdtime 15

commit

Targeted LDP:

Для LDP сессий с не-directly connected LSR:

set protocols mpls ldp discovery targeted-hello accept
set protocols mpls ldp discovery targeted-hello peer-ipv4-address 10.255.255.10
commit

LDP Session Parameters

Keepalive и Hold Time:

set protocols mpls ldp session holdtime 180
set protocols mpls ldp session keepalive-interval 60
commit

По умолчанию:

  • Keepalive: 60 секунд
  • Hold time: 180 секунд

MD5 Authentication:

set protocols mpls ldp neighbor 10.255.255.2 password 'SecureLDP123!'
commit

Защита LDP сессии от spoofing.

LDP Label Allocation

Allocation Mode:

По умолчанию VyOS использует per-platform label allocation:

  • Одна метка для всех next-hops к prefix
  • Более эффективное использование label space

Label Range:

set protocols mpls label-range dynamic-range-start 16
set protocols mpls label-range dynamic-range-end 1048575
commit

Диапазон меток для динамического выделения.

MPLS Forwarding

MPLS на интерфейсах

Включение MPLS на интерфейсе:

set protocols mpls interface eth1
commit

Эффект:

  • Интерфейс начинает обрабатывать MPLS пакеты
  • Включается label switching
  • Интерфейс участвует в построении LSP

Несколько интерфейсов:

set protocols mpls interface eth1
set protocols mpls interface eth2
set protocols mpls interface eth3
set protocols mpls interface bond0
commit

Label Operations

PUSH (добавление метки):

  • На Ingress LER
  • IP пакет получает MPLS метку
  • Выполняется на основе FEC

SWAP (замена метки):

  • На промежуточных LSR
  • Входящая метка заменяется на исходящую
  • Lookup в LFIB

POP (удаление метки):

  • На Egress LER
  • Метка удаляется
  • Пакет обрабатывается как IP
  • Penultimate Hop Popping (PHP): pop на предпоследнем LSR

PHP (Penultimate Hop Popping)

По умолчанию LDP использует PHP:

[R1] --100--> [R2] --200--> [R3] --IP--> [R4]
Ingress       LSR          Penultimate   Egress

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

  • Снижение нагрузки на Egress LER
  • Одно действие вместо двух (pop + IP lookup)

Explicit NULL:

Отключить PHP (использовать explicit null label):

set protocols mpls ldp allocation ipv4 explicit-null
commit

Egress LER получит пакет с меткой 0 (Explicit NULL).

TTL Propagation

Копирование TTL между IP и MPLS заголовками:

# Enable TTL propagation (default)
set protocols mpls ttl-propagation enable
commit

# Disable TTL propagation (скрыть MPLS топологию)
set protocols mpls ttl-propagation disable
commit

Disable: Скрывает количество LSR в MPLS сети от traceroute.

L3VPN с MPLS

MPLS L3VPN (RFC 4364) - VPN сервис на основе MPLS для изоляции IP трафика.

Архитектура L3VPN

Компоненты:

  • CE (Customer Edge) - маршрутизатор клиента
  • PE (Provider Edge) - граничный маршрутизатор провайдера
  • P (Provider) - внутренний маршрутизатор провайдера

Технологии:

  • VRF (Virtual Routing and Forwarding) - изолированные routing tables
  • Route Distinguisher (RD) - уникальность префиксов
  • Route Target (RT) - импорт/экспорт между VRF
  • MP-BGP - распространение VPN маршрутов
  • MPLS - инкапсуляция для передачи через сеть

VRF Configuration

VyOS поддерживает VRF, но интеграция с MPLS L3VPN ограничена.

Создание VRF:

# VRF для клиента A
set vrf name CUSTOMER-A table 100
set vrf name CUSTOMER-A description 'Customer A VPN'

# VRF для клиента B
set vrf name CUSTOMER-B table 101
set vrf name CUSTOMER-B description 'Customer B VPN'

commit

Привязка интерфейса к VRF:

set interfaces ethernet eth2 vrf CUSTOMER-A
set interfaces ethernet eth2 address 192.168.10.1/24

set interfaces ethernet eth3 vrf CUSTOMER-B
set interfaces ethernet eth3 address 192.168.10.1/24

commit

Одинаковые IP адреса в разных VRF не конфликтуют.

BGP для L3VPN

BGP в VRF:

# Global BGP
set protocols bgp system-as 65000

# BGP в VRF CUSTOMER-A
set vrf name CUSTOMER-A protocols bgp system-as 65000
set vrf name CUSTOMER-A protocols bgp neighbor 192.168.10.2 remote-as 65001
set vrf name CUSTOMER-A protocols bgp address-family ipv4-unicast network 10.1.0.0/16

# BGP в VRF CUSTOMER-B
set vrf name CUSTOMER-B protocols bgp system-as 65000
set vrf name CUSTOMER-B protocols bgp neighbor 192.168.10.2 remote-as 65002
set vrf name CUSTOMER-B protocols bgp address-family ipv4-unicast network 10.2.0.0/16

commit

Ограничения VyOS L3VPN

Текущий статус:

  • VRF реализован и работает
  • MPLS LDP работает отдельно
  • Нет интеграции VRF + MPLS
  • Нет MP-BGP для VPNv4/VPNv6
  • Нет Route Distinguisher/Target

Workaround:

  • Использовать VRF без MPLS (VLAN-based isolation)
  • Использовать IPsec/GRE/VXLAN для overlay VPN
  • Ждать полной реализации MPLS L3VPN в будущих версиях

Пример L3VPN архитектуры

Концептуальная схема (для понимания, полная реализация в VyOS pending):

[CE1] --eBGP-- [PE1] ====MPLS/LDP==== [PE2] --eBGP-- [CE2]
 AS65001      AS65000    P Routers     AS65000      AS65002
              VRF-A                    VRF-A
              RD:65000:1              RD:65000:1
              RT:65000:1              RT:65000:1

PE1 (теоретическая конфигурация):

# VRF
set vrf name VPN-A table 100
set vrf name VPN-A rd 65000:1
set vrf name VPN-A rt import 65000:1
set vrf name VPN-A rt export 65000:1

# CE-facing interface
set interfaces ethernet eth2 vrf VPN-A
set interfaces ethernet eth2 address 10.0.1.1/30

# BGP with CE
set vrf name VPN-A protocols bgp system-as 65000
set vrf name VPN-A protocols bgp neighbor 10.0.1.2 remote-as 65001

# MP-BGP with other PE
set protocols bgp system-as 65000
set protocols bgp neighbor 10.255.255.2 remote-as 65000
set protocols bgp address-family l3vpn-ipv4

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1

commit

Примечание: Это концептуальная конфигурация, не все параметры реализованы в текущей версии VyOS.

RSVP-TE (Traffic Engineering)

RSVP-TE (RFC 3209) - расширение RSVP для резервирования ресурсов и явного задания путей.

Концепция RSVP-TE

Возможности:

  • Explicit path routing (обход автоматических IGP путей)
  • Bandwidth reservation (гарантированная полоса)
  • Fast Reroute (защита от отказов)
  • Constraint-based routing

Сравнение с LDP:

ФункцияLDPRSVP-TE
Path selectionFollow IGPExplicit path
BandwidthNo reservationReservation
ProtectionNoFast Reroute
СложностьПростойСложный
OverheadНизкийВысокий

RSVP-TE в VyOS

Текущий статус: RSVP-TE НЕ реализован в VyOS.

Альтернативы:

  • Использовать LDP для базового MPLS
  • Policy-based routing для traffic steering
  • Статические LSP (если будут реализованы)

Концептуальная конфигурация RSVP-TE

Пример того, как могла бы выглядеть конфигурация (NOT IMPLEMENTED):

# Enable RSVP-TE
set protocols mpls rsvp-te enable

# Interface bandwidth
set protocols mpls rsvp-te interface eth1 bandwidth 1000000
set protocols mpls rsvp-te interface eth2 bandwidth 1000000

# LSP tunnel
set protocols mpls rsvp-te tunnel LSP-TO-R5
set protocols mpls rsvp-te tunnel LSP-TO-R5 destination 10.255.255.5
set protocols mpls rsvp-te tunnel LSP-TO-R5 bandwidth 100000
set protocols mpls rsvp-te tunnel LSP-TO-R5 priority setup 7
set protocols mpls rsvp-te tunnel LSP-TO-R5 priority hold 7

# Explicit path
set protocols mpls rsvp-te path PATH-VIA-R2
set protocols mpls rsvp-te path PATH-VIA-R2 hop 10 type strict
set protocols mpls rsvp-te path PATH-VIA-R2 hop 10 address 10.0.1.2
set protocols mpls rsvp-te path PATH-VIA-R2 hop 20 type strict
set protocols mpls rsvp-te path PATH-VIA-R2 hop 20 address 10.0.2.5

set protocols mpls rsvp-te tunnel LSP-TO-R5 explicit-path PATH-VIA-R2

commit

Fast Reroute:

set protocols mpls rsvp-te tunnel LSP-TO-R5 fast-reroute enable
set protocols mpls rsvp-te tunnel LSP-TO-R5 fast-reroute link-protection
commit

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

Простая MPLS сеть (3 роутера)

Топология:

[R1] eth1 <----> eth1 [R2] eth2 <----> eth1 [R3]
10.0.0.0/30        10.0.0.4/30
.1            .2   .5            .6

R1 (Ingress LER):

# Interfaces
set interfaces ethernet eth1 address 10.0.0.1/30
set interfaces loopback lo address 10.255.255.1/32

# OSPF
set protocols ospf area 0 network 10.0.0.0/30
set protocols ospf area 0 network 10.255.255.1/32
set protocols ospf parameters router-id 10.255.255.1

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1

commit
save

R2 (LSR):

# Interfaces
set interfaces ethernet eth1 address 10.0.0.2/30
set interfaces ethernet eth2 address 10.0.0.5/30
set interfaces loopback lo address 10.255.255.2/32

# OSPF
set protocols ospf area 0 network 10.0.0.0/30
set protocols ospf area 0 network 10.0.0.4/30
set protocols ospf area 0 network 10.255.255.2/32
set protocols ospf parameters router-id 10.255.255.2

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls interface eth2
set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2
set protocols mpls ldp router-id 10.255.255.2
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.2

commit
save

R3 (Egress LER):

# Interfaces
set interfaces ethernet eth1 address 10.0.0.6/30
set interfaces loopback lo address 10.255.255.3/32

# OSPF
set protocols ospf area 0 network 10.0.0.4/30
set protocols ospf area 0 network 10.255.255.3/32
set protocols ospf parameters router-id 10.255.255.3

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.3
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.3

commit
save

MPLS с BGP (для L3VPN backbone)

R1 (PE Router):

# Interfaces
set interfaces ethernet eth1 address 10.0.0.1/30
set interfaces ethernet eth2 address 192.168.1.1/24
set interfaces loopback lo address 10.255.255.1/32

# OSPF для MPLS core
set protocols ospf area 0 network 10.0.0.0/30
set protocols ospf area 0 network 10.255.255.1/32
set protocols ospf parameters router-id 10.255.255.1

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1

# iBGP с другими PE
set protocols bgp system-as 65000
set protocols bgp parameters router-id 10.255.255.1
set protocols bgp neighbor 10.255.255.3 remote-as 65000
set protocols bgp neighbor 10.255.255.3 update-source 10.255.255.1
set protocols bgp neighbor 10.255.255.3 address-family ipv4-unicast

# Customer network
set protocols bgp address-family ipv4-unicast network 192.168.1.0/24

commit
save

MPLS для Service Provider

Топология:

                    MPLS Core
         ┌─────────────────────────────┐
         │                             │
[CE-A]--[PE1]--[P1]--[P2]--[PE2]--[CE-B]
         │                             │
         └─────────────────────────────┘
              LDP + OSPF/IS-IS

PE1 (Provider Edge):

# Core-facing interfaces
set interfaces ethernet eth1 address 10.0.1.1/30
set interfaces loopback lo address 10.255.255.1/32

# Customer-facing interface
set interfaces ethernet eth2 address 192.168.10.1/30

# IGP (OSPF) для MPLS core
set protocols ospf area 0 network 10.0.1.0/30
set protocols ospf area 0 network 10.255.255.1/32
set protocols ospf parameters router-id 10.255.255.1

# MPLS/LDP на core интерфейсах
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1

# BGP с клиентом (CE)
set protocols bgp system-as 65000
set protocols bgp neighbor 192.168.10.2 remote-as 65001
set protocols bgp neighbor 192.168.10.2 address-family ipv4-unicast

# iBGP с другими PE для обмена customer routes
set protocols bgp neighbor 10.255.255.2 remote-as 65000
set protocols bgp neighbor 10.255.255.2 update-source 10.255.255.1
set protocols bgp neighbor 10.255.255.2 address-family ipv4-unicast

commit
save

P1 (Provider Core):

# Core interfaces
set interfaces ethernet eth1 address 10.0.1.2/30
set interfaces ethernet eth2 address 10.0.2.1/30
set interfaces loopback lo address 10.255.255.10/32

# OSPF
set protocols ospf area 0 network 10.0.1.0/30
set protocols ospf area 0 network 10.0.2.0/30
set protocols ospf area 0 network 10.255.255.10/32
set protocols ospf parameters router-id 10.255.255.10

# MPLS/LDP на всех core интерфейсах
set protocols mpls interface eth1
set protocols mpls interface eth2
set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2
set protocols mpls ldp router-id 10.255.255.10
set protocols mpls ldp discovery transport-ipv4-address 10.255.255.10

commit
save

Пример для Yandex Cloud: MPLS L3VPN для Enterprise

Сценарий: Крупное предприятие с офисами в Москве и Санкт-Петербурге использует Yandex Cloud для MPLS L3VPN.

Архитектура:

Москва (HQ)                 Yandex Cloud                СПб (Branch)
[CE-MSK]────────[PE-MSK]════════════[PE-SPB]────────[CE-SPB]
192.168.1.0/24   MPLS Core (VRF: CUSTOMER-A)    192.168.2.0/24
AS 65001         AS 65000                        AS 65001

PE-MSK (Yandex Cloud - Moscow):

# Core interface
set interfaces ethernet eth1 address 10.100.0.1/30
set interfaces loopback lo address 10.255.0.1/32

# Customer interface
set interfaces ethernet eth2 address 10.1.0.1/30

# OSPF в MPLS core
set protocols ospf area 0 network 10.100.0.0/30
set protocols ospf area 0 network 10.255.0.1/32
set protocols ospf parameters router-id 10.255.0.1

# MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.0.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.0.1

# VRF для клиента
set vrf name CUSTOMER-A table 100
set vrf name CUSTOMER-A description 'Enterprise Customer A'
set interfaces ethernet eth2 vrf CUSTOMER-A

# BGP с CE (в VRF)
set vrf name CUSTOMER-A protocols bgp system-as 65000
set vrf name CUSTOMER-A protocols bgp neighbor 10.1.0.2 remote-as 65001
set vrf name CUSTOMER-A protocols bgp neighbor 10.1.0.2 address-family ipv4-unicast

# iBGP с PE-SPB для обмена VPN routes
set protocols bgp system-as 65000
set protocols bgp parameters router-id 10.255.0.1
set protocols bgp neighbor 10.255.0.2 remote-as 65000
set protocols bgp neighbor 10.255.0.2 update-source 10.255.0.1
set protocols bgp neighbor 10.255.0.2 address-family ipv4-unicast

# Static route для customer префикса (альтернатива BGP)
set vrf name CUSTOMER-A protocols static route 192.168.2.0/24 next-hop 10.1.0.2

commit
save

CE-MSK (Customer - Moscow HQ):

# WAN interface (к PE)
set interfaces ethernet eth0 address 10.1.0.2/30

# LAN interface
set interfaces ethernet eth1 address 192.168.1.1/24

# BGP с PE
set protocols bgp system-as 65001
set protocols bgp parameters router-id 192.168.1.1
set protocols bgp neighbor 10.1.0.1 remote-as 65000
set protocols bgp neighbor 10.1.0.1 address-family ipv4-unicast

# Announce local network
set protocols bgp address-family ipv4-unicast network 192.168.1.0/24

# Default route через PE
set protocols static route 0.0.0.0/0 next-hop 10.1.0.1

commit
save

Результат: Офисы в Москве и СПб соединены через Yandex Cloud MPLS L3VPN с гарантированной изоляцией трафика.

Пример для VK Cloud: MPLS Backbone для ISP

Сценарий: Региональный ISP использует VK Cloud для построения MPLS backbone между городами.

Архитектура:

Город A              VK Cloud MPLS Core           Город B
[BRAS-A]────[PE-A]═══[P1]═══[P2]═══[PE-B]────[BRAS-B]
Customers    LDP             LDP         LDP    Customers

PE-A (VK Cloud - Edge in City A):

# Interfaces
set interfaces ethernet eth1 address 10.200.1.1/30
set interfaces ethernet eth2 address 10.200.1.5/30
set interfaces ethernet eth3 address 100.64.1.1/24
set interfaces loopback lo address 10.255.1.1/32

# OSPF
set protocols ospf area 0 network 10.200.1.0/30
set protocols ospf area 0 network 10.200.1.4/30
set protocols ospf area 0 network 10.255.1.1/32
set protocols ospf parameters router-id 10.255.1.1

# MPLS/LDP на core интерфейсах
set protocols mpls interface eth1
set protocols mpls interface eth2
set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2
set protocols mpls ldp router-id 10.255.1.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.1.1

# BGP для customer routes (iBGP)
set protocols bgp system-as 64512
set protocols bgp parameters router-id 10.255.1.1

# iBGP с другими PE
set protocols bgp neighbor 10.255.1.2 remote-as 64512
set protocols bgp neighbor 10.255.1.2 update-source 10.255.1.1
set protocols bgp neighbor 10.255.1.2 address-family ipv4-unicast
set protocols bgp neighbor 10.255.1.2 address-family ipv4-unicast next-hop-self

# BRAS connection
set protocols bgp neighbor 100.64.1.10 remote-as 64512
set protocols bgp neighbor 100.64.1.10 address-family ipv4-unicast

# Redistribute connected для customer subnets
set protocols bgp address-family ipv4-unicast redistribute connected route-map CUSTOMERS

# Route-map
set policy route-map CUSTOMERS rule 10 action permit
set policy route-map CUSTOMERS rule 10 match interface eth3

commit
save

P1 (VK Cloud - Core Router):

# Interfaces
set interfaces ethernet eth1 address 10.200.1.2/30
set interfaces ethernet eth2 address 10.200.2.1/30
set interfaces ethernet eth3 address 10.200.3.1/30
set interfaces loopback lo address 10.255.100.1/32

# OSPF с высоким приоритетом (для стабильности)
set protocols ospf area 0 network 10.200.1.0/30
set protocols ospf area 0 network 10.200.2.0/30
set protocols ospf area 0 network 10.200.3.0/30
set protocols ospf area 0 network 10.255.100.1/32
set protocols ospf parameters router-id 10.255.100.1

# MPLS/LDP на всех интерфейсах
set protocols mpls interface eth1
set protocols mpls interface eth2
set protocols mpls interface eth3
set protocols mpls ldp interface eth1
set protocols mpls ldp interface eth2
set protocols mpls ldp interface eth3
set protocols mpls ldp router-id 10.255.100.1
set protocols mpls ldp discovery transport-ipv4-address 10.255.100.1

# NO BGP на core роутере (только транзит MPLS)

commit
save

Преимущества для ISP:

  • Высокая производительность (label switching)
  • Масштабируемость (тысячи customer routes)
  • Traffic Engineering возможности
  • Быстрая конвергенция с BFD

Операционные команды

Проверка MPLS

MPLS интерфейсы:

show mpls interface

Вывод:

Interface          State  MPLS Enabled
eth1              up     yes
eth2              up     yes

MPLS таблица:

show mpls table

Вывод:

Inbound Label  Type        Nexthop       Outbound Label
16             LDP         10.0.0.2      17
17             LDP         10.0.0.2      implicit-null
18             LDP         10.0.0.2      19

LDP Neighbors

Список соседей:

show mpls ldp neighbor

Вывод:

Peer LDP Ident: 10.255.255.2:0
  TCP connection: 10.255.255.2:646 - 10.255.255.1:37521
  State: OPERATIONAL
  Up time: 01:23:45
  LDP Discovery Sources:
    Interface: eth1

Peer LDP Ident: 10.255.255.3:0
  TCP connection: 10.255.255.3:646 - 10.255.255.1:40123
  State: OPERATIONAL
  Up time: 02:15:30
  LDP Discovery Sources:
    Interface: eth2

Детали конкретного соседа:

show mpls ldp neighbor 10.255.255.2 detail

LDP Bindings

Label bindings:

show mpls ldp binding

Вывод:

Destination               Nexthop           Local Label    Remote Label
10.255.255.1/32          10.0.0.1          imp-null       -
10.255.255.2/32          10.0.0.2          16             imp-null
10.255.255.3/32          10.0.0.2          17             18
192.168.1.0/24           10.0.0.2          18             20

Bindings для конкретного префикса:

show mpls ldp binding 192.168.1.0/24

LDP Discovery

Discovery информация:

show mpls ldp discovery

Вывод:

Local LDP Identifier: 10.255.255.1:0
Discovery Sources:
  Interface: eth1
    Transport Address: 10.255.255.1
    Hello Interval: 5
    Hello Holdtime: 15
    Link Hellos Sent: 1234
    Link Hellos Received: 1230

Debug и логи

Enable debug:

# Debug LDP events
debug mpls ldp event

# Debug LDP messages
debug mpls ldp messages

# Debug LDP zebra
debug mpls ldp zebra

# View logs
show log | match mpls

Disable debug:

no debug mpls ldp event
no debug mpls ldp messages
no debug mpls ldp zebra

Forwarding Table

Kernel forwarding table:

show ip route

MPLS маршруты отмечены как:

L   192.168.1.0/24 [110/20] via 10.0.0.2, eth1, label 20, 01:23:45

FIB (Forwarding Information Base):

show ip fib

Troubleshooting

LDP сессия не устанавливается

Проверьте:

  1. IP connectivity:

    ping 10.255.255.2
  2. TCP порт 646:

    telnet 10.255.255.2 646
  3. MPLS на интерфейсе:

    show mpls interface
  4. LDP router-id:

    show mpls ldp neighbor
  5. Firewall:

    # Allow LDP
    set firewall ipv4 input filter rule 100 action accept
    set firewall ipv4 input filter rule 100 destination port 646
    set firewall ipv4 input filter rule 100 protocol tcp
    
    set firewall ipv4 input filter rule 101 action accept
    set firewall ipv4 input filter rule 101 destination port 646
    set firewall ipv4 input filter rule 101 protocol udp
    
    commit
  6. IGP доступность:

    show ip route 10.255.255.2

    Transport address должен быть достижим через IGP.

Labels не распределяются

Проверьте:

  1. LDP operational:

    show mpls ldp neighbor

    State должен быть OPERATIONAL.

  2. IGP маршруты:

    show ip route ospf

    Должны быть маршруты к префиксам для LDP binding.

  3. LDP bindings:

    show mpls ldp binding
  4. Label range:

    show mpls label table
  5. Debug:

    debug mpls ldp messages

    Проверьте обмен label mapping сообщениями.

MPLS forwarding не работает

Проверьте:

  1. MPLS таблица:

    show mpls table

    Должны быть entries для destination префикса.

  2. LSP путь:

    traceroute mpls ipv4 192.168.1.1
  3. TTL propagation:

    show configuration | grep ttl-propagation
  4. Interface MTU: MPLS добавляет 4 байта на метку, проверьте MTU:

    show interfaces ethernet eth1
  5. Label operations:

    • Ingress: Проверьте push operation
    • Transit: Проверьте swap operation
    • Egress: Проверьте pop operation

High CPU usage

Причины:

  1. Слишком много LDP сессий
  2. Частые изменения топологии
  3. Debug включен

Решения:

  1. Disable debug:

    no debug mpls ldp all
  2. Tune LDP timers:

    set protocols mpls ldp discovery hello-interval 10
    set protocols mpls ldp discovery hello-holdtime 30
    commit
  3. Reduce LDP sessions (use targeted LDP только где необходимо)

Label allocation issues

Проверьте:

  1. Label range:

    show mpls label table
  2. Доступные labels: По умолчанию: 16-1048575 (1048560 меток)

  3. Label exhaustion: Если labels закончились (маловероятно), увеличьте range:

    set protocols mpls label-range dynamic-range-start 16
    set protocols mpls label-range dynamic-range-end 1048575
    commit

Лучшие практики

Планирование сети

  1. Дизайн топологии:

    • Четкое разделение Core/Edge
    • Redundant paths для отказоустойчивости
    • Hierarchical design (Access-Aggregation-Core)
  2. Адресация:

    • Выделенный loopback subnet для LSR
    • Понятная схема нумерации
    • Документирование
  3. IGP выбор:

    • OSPF для небольших сетей
    • IS-IS для Service Provider
    • Оптимизация метрик для traffic engineering

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

  1. Всегда используйте loopback:

    set protocols mpls ldp router-id 10.255.255.1
    set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1
  2. MD5 authentication для критичных LDP сессий:

    set protocols mpls ldp neighbor 10.255.255.2 password 'SecurePassword!'
  3. TTL security для защиты от spoofing:

    set protocols mpls ldp neighbor 10.255.255.2 ttl-security hops 1
  4. Session protection:

    set protocols mpls ldp session holdtime 180
    set protocols mpls ldp session keepalive-interval 60
  5. Graceful restart (если поддерживается): Позволяет сохранить forwarding при restart LDP процесса.

Масштабируемость

  1. Label management:

    • Используйте liberal retention mode
    • Оптимизируйте label range
  2. LDP optimizations:

    • Targeted LDP только где необходимо
    • Tune timers для баланса convergence/overhead
  3. BGP для L3VPN:

    • Route Reflectors для масштабирования iBGP
    • Route filtering

Мониторинг

  1. LDP сессии:

    show mpls ldp neighbor

    Мониторить state и uptime.

  2. Label bindings:

    show mpls ldp binding summary
  3. MPLS forwarding:

    show mpls table
  4. Performance metrics:

    • Label operations per second
    • Control plane CPU usage
    • LDP message rate
  5. Alerting:

    • LDP neighbor down
    • High label allocation
    • Interface flapping

Безопасность

  1. Control plane protection:

    # Firewall для LDP
    set firewall ipv4 input filter rule 100 action accept
    set firewall ipv4 input filter rule 100 source address 10.255.255.0/24
    set firewall ipv4 input filter rule 100 destination port 646
    set firewall ipv4 input filter rule 100 protocol tcp
  2. Management plane security:

    • Отдельный management VRF
    • SSH ключи вместо паролей
    • RBAC для операторов
  3. Logging:

    set system syslog global facility protocols level info

Отказоустойчивость

  1. Redundant topology:

    • Минимум 2 пути между PE
    • No single point of failure
  2. BFD integration (когда доступен): Быстрое обнаружение отказов.

  3. IGP tuning:

    # Faster OSPF convergence
    set protocols ospf timers throttle spf delay 50
    set protocols ospf timers throttle spf initial-holdtime 200
    set protocols ospf timers throttle spf max-holdtime 5000
  4. Graceful shutdown: Перед обслуживанием:

    # Drain traffic from LSR
    set protocols ospf max-metric router-lsa administrative
    commit

Performance Tuning

Label Forwarding

Оптимизация LFIB:

  • Hardware offload (если поддерживается ASIC)
  • Label stacking depth (trade-off память/функциональность)

Control Plane

LDP tuning:

# Adjust hello timers (баланс detection time vs overhead)
set protocols mpls ldp discovery hello-interval 5
set protocols mpls ldp discovery hello-holdtime 15

# Session timers
set protocols mpls ldp session holdtime 180
set protocols mpls ldp session keepalive-interval 60

commit

Рекомендации:

  • Hello interval: 5-10 секунд (по умолчанию 5)
  • Hold time: 3x hello interval минимум
  • Keepalive: 60 секунд (стандарт)

IGP Integration

OSPF optimizations:

# Fast convergence
set protocols ospf timers throttle spf delay 50
set protocols ospf timers throttle spf initial-holdtime 200
set protocols ospls timers throttle spf max-holdtime 5000

# LSA throttling
set protocols ospf timers lsa min-arrival 100

commit

Metric tuning: Используйте OSPF/IS-IS метрики для влияния на LSP пути.

Интеграция с другими технологиями

MPLS + BGP

Use case: Scalable L3VPN

# BGP для customer routes
set protocols bgp system-as 65000
set protocols bgp neighbor 10.255.255.2 remote-as 65000
set protocols bgp neighbor 10.255.255.2 update-source 10.255.255.1

# LDP для label distribution
set protocols mpls ldp router-id 10.255.255.1
set protocols mpls ldp interface eth1

# IGP для reachability
set protocols ospf area 0 network 10.255.255.1/32

Результат: BGP несет customer routes, MPLS обеспечивает forwarding.

MPLS + QoS

Traffic Class в MPLS header:

# QoS policy
set qos policy shaper MPLS-SHAPE class 1 bandwidth 100mbit
set qos policy shaper MPLS-SHAPE class 1 match VOICE dscp ef

set interfaces ethernet eth1 traffic-policy out MPLS-SHAPE

commit

EXP bits копируются из IP DSCP (если TTL propagation enabled).

MPLS + IPsec

Шифрование MPLS трафика (для sensitive data):

# IPsec tunnel для MPLS
set vpn ipsec esp-group MPLS-ESP mode tunnel
set vpn ipsec esp-group MPLS-ESP pfs enable
set vpn ipsec esp-group MPLS-ESP proposal 1 encryption aes256
set vpn ipsec esp-group MPLS-ESP proposal 1 hash sha256

set vpn ipsec ike-group MPLS-IKE proposal 1 encryption aes256
set vpn ipsec ike-group MPLS-IKE proposal 1 hash sha256

set vpn ipsec site-to-site peer 203.0.113.1 ike-group MPLS-IKE
set vpn ipsec site-to-site peer 203.0.113.1 tunnel 1 esp-group MPLS-ESP
set vpn ipsec site-to-site peer 203.0.113.1 tunnel 1 local prefix 10.0.0.0/8
set vpn ipsec site-to-site peer 203.0.113.1 tunnel 1 remote prefix 10.0.0.0/8

commit

Примечание: MPLS over IPsec добавляет overhead, но обеспечивает confidentiality.

Миграция на MPLS

Этапы внедрения

Фаза 1: Planning

  1. Аудит существующей сети
  2. Определение требований (bandwidth, QoS, VPN)
  3. Выбор дизайна (LDP vs RSVP-TE)
  4. Лабораторное тестирование

Фаза 2: Core Deployment

  1. Внедрение MPLS на core роутерах (P)
  2. Настройка IGP
  3. Активация LDP
  4. Верификация LSP

Фаза 3: Edge Deployment

  1. Настройка PE роутеров
  2. Конфигурация VRF (если L3VPN)
  3. BGP интеграция
  4. Тестирование с pilot customers

Фаза 4: Migration

  1. Постепенный перевод трафика на MPLS
  2. Мониторинг производительности
  3. Оптимизация
  4. Decommission legacy сетей

Parallel Running

Запуск MPLS параллельно с IP:

# Existing IP routing (OSPF)
set protocols ospf area 0 network 10.0.0.0/8

# New MPLS/LDP
set protocols mpls interface eth1
set protocols mpls ldp interface eth1
set protocols mpls ldp router-id 10.255.255.1

commit

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

  • Zero downtime migration
  • Rollback возможность
  • Постепенное тестирование

Недостатки:

  • Увеличенная сложность
  • Дополнительные ресурсы

Следующие шаги

  • BGP - для L3VPN и inter-AS routing
  • OSPF - IGP для MPLS core
  • VRF - Virtual Routing and Forwarding
  • QoS - Quality of Service с MPLS
  • Firewall - защита MPLS сети

Справочные материалы

RFC:

  • RFC 3031 - MPLS Architecture
  • RFC 3032 - MPLS Label Stack Encoding
  • RFC 5036 - LDP Specification
  • RFC 4364 - BGP/MPLS IP VPNs (L3VPN)
  • RFC 3209 - RSVP-TE Extensions for LSP Tunnels
  • RFC 4379 - LSP Ping and Traceroute
  • RFC 5920 - Security Framework for MPLS

VyOS Documentation:

Книги:

  • “MPLS Fundamentals” - Luc De Ghein
  • “MPLS and VPN Architectures” - Pepelnjak, Guichard
  • “Traffic Engineering with MPLS” - Osborne, Simha