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
Принцип работы:
- LSR обнаруживают друг друга (hello messages)
- Устанавливается TCP сессия (порт 646)
- Обмен label bindings (FEC <-> Label)
- Построение 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:
- Явно заданный router-id
- Наибольший IP loopback интерфейса
- Наибольший 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
commitHello 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
commitTargeted 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
commitLDP 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
commitLabel 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
commitEgress 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
commitDisable: Скрывает количество 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:1PE1 (теоретическая конфигурация):
# 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:
| Функция | LDP | RSVP-TE |
|---|---|---|
| Path selection | Follow IGP | Explicit path |
| Bandwidth | No reservation | Reservation |
| Protection | No | Fast 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
commitFast 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 .6R1 (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
saveR2 (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
saveR3 (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
saveMPLS с 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
saveMPLS для Service Provider
Топология:
MPLS Core
┌─────────────────────────────┐
│ │
[CE-A]--[PE1]--[P1]--[P2]--[PE2]--[CE-B]
│ │
└─────────────────────────────┘
LDP + OSPF/IS-ISPE1 (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
saveP1 (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 65001PE-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
saveCE-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 CustomersPE-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
saveP1 (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 yesMPLS таблица:
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 19LDP 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 detailLDP 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 20Bindings для конкретного префикса:
show mpls ldp binding 192.168.1.0/24LDP 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: 1230Debug и логи
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 mplsDisable debug:
no debug mpls ldp event
no debug mpls ldp messages
no debug mpls ldp zebraForwarding Table
Kernel forwarding table:
show ip routeMPLS маршруты отмечены как:
L 192.168.1.0/24 [110/20] via 10.0.0.2, eth1, label 20, 01:23:45FIB (Forwarding Information Base):
show ip fibTroubleshooting
LDP сессия не устанавливается
Проверьте:
IP connectivity:
ping 10.255.255.2TCP порт 646:
telnet 10.255.255.2 646MPLS на интерфейсе:
show mpls interfaceLDP router-id:
show mpls ldp neighborFirewall:
# 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 commitIGP доступность:
show ip route 10.255.255.2Transport address должен быть достижим через IGP.
Labels не распределяются
Проверьте:
LDP operational:
show mpls ldp neighborState должен быть OPERATIONAL.
IGP маршруты:
show ip route ospfДолжны быть маршруты к префиксам для LDP binding.
LDP bindings:
show mpls ldp bindingLabel range:
show mpls label tableDebug:
debug mpls ldp messagesПроверьте обмен label mapping сообщениями.
MPLS forwarding не работает
Проверьте:
MPLS таблица:
show mpls tableДолжны быть entries для destination префикса.
LSP путь:
traceroute mpls ipv4 192.168.1.1TTL propagation:
show configuration | grep ttl-propagationInterface MTU: MPLS добавляет 4 байта на метку, проверьте MTU:
show interfaces ethernet eth1Label operations:
- Ingress: Проверьте push operation
- Transit: Проверьте swap operation
- Egress: Проверьте pop operation
High CPU usage
Причины:
- Слишком много LDP сессий
- Частые изменения топологии
- Debug включен
Решения:
Disable debug:
no debug mpls ldp allTune LDP timers:
set protocols mpls ldp discovery hello-interval 10 set protocols mpls ldp discovery hello-holdtime 30 commitReduce LDP sessions (use targeted LDP только где необходимо)
Label allocation issues
Проверьте:
Label range:
show mpls label tableДоступные labels: По умолчанию: 16-1048575 (1048560 меток)
Label exhaustion: Если labels закончились (маловероятно), увеличьте range:
set protocols mpls label-range dynamic-range-start 16 set protocols mpls label-range dynamic-range-end 1048575 commit
Лучшие практики
Планирование сети
Дизайн топологии:
- Четкое разделение Core/Edge
- Redundant paths для отказоустойчивости
- Hierarchical design (Access-Aggregation-Core)
Адресация:
- Выделенный loopback subnet для LSR
- Понятная схема нумерации
- Документирование
IGP выбор:
- OSPF для небольших сетей
- IS-IS для Service Provider
- Оптимизация метрик для traffic engineering
Конфигурация
Всегда используйте loopback:
set protocols mpls ldp router-id 10.255.255.1 set protocols mpls ldp discovery transport-ipv4-address 10.255.255.1MD5 authentication для критичных LDP сессий:
set protocols mpls ldp neighbor 10.255.255.2 password 'SecurePassword!'TTL security для защиты от spoofing:
set protocols mpls ldp neighbor 10.255.255.2 ttl-security hops 1Session protection:
set protocols mpls ldp session holdtime 180 set protocols mpls ldp session keepalive-interval 60Graceful restart (если поддерживается): Позволяет сохранить forwarding при restart LDP процесса.
Масштабируемость
Label management:
- Используйте liberal retention mode
- Оптимизируйте label range
LDP optimizations:
- Targeted LDP только где необходимо
- Tune timers для баланса convergence/overhead
BGP для L3VPN:
- Route Reflectors для масштабирования iBGP
- Route filtering
Мониторинг
LDP сессии:
show mpls ldp neighborМониторить state и uptime.
Label bindings:
show mpls ldp binding summaryMPLS forwarding:
show mpls tablePerformance metrics:
- Label operations per second
- Control plane CPU usage
- LDP message rate
Alerting:
- LDP neighbor down
- High label allocation
- Interface flapping
Безопасность
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 tcpManagement plane security:
- Отдельный management VRF
- SSH ключи вместо паролей
- RBAC для операторов
Logging:
set system syslog global facility protocols level info
Отказоустойчивость
Redundant topology:
- Минимум 2 пути между PE
- No single point of failure
BFD integration (когда доступен): Быстрое обнаружение отказов.
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 5000Graceful 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
commitMetric 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
commitEXP 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
- Аудит существующей сети
- Определение требований (bandwidth, QoS, VPN)
- Выбор дизайна (LDP vs RSVP-TE)
- Лабораторное тестирование
Фаза 2: Core Deployment
- Внедрение MPLS на core роутерах (P)
- Настройка IGP
- Активация LDP
- Верификация LSP
Фаза 3: Edge Deployment
- Настройка PE роутеров
- Конфигурация VRF (если L3VPN)
- BGP интеграция
- Тестирование с pilot customers
Фаза 4: Migration
- Постепенный перевод трафика на MPLS
- Мониторинг производительности
- Оптимизация
- 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