Skip to content
Ask AI

MPLS Configuration

MPLS (Multiprotocol Label Switching) is an IP (Internet Protocol) backbone network technology. MPLS introduces the concept of connection oriented label switching on connectionless IP networks, combining layer 3 routing technology with layer 2 switching technology, fully leveraging the flexibility of IP routing and the simplicity of layer 2 switching. Not only does it support multiple high-level protocols and services, but it can also ensure the security of information transmission to a certain extent.

Networking Requirements

In this network, only MPLS’s static LSP is used, allowing CE1 and CE2 to communicate with each other. Therefore, it is necessary to configure LSP1 from PE1 to PE2, and P2 to display empty tags using PHP; Configure LSP2 from PE2 to PE1, P1 using PHP implicit null tags.

Configuration Steps

1. Device PE1 configuration

# Configure IP address for interface

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

# Configure LSP1: Route labeled 50 to 20.1.1.0/24

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

2. Device P1 configuration

# Configure IP addresses for Ethernet1 and Ethernet2 respectively

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

# Configure LSP1: Route with inbound label of 50 and outbound label of 60

sonic(config)# mpls lsp 50 14.14.14.2 60

# Configure LSP2: Enter the route with label 80 and strip off the label

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

3. Device P2 configuration

# Configure IP addresses for Ethernet1 and Ethernet2 respectively

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

# Configure LSP1: Route with inbound label of 60 and outbound label of 0

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

# Configure LSP2: Route with inbound label of 70 and outbound label of 80

sonic(config)# mpls lsp 70 14.14.14.1 80

4. Device PE2 configuration

# Configure IP addresses for Ethernet1 and Ethernet3 respectively

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

# Configure LSP1: Route labeled 70 to 10.1.1.0/24

sonic(config)# ip route 10.1.1.0/24 16.16.16.1 label 70

5. Device CE1 configuration interface IP address and routing

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 10.1.1.1/24
sonic(config)# ip route 20.1.1.0/24 10.1.1.254

6. Equipment CE2 configuration interface IP address and routing

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 20.1.1.1/24
sonic(config)# ip route 10.1.1.0/24 20.1.1.254

1. View the route on PE1 with the purpose of the 20.1.1.1/24 network segment and label it as 50.

2. When viewing the MPLS table on P1, it can be seen that when in_1abel is 50, it needs to be modified to label 60; When the inlabel is 80, the label needs to be peeled off.

3. When viewing the MPLS table on P1, it can be seen that when in1abel is 60, it needs to be modified to label 0; When in1abel is 70, it needs to be modified to label 80.

4. Check the route on PE2 for the 10.1.1.1/24 network segment and label it as 70.

5. CE1 and CE2 can communicate with each other.

Networking Requirements

In this network, OSPF and LDP protocols run between the backbone networks PE1-P-PE2; Run MP-BGP protocol on PE1 and PE2 to transmit VPN routes; Afterwards, the EBGP protocol is run between PE1 and CE1, PE2 and CE2 respectively, ultimately achieving mutual communication between the same VPN CE1 and CE2.

Configuration Steps

1. Device PE1 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet1 interface

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

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with PE2

sonic(config)# router bgp 200
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 3.3.3.3 remote-as 200
sonic(config-router)# neighbor 3.3.3.3 update-source 1.1.1.1
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 3.3.3.3 activate

# Create EBGP and establish neighbors with CE1

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.1.1.1 activate
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

2. Device P Configuration

# Interface configuration IP address

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

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2
sonic(config-ldp-af-if)# exit
sonic(config-ldp-af)# interface ethernet 3

3. Device PE2 Configuration

# Configure the IP address for the interface, create VRF1, and add the interface to it

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

# 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 30.1.1.0/24 area 1

# Enable LDP function

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 30.1.1.1
sonic(config-ldp-af)# interface ethernet 3

# Create MP-BGP and establish neighbors with PE1

sonic(config)# router bgp 200
sonic(config-router)# no bgp default ipv4-unicast
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 3.3.3.3
sonic(config-router)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 1.1.1.1 activate

# Create EBGP and establish neighbors with CE2

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.2.2.1 activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# label vpn export auto
sonic(config-router-af)# rd vpn export 3.3.3.3:2
sonic(config-router-af)# rt vpn both 200:2
sonic(config-router-af)# export vpn
sonic(config-router-af)# import vpn

4. Device CE1 Configuration

# Interface IP address configuration

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

# Create EBGP, establish neighbors with PE1, and introduce direct routing

sonic(config)# router bgp 100
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.1.1.2 activate
sonic(config-router-af)# redistribute connected

5. Device CE2 Configuration

# Interface IP address configuration

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

# Create EBGP, establish neighbors with PE2, and introduce direct routing

sonic(config)# router bgp 300
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.2.2.2 activate
sonic(config-router-af)# redistribute connected

1. PE1 and PE2 establish an MP-BGP neighbor relationship, exchange VPN routes, and CE1 and CE2 routes are reachable.

2. CE1 and CE2 can communicate with each other.

Networking Requirements

In this network, PE1, P, PE2, and PE3 all run OSPF and LDP protocols. Then, VPLS type L2VPNs are configured in PE1, PE2, and PE3 respectively, and LDP is used to generate labels, ultimately achieving mutual communication among the same layer 2 VPN PC1, PC2, and PC3.

Configuration Steps

1. Device PE1 Configuration

# Interface IP address configuration

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

#Create VLAN as the AC interface for L2VPN and add the 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 function

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 PW

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. Device P Configuration

# Interface IP address configuration

sonic(config)# interface ethernet 1
sonic(config-if-1)# ip address 12.12.12.2/24
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.2/24
sonic(config)# interface ethernet 3
sonic(config-if-3)# ip address 16.16.16.2/24

# 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 function

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

3. Device PE2 Configuration

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

sonic(config)# vlan 100
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.1/24
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 function

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 PW

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

4. Device PE3 Configuration

#Create VLAN as the AC interface for L2VPN and add the 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)# 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 function

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-pw)# member interface vlan 100
sonic(config-pw)# member pseudowire pw13
sonic(config-pw)# member pseudowire pw23

Verification

1. Device P establishes LDP neighbor relationships with PE1 and PE2 respectively.

2. Establish LDP neighbor relationship between devices PE1 and PE2.

3. PC1, PC2, and PC3 can communicate with each other.

Networking Requirements

In this network, OSPF and LDP protocols are run between PE1, P, and PE2. VPWS type L2VPN is configured on PE1 and PE2, and LDP is used to generate labels, ultimately achieving communication between PC1 and PC2 of the same layer 2 VPN.

Configuration Steps

1. Device PE1 Configuration

#Interface IP address configuration

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

# 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 function

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)# interface ethernet 1

# Create PW

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

# Create a 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

2. Device P Configuration

# Interface IP address configuration

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

# 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 function

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)# interface ethernet 1
sonic(config-ldp-af-if)# exit
sonic(config-ldp-af)# interface ethernet 2

3. Device PE2 Configuration

# Interface IP address configuration

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 14.14.14.1/24

# 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 function

sonic(config)# mpls ldp
sonic(config-ldp)# router-id 100.3.1.1
sonic(config-ldp)# address-family ipv4
sonic(config-ldp)# discovery transport-address 100.3.1.1
sonic(config-ldp-af)# interface ethernet 2

# Create PW

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

# Create a 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

Verification

1. Device P establishes LDP neighbor relationships with PE1 and PE2 respectively.

2. Establish LDP neighbor relationship between devices PE1 and PE2.

3. PC1 and PC2 can communicate with each other.

Exampleof MPLS L3VPN OptionA Configuration

Section titled “Exampleof MPLS L3VPN OptionA Configuration”

Networking Requirements

In this network, the interfaces interconnecting two ASBRs, as well as CE1 and CE2, belong to the same VPN; Run OSPF and LDP protocols between PE1, ASBR1 and PE2, ASBR2 respectively, and then establish EBGP neighbors between PE and CE, as well as between two ASBRs; Establish MP-IBGP neighbors between PE and ASBR, ultimately achieving mutual communication between CE1 and CE2.

Configuration Steps

1. Device PE1 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet1 interface

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

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with ASBR1

sonic(config)# router bgp 200
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
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 neighbors with CE1

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.2 remote-as 101
sonic(config-router)# neighbor 10.1.1.2 update-source 10.1.1.1
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 10.1.1.2 activate
sonic(config-router-af)# redistribute connected
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. Device ASBR1 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet3 interface

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.1.1.2/24
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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with PE1

sonic(config)# router bgp 200
sonic(config-router)# no bgp default ipv4-unicast
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)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 1.1.1.1 activate

# Create EBGP and establish neighbors with ASBR2

sonic(config)# router bgp 200 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 30.1.1.2 remote-as 300
sonic(config-router)# neighbor 30.1.1.2 ebgp-multihop 10
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 30.1.1.2 activate
sonic(config-router-af)# redistribute connected
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. Device ASBR2 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet3 interface

sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.2/24
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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with PE2

sonic(config)# router bgp 300
sonic(config-router)# no bgp default ipv4-unicast
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)# address-family ipv4 vpn
sonic(config-router-af)# neighbor 4.4.4.4 activate

# Create EBGP and establish neighbors with ASBR1

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 30.1.1.1 remote-as 200
sonic(config-router)# neighbor 30.1.1.1 ebgp-multihop 10
sonic(config-router)# neighbor 30.1.1.1 update-source 30.1.1.2
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 30.1.1.1 activate
sonic(config-router-af)# redistribute connected
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. Device PE2 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet1 interface

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

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create EBGP and establish neighbors with ASBR2

sonic(config)# router bgp 300
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
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 and establish neighbors with CE2

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.2 remote-as 102
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 10.2.2.2 activate
sonic(config-router-af)# redistribute connected
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 Configuration

# Configure interface Ethernet1 IP address

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

# Create EBGP, establish neighbors with PE1, and introduce direct routing

sonic(config)# router bgp 101
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.1.1.1 activate
sonic(config-router-af)# redistribute connected

6. CE2 Configuration

# Configure interface Ethernet1 IP address

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

# Create EBGP, establish neighbors with PE2, and introduce direct routing

sonic(config)# router bgp 102
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 10.2.2.1 activate
sonic(config-router-af)# redistribute connected

Verification

1. PE and ASBR establish an MP-BGP neighbor relationship, transfer VPN routes to each other, establish EBGP between ASBRs, and CE1 and CE2 routes are reachable.

2. CE1 and CE2 can communicate with each other.

Example of MPLS L3VPN OptionB Configuration

Section titled “Example of MPLS L3VPN OptionB Configuration”

Networking Requirements

In this network, OSPF and LDP protocols are run between PE1, ASBR1 and PE2, ASBR2 respectively; Further establish EBGP neighbors between PE and CE, MP-IBGP neighbors between PE and ASBR, and MP-EBGP neighbors between two ASBRs, ultimately enabling CE1 and CE2 of the same VPN to communicate with each other.

Configuration Steps

1. PE1 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet1 interface

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

# 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 function

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 neighbors 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 and establish neighbors with CE1

sonic(config-router)# router bgp 200 vrf 1
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.2 remote-as 101
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 Configuration

# Configure interface IP address

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)# interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.1/24
sonic(config-if-3)# mpls bgp l3vpn-multi-domain-switching

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with PE1

sonic(config)# router bgp 200
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 30.1.1.2 ebgp-multihop 10
sonic(config-router)# neighbor 30.1.1.2 update-source 30.1.1.1
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

3. ASBR2 Configuration

# Configure interface IP address

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)#interface ethernet 3
sonic(config-if-3)# ip address 30.1.1.2/24
sonic(config-if-3)# mpls bgp l3vpn-multi-domain-switching

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with PE2

sonic(config)# router bgp 300
sonic(config-router)# no bgp default ipv4-unicast
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)# neighbor 30.1.1.1 ebgp-multihop 10
sonic(config-router)# neighbor 30.1.1.1 update-source 30.1.1.2
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

4. PE2 Configuration

# Configure the IP address for the interface, create VRF1, and add the Ethernet1 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.1/24
sonic(config)# interface ethernet 2
sonic(config-if-2)# ip address 20.2.2.1/24

# 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 function

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
sonic(config-ldp-af)# interface ethernet 2

# Create MP-BGP and establish neighbors with ASBR2

sonic(config)# router bgp 300
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
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 and establish neighbors with CE2

sonic(config)# router bgp 300 vrf 1
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-req exituires-policy
sonic(config-router)# neighbor 10.2.2.2 remote-as 102
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 10.2.2.2 activate
sonic(config-router-af)# redistribute connected
sonic(config-router-af)# label vpn export 300
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 Configuration

# Configure interface Ethernet1 IP address

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

# Create EBGP, establish neighbors with PE1, and introduce direct routing

sonic(config)# router bgp 101
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.1.1.1 remote-as 200
sonic(config-router)# neighbor 10.1.1.1 update-source 10.1.1.2
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 10.1.1.1 activate
sonic(config-router-af)# redistribute connected

6. CE2 Configuration

# Configure interface Ethernet1 IP address

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

# Create EBGP, establish neighbors with PE2, and introduce direct routing

sonic(config)# router bgp 102
sonic(config-router)# no bgp default ipv4-unicast
sonic(config-router)# no bgp ebgp-requires-policy
sonic(config-router)# neighbor 10.2.2.1 remote-as 300
sonic(config-router)# neighbor 10.2.2.1 update-source 10.2.2.2
sonic(config-router)# address-family ipv4 unicast
sonic(config-router-af)# neighbor 10.2.2.1 activate
sonic(config-router-af)# redistribute connected

Verification

1. PE and ASBR establish an MP-BGP neighbor relationship, and ASBR establish MP-BGP to transfer VPN routes to each other. CE1 and CE2 routes can reach.

2. CE1 and CE2 can communicate with each other.