Skip to main content

MPLS Configuration on CX-M Asterfusion Enterprise SONiC Switch

Configuring MPLS Static LSP

Network Requirements

configuring-mpls-static-lsp-network-requirements
In this network topology, only MPLS static LSPs are used to enable communication between CE1 and CE2. Therefore, the following configurations are required:
  • Configure LSP1 from PE1 to PE2, with P2 using PHP (Penultimate Hop Popping) explicit null label
  • Configure LSP2 from PE2 to PE1, with P1 using PHP implicit null label

Configuration Steps

  1. PE1 Device Configuration

# Configure IP addresses for interfaces and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.1/24
sonic(config-if-1)# mpls enable
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 10.1.1.254/24
sonic(config-if-3)# mpls enable

# Configure LSP1: Route to 20.1.1.0/24 with label 50

sonic(config)# ip route 20.1.1.0/24 12.12.12.2 label 50

  1. P1 Device Configuration

# Configure IP addresses for Ethernet1 and Ethernet2, and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.2/24
sonic(config-if-1)# mpls enable
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.1/24
sonic(config-if-2)# mpls enable

# Configure LSP1: Incoming label 50, outgoing label 60

sonic(config)# mpls lsp 50 14.14.14.2 60

# Configure LSP2: Incoming label 80, strip label (implicit null)

sonic(config)# mpls lsp 80 12.12.12.1 implicit-null

  1. P2 Device Configuration
# Configure IP addresses for Ethernet1 and Ethernet2, and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 16.16.16.1/24
sonic(config-if-1)# mpls enable
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.2/24
sonic(config-if-2)# mpls enable

# Configure LSP1: Incoming label 60, outgoing label 0 (explicit null)

sonic(config)# mpls lsp 60 16.16.16.2 explicit-null

# Configure LSP2: Incoming label 70, outgoing label 80

sonic(config)# mpls lsp 70 14.14.14.1 80

  1. PE2 Device Configuration
# Configure IP addresses for Ethernet1 and Ethernet3, and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 16.16.16.2/24
sonic(config-if-1)# mpls enable
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 20.1.1.254/24

# Configure LSP1: Route to 10.1.1.0/24 with label 70
sonic(config)# ip route 10.1.1.0/24 16.16.16.1 label 70
  1. CE1 Device Configuration
# Configure interface IP address and routing
sonic(config)# interface ethernet 3
sonic(config-if-1)# ip address 10.1.1.1/24
sonic(config)# ip route add 20.1.1.0/24 10.1.1.254
  1. CE2 Device Configuration
# Configure interface IP address and routing
sonic(config)# interface ethernet 3
sonic(config-if-1)# ip address 20.1.1.1/24
sonic(config)# ip route add 10.1.1.0/24 20.1.1.254

Configuring MPLS L2VPN VPWS

Network Requirements

configuring-mpls-l2vpn-vpws-network-requirements
In this network topology, PE1, P, and PE2 run OSPF and LDP protocols. VPWS-type L2VPN is configured on PE1 and PE2, using LDP to generate labels, ultimately enabling communication between PC1 and PC2 within the same Layer 2 VPN.

Configuration Steps

  1. PE1 Device Configuration
# Configure interface IP address and enable MPLS functionality
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.1/24
sonic(config-if-1)# mpls enable
sonic(config-if-1)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.1.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.1.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 12.12.12.0/24 area 1

# Enable LDP functionality on interface Ethernet1

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.1.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.1.1.1
sonic(config-ldp-af)# exit-address-family

# Configure PW (Pseudowire)

sonic(config)# pseudowire pw1
sonic(config-pw)# neighbor lsr-id 100.3.1.1
sonic(config-pw)# pw-id 100

# Create VPWS-type L2VPN and configure PW and AC

sonic(config)# l2vpn A type vpws
sonic(config-l2vpn)# member interface ethernet 3
sonic(config-l2vpn)# member pseudowire pw1
  1. P Device Configuration
# Configure interface IP addresses and enable MPLS functionality
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.2/24
sonic(config-if-1)# mpls enable
sonic(config-if-1)# mpls ldp
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.2/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
# Establish OSPF session
sonic(config)# interface loopback 1
sonic(config-if-1)# ip address 100.2.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.2.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 12.12.12.0/24 area 1
sonic(config-router)# network 14.14.14.0/24 area 1

# Enable LDP functionality on interfaces Ethernet1 and Ethernet2

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.2.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.2.1.1
sonic(config-ldp-af)# exit-address-family
  1. PE2 Device Configuration
# Configure interface IP address and enable MPLS functionality
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.3.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.3.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 14.14.14.0/24 area 1

# Enable LDP functionality on interface Ethernet2

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.3.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.3.1.1
sonic(config-ldp-af)# exit-address-family
# Configure PW (Pseudowire)
sonic(config)# pseudowire pw1
sonic(config-pw)# neighbor lsr-id 100.1.1.1
sonic(config-pw)# pw-id 100
# Create L2VPN and configure PW and AC
sonic(config)# l2vpn A type vpws
sonic(config-l2vpn)# member interface ethernet 3
sonic(config-l2vpn)# member pseudowire pw1

Configuring MPLS L2VPN VPLS

Network Requirements

configuring-mpls-l2vpn-vpls-network-requirements-2
In this network topology, PE1, P, PE2, and PE3 all run OSPF and LDP protocols. VPLS-type L2VPN is configured on PE1, PE2, and PE3 respectively, using LDP to generate labels, ultimately enabling mutual communication between PC1, PC2, and PC3 within the same Layer 2 VPN.

Configuration Steps

  1. PE1 Device Configuration

# Configure interface IP address and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.1/24
sonic(config-if-1)# mpls enable
sonic(config-if-1)# mpls ldp

# Create VLAN as L2VPN AC interface and add interface to VLAN

sonic(config)# interface ethernet 3
sonic(config-if-3)# switchport access vlan 100

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.1.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.1.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 12.12.12.0/24 area 1
# Enable LDP functionality on interface Ethernet1
sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.1.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.1.1.1
sonic(config-ldp-af)# exit-address-family
# Create PWs (Pseudowires)
sonic(config)# pseudowire pw12
sonic(config-pw)# neighbor lsr-id 100.3.1.1
sonic(config-pw)# pw-id 300
sonic(config)# pseudowire pw13
sonic(config-pw)# neighbor lsr-id 100.4.1.1
sonic(config-pw)# pw-id 400
# Create L2VPN and configure PW and AC
sonic(config)# l2vpn A type vpls
sonic(config-l2vpn)# member interface vlan 100
sonic(config-l2vpn)# member pseudowire pw12
sonic(config-l2vpn)# member pseudowire pw13

      2. P Device Configuration

# Configure interface IP addresses and enable MPLS functionality

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.2/24
sonic(config-if-1)# mpls enable
sonic(config-if-1)# mpls ldp
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 16.16.16.2/24
sonic(config-if-3)# mpls enable
sonic(config-if-3)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.2.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.2.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 12.12.12.0/24 area 1
sonic(config-router)# network 14.14.14.0/24 area 1
sonic(config-router)# network 16.16.16.0/24 area 1

# Enable LDP functionality on interfaces Ethernet1, Ethernet2, and Ethernet3

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.2.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.2.1.1
sonic(config-ldp-af)# exit-address-family
  1. PE2 Device Configuration

# Create VLAN as L2VPN AC interface and add interface to VLAN

sonic(config)# vlan 100
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.2/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# switchport access vlan 100

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.3.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.3.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 14.14.14.0/24 area 1
# Enable LDP functionality on interface Ethernet2
sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.3.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.3.1.1
sonic(config-ldp-af)# exit-address-family
# Create PWs (Pseudowires)
sonic(config)# pseudowire pw12
sonic(config-pw)# neighbor lsr-id 100.1.1.1
sonic(config-pw)# pw-id 300
sonic(config)# pseudowire pw23
sonic(config-pw)# neighbor lsr-id 100.4.1.1
sonic(config-pw)# pw-id 500
# Create L2VPN and configure PW and AC
sonic(config)# l2vpn A type vpls
sonic(config-l2vpn)# member interface vlan 100
sonic(config-l2vpn)# member pseudowire pw12
sonic(config-l2vpn)# member pseudowire pw23
  1. PE3 Device Configuration

# Create VLAN as L2VPN AC interface and add interface to VLAN

sonic(config)# vlan 100
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 16.16.16.1/24
sonic(config-if-3)# mpls enable
sonic(config-if-3)# mpls ldp
sonic(config)# interface ethernet 1
sonic(config-if-1)# switchport access vlan 100
# Establish OSPF session
sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 100.4.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 100.4.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# redistribute static
sonic(config-router)# network 16.16.16.0/24 area 1
# Enable LDP functionality on interface Ethernet3
sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.4.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 100.4.1.1
sonic(config-ldp-af)# exit-address-family
# Create PW
sonic(config)# pseudowire pw13
sonic(config-pw)# neighbor lsr-id 100.1.1.1
sonic(config-pw)# pw-id 400
sonic(config)# pseudowire pw23
sonic(config-pw)# neighbor lsr-id 100.3.1.1
sonic(config-pw)# pw-id 500
# Create L2VPN and configure PW and AC
sonic(config)# l2vpn A type vpls
sonic(config-l2vpn)# member interface vlan 100
sonic(config-l2vpn)# member pseudowire pw13
sonic(config-l2vpn)# member pseudowire pw23

MPLS L3VPN Configuration

Network Requirements

configuring-mpls-l3vpn-network-requirements
In this network topology, OSPF and LDP protocols run between PE1-P-PE2 in the backbone network. MP-BGP protocol runs on PE1 and PE2 to exchange VPN routes. EBGP protocol runs between PE1 and CE1, and between PE2 and CE2 respectively. This configuration enables communication between CE1 and CE2 within the same VPN.

Configuration Steps

  1. PE1 Device Configuration
# Configure interface IP addresses, enable MPLS functionality, create vrf1, and add interface Ethernet1
sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# vrf 1
sonic(config-if-1)# ip address 10.1.1.2/24
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
# Establish OSPF session
sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 1.1.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 1.1.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1
# Enable LDP functionality on interface Ethernet2
sonic(config)# mpls ldp
sonic(config-ldp)# router-id 1.1.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.1
# Configure MP-BGP and establish neighbor relationship with PE2
sonic(config)# router bgp 200
sonic(config-router)# neighbor 4.4.4.4 remote-as 200
sonic(config-router)# neighbor 4.4.4.4 update-source 1.1.1.1
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 4.4.4.4 activate
# Configure EBGP and establish neighbor relationship with CE1
sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.1 remote-as 100
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 1.1.1.1:2
sonic(config-router-af)# rt vpn both 200:2
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn
  1. ASR2 Device Configuration

#Configure interface IP addresses and enable MPLS functionality

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.2/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.2/24
sonic(config-if-3)# mpls enable
sonic(config-if-3)# mpls ldp

#Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 2.2.2.2/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 2.2.2.2
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1
sonic(config-router)# network 30.1.1.0/24 area 1

# Enable LDP functionality on interfaces Ethernet2 and Ethernet3

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 2.2.2.2
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.2
  1. PE2 Device Configuration

# Configure interface IP addresses, enable MPLS functionality, create vrf1, and add interface

sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# vrf 1
sonic(config-if-1)# ip address 10.2.2.2/24
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.1/24
sonic(config-if-3)# mpls enable
sonic(config-if-3)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 4.4.4.4/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 4.4.4.4
sonic(config-router)# redistribute connected
sonic(config-router)# network 30.1.1.0/24 area 1

# Enable LDP functionality on interfaces Ethernet1 and Ethernet3

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 4.4.4.4
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 30.1.1.1

# Configure MP-BGP and establish neighbor relationship with PE1

sonic(config)# router bgp 200
sonic(config-router)# neighbor 1.1.1.1 remote-as 200
sonic(config-router)# neighbor 1.1.1.1 update-source 4.4.4.4
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 1.1.1.1 activate

# Configure EBGP and establish neighbor relationship with CE2

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.1 remote-as 300
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 4.4.4.4:2
sonic(config-router-af)# rt vpn both 200:2
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn
  1. CE1 Device Configuration
# Configure interface IP address
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.1.1.1/24

# Configure EBGP, establish neighbor relationship with PE1, and redistribute connected routes

sonic(config)# router bgp 100
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.2 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected
  1. CE2 Device Configuration

# Configure interface IP address

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.2.2.1/24

# Configure EBGP, establish neighbor relationship with PE2, and redistribute connected routes

sonic(config)# router bgp 300
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.2 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected

MPLS L3VPN Option A Configuration

Network Requirements

configuring-mpls-l3vpn-optiona-network-requirements
In this topology, the interfaces between the two ASBRs and the connections to CE1 and CE2 belong to the same VPN. OSPF and LDP run between PE1–ASBR1 and PE2–ASBR2. EBGP is established between the PEs and their respective CEs, and between the ASBRs. MP-IBGP is established between the PEs and ASBRs. The goal is to enable full communication between CE1 and CE2.

Configuration Steps

  1. PE1 Device Configuration

# Configure interface IP addresses and enable MPLS functionality, create vrf1 and add interface Ethernet1

sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.1.1.1/24
sonic(config-if-1)# vrf 1
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 1.1.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 1.1.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1

# Enable LDP functionality on interfaces Ethernet2

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 1.1.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.1

# Create MP-BGP and establish neighbor relationship with ASBR1

sonic(config)# router bgp 200
sonic(config-router)# neighbor 2.2.2.2 remote-as 200
sonic(config-router)# neighbor 2.2.2.2 update-source 1.1.1.1
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 2.2.2.2 activate

# Create EBGP and establish neighbor relationship with CE1

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.2 remote-as 102
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 200:1
sonic(config-router-af)# rt vpn both 1:1
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn
  1. ASBR1 Device Configuration

# Configure IP addresses for interfaces and enable MPLS. Create vrf1 and add Ethernet3 to it

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.2/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.1/24
sonic(config-if-3)# vrf 1

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 2.2.2.2/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 2.2.2.2
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1

# Enable LDP functionality on interfaces Ethernet2

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 2.2.2.2
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.2

# Create MP-BGP and establish neighbor relationship with PE1

sonic(config)# router bgp 200
sonic(config-router)# neighbor 1.1.1.1 remote-as 200
sonic(config-router)# neighbor 1.1.1.1 update-source 2.2.2.2
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 1.1.1.1 activate

# Create EBGP and establish neighbor relationship with ASBR2

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 30.1.1.2 remote-as 300
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 200:2
sonic(config-router-af)# rt vpn both 1:1
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

    3. ASBR2 Device Configuration

# Configure interface IP addresses and enable MPLS, create VRF1 and add Ethernet3

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.2/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.2/24
sonic(config-if-3)# vrf 1

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 3.3.3.3/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 3.3.3.3
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.2.2.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 3.3.3.3
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.2.2.2

# Create MP-BGP, establish neighbor with PE2

sonic(config)# router bgp 300
sonic(config-router)# neighbor 4.4.4.4 remote-as 300
sonic(config-router)# neighbor 4.4.4.4 update-source 3.3.3.3
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 4.4.4.4 activate

# Create EBGP, establish neighbor with ASBR1

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 30.1.1.1 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 300:2
sonic(config-router-af)# rt vpn both 3:3
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

    4. PE2 Device Configuration

# Configure interface IP addresses and enable MPLS, create VRF1 and add Ethernet1

sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.2.2.1/24
sonic(config-if-1)# vrf 1
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 4.4.4.4/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 4.4.4.4
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.2.2.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 4.4.4.4
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.2.2.1

# Create MP-BGP, establish neighbor with ASBR2

sonic(config)# router bgp 300
sonic(config-router)# neighbor 3.3.3.3 remote-as 300
sonic(config-router)# neighbor 3.3.3.3 update-source 4.4.4.4
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 3.3.3.3 activate

# Create EBGP, establish neighbor with CE2

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.2 remote-as 103
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 300:1
sonic(config-router-af)# rt vpn both 3:3
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

    5. CE1 Device Configuration

# Configure Ethernet1 interface IP address

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.1.1.2/24

# Create EBGP, establish neighbor with PE1, and redistribute connected routes

sonic(config)# router bgp 102
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.1 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected

    6. CE2 Device Configuration

# Configure Ethernet1 interface IP address

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.2.2.2/24

# Create EBGP, establish neighbor with PE2, redistribute connected routes

sonic(config)# router bgp 103
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.1 remote-as 300
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected

MPLS L3VPN Option B Configuration

Network Requirements

configuring-mpls-l3vpn-optionb-network-requirements

Configure MPLS L3VPN Option B topology where: OSPF and LDP protocols run between PE1-ASBR1 and PE2-ASBR2; EBGP neighbors are established between PE and CE devices; MP-IBGP neighbors established between PE and ASBR devices; MP-EBGP neighbors established between ASBR devices; Enable communication between CE1 and CE2 in the same VPN.

Configuration Steps

    1. PE1 Device Configuration

# Configure interface IP addresses and enable MPLS, create VRF1 and add Ethernet1

sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# vrf 1
sonic(config-if-1)# ip address 10.1.1.1/24
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 1.1.1.1/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 1.1.1.1
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 1.1.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.1

# Create MP-BGP, establish neighbor with ASBR1

sonic(config)# router bgp 200
sonic(config-router)# neighbor 2.2.2.2 remote-as 200
sonic(config-router)# neighbor 2.2.2.2 update-source 1.1.1.1
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# no neighbor 2.2.2.2 activate
sonic(config-router-af)# exit-address-family
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 2.2.2.2 activate

# Create EBGP, establish neighbor with CE1

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.2 remote-as 102
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 200:1
sonic(config-router-af)# rt vpn both 1:1
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

    2. ASBR1 Device Configuration

# Configure interface IP addresses and enable MPLS

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.2/24
sonic(config-if-2)# mpls bgp l3vpn-multi-domain-switching
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.1/24
sonic(config-if-3)# mpls bgp l3vpn-multi-domain-switching
sonic(config-if-3)# mpls enable

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 2.2.2.2/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 2.2.2.2
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.1.1.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 2.2.2.2
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.1.1.2

# Create MP-BGP, establish neighbors with PE1 and ASBR2

sonic(config)# router bgp 200
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 1.1.1.1 remote-as 200
sonic(config-router)# neighbor 1.1.1.1 update-source 2.2.2.2
sonic(config-router)# neighbor 30.1.1.2 remote-as 300
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# no neighbor 1.1.1.1 activate
sonic(config-router-af)# no neighbor 30.1.1.2 activate
sonic(config-router-af)# exit-address-family
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 1.1.1.1 activate
sonic(config-router-af)# neighbor 1.1.1.1 next-hop-self
sonic(config-router-af)# neighbor 30.1.1.2 activate
sonic(config-router-af)# neighbor 30.1.1.2 next-hop-self
sonic(config-router-af)# exit-address-family

    3. ASBR2 Device Configuration

# Configure interface IP addresses and enable MPLS

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.2/24
sonic(config-if-2)# mpls bgp l3vpn-multi-domain-switching
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.2/24
sonic(config-if-3)# mpls bgp l3vpn-multi-domain-switching
sonic(config-if-3)# mpls enable

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 3.3.3.3/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 3.3.3.3
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.2.2.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 3.3.3.3
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.2.2.2

# Create MP-BGP, establish neighbors with PE2 and ASBR1

sonic(config)# router bgp 300
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 4.4.4.4 remote-as 300
sonic(config-router)# neighbor 4.4.4.4 update-source 3.3.3.3
sonic(config-router)# neighbor 30.1.1.1 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# no neighbor 4.4.4.4 activate
sonic(config-router-af)# no neighbor 30.1.1.1 activate
sonic(config-router-af)# exit-address-family
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 4.4.4.4 activate
sonic(config-router-af)# neighbor 4.4.4.4 next-hop-self
sonic(config-router-af)# neighbor 30.1.1.1 activate
sonic(config-router-af)# neighbor 30.1.1.1 next-hop-self
sonic(config-router-af)# exit-address-family

    4. PE2 Device Configuration

# Configure interface IP addresses and enable MPLS, create VRF1 and add Ethernet1

sonic(config)# vrf 1
sonic(config)# interface ethernet 1
sonic(config-if-1)# vrf 1
sonic(config-if-1)# ip address 10.2.2.1/24
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.1/24
sonic(config-if-2)# mpls enable
sonic(config-if-2)# mpls ldp

# Establish OSPF session

sonic(config)# interface loopback 1
sonic(config-if-lo1)# ip address 4.4.4.4/32
sonic(config)# router ospf
sonic(config-router)# ospf router-id 4.4.4.4
sonic(config-router)# redistribute connected
sonic(config-router)# network 20.2.2.0/24 area 1

# Enable LDP on Ethernet2 interface

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 4.4.4.4
sonic(config-ldp)# address-family ipv4
sonic(config-ldp-af)# discovery transport-address 20.2.2.1

# Create MP-BGP, establish neighbor with ASBR2

sonic(config)# router bgp 300
sonic(config-router)# neighbor 3.3.3.3 remote-as 300
sonic(config-router)# neighbor 3.3.3.3 update-source 4.4.4.4
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# no neighbor 3.3.3.3 activate
sonic(config-router-af)# exit-address-family
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 3.3.3.3 activate

# Create EBGP, establish neighbor with CE2

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.2 remote-as 103
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 300:1
sonic(config-router-af)# rt vpn both 1:1
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

    5. CE1 Device Configuration

# Configure Ethernet1 interface IP address

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.1.1.2/24

# Create EBGP, establish neighbor with PE1, redistribute connected routes

sonic(config)# router bgp 102
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.1 remote-as 200
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected

    6. Device CE2 Configuration

# Configure Ethernet1 interface IP address

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.2.2.2/24

# Create EBGP, establish neighbor with PE2, redistribute connected routes

sonic(config)# router bgp 103
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.1 remote-as 300
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# redistribute connected