Configuring a BGP PW
Network requirements
Create a BGP PW between PE 1 and PE 2 so VLAN 10 on CE 1 can communicate with VLAN 10 on CE 2.
Figure 74: Network diagram
Table 23: Interface and IP address assignment
Device | Interface | IP address | Device | Interface | IP address |
---|---|---|---|---|---|
PE 1 | Loop0 | 192.2.2.2/32 | P | Loop0 | 192.4.4.4/32 |
Vlan-int20 | 10.1.1.1/24 | Vlan-int20 | 10.1.1.2/24 | ||
PE 2 | Loop0 | 192.3.3.3/32 | Vlan-int30 | 10.2.2.2/24 | |
Vlan-int30 | 10.2.2.1/24 |
Configuration procedure
Before you perform the following configurations, configure VLANs and add ports to VLANs on switches.
Configure CE 1.
<CE1> system-view [CE1] interface ten-gigabitethernet 1/0/1 [CE1-Ten-GigabitEthernet1/0/1] port link-type trunk [CE1-Ten-GigabitEthernet1/0/1] port trunk permit vlan 10 [CE1-Ten-GigabitEthernet1/0/1] quit
Configure PE 1:
# Configure an LSR ID.
<PE1> system-view [PE1] interface loopback 0 [PE1-LoopBack0] ip address 192.2.2.2 32 [PE1-LoopBack0] quit [PE1] mpls lsr-id 192.2.2.2
# Enable L2VPN.
[PE1] l2vpn enable
# Enable LDP globally.
[PE1] mpls ldp [PE1-ldp] quit
# Configure VLAN-interface 20 (the interface connected to P), and enable LDP on the interface.
[PE1] interface vlan-interface 20 [PE1-Vlan-interface20] ip address 10.1.1.1 24 [PE1-Vlan-interface20] mpls enable [PE1-Vlan-interface20] mpls ldp enable [PE1-Vlan-interface20] quit
# Enable OSPF for LSP establishment.
[PE1] ospf [PE1-ospf-1] area 0 [PE1-ospf-1-area-0.0.0.0] network 10.1.1.1 0.0.0.255 [PE1-ospf-1-area-0.0.0.0] network 192.2.2.2 0.0.0.0 [PE1-ospf-1-area-0.0.0.0] quit [PE1-ospf-1] quit
# Create an IBGP connection to PE 2 and enable BGP to advertise L2VPN information to PE 2.
[PE1] bgp 100 [PE1-bgp] peer 192.3.3.3 as-number 100 [PE1-bgp] peer 192.3.3.3 connect-interface loopback 0 [PE1-bgp] address-family l2vpn [PE1-bgp-l2vpn] peer 192.3.3.3 enable [PE1-bgp-l2vpn] quit [PE1-bgp] quit
# Create service instance 10 on Ten-GigabitEthernet 1/0/1 to match packets that have an outer VLAN ID of 10.
[PE1] interface ten-gigabitethernet1/0/1 [PE1-Ten-GigabitEthernet1/0/1] service-instance 10 [PE1-Ten-GigabitEthernet1/0/1-srv10] encapsulation s-vid 10 [PE1-Ten-GigabitEthernet1/0/1-srv10] quit [PE1-Ten-GigabitEthernet1/0/1] quit
# Create a cross-connect group named vpnb, create a local site named site 1, create a BGP PW from site 1 to the remote site site 2, and bind service instance 10 on Ten-GigabitEthernet 1/0/1 to the PW.
[PE1] xconnect-group vpnb [PE1-xcg-vpnb] auto-discovery bgp [PE1-xcg-vpnb-auto] route-distinguisher 2:2 [PE1-xcg-vpnb-auto] vpn-target 2:2 export-extcommunity [PE1-xcg-vpnb-auto] vpn-target 2:2 import-extcommunity [PE1-xcg-vpnb-auto] site 1 range 10 default-offset 0 [PE1-xcg-vpnb-auto-1] connection remote-site-id 2 [PE1-xcg-vpnb-auto-1-2] ac interface Ten-GigabitEthernet 1/0/1 service-instance 10 [PE1-xcg-vpnb-auto-1-2] return
Configure the P device:
# Configure an LSR ID.
<P> system-view [P] interface loopback 0 [P-LoopBack0] ip address 192.4.4.4 32 [P-LoopBack0] quit [P] mpls lsr-id 192.4.4.4
# Enable LDP globally.
[P] mpls ldp [P-ldp] quit
# Configure VLAN-interface 20 (the interface connected to PE 1), and enable LDP on the interface.
[P] interface vlan-interface 20 [P-Vlan-interface20] ip address 10.1.1.2 24 [P-Vlan-interface20] mpls enable [P-Vlan-interface20] mpls ldp enable [P-Vlan-interface20] quit
# Configure VLAN-interface 30 (the interface connected to PE 2), and enable LDP on the interface.
[P] interface vlan-interface 30 [P-Vlan-interface30] ip address 10.2.2.2 24 [P-Vlan-interface30] mpls enable [P-Vlan-interface30] mpls ldp enable [P-Vlan-interface30] quit
# Enable OSPF for LSP establishment.
[P] ospf [P-ospf-1] area 0 [P-ospf-1-area-0.0.0.0] network 10.1.1.2 0.0.0.255 [P-ospf-1-area-0.0.0.0] network 10.2.2.2 0.0.0.255 [P-ospf-1-area-0.0.0.0] network 192.4.4.4 0.0.0.0 [P-ospf-1-area-0.0.0.0] quit [P-ospf-1] quit
Configure PE 2:
# Configure an LSR ID.
<PE2> system-view [PE2] interface loopback 0 [PE2-LoopBack0] ip address 192.3.3.3 32 [PE2-LoopBack0] quit [PE2] mpls lsr-id 192.3.3.3
# Enable L2VPN.
[PE2] l2vpn enable
# Enable LDP globally.
[PE2] mpls ldp [PE2-ldp] quit
# Configure VLAN-interface 30 (the interface connected to P), and enable LDP on the interface.
[PE2] interface vlan-interface 30 [PE2-Vlan-interface30] ip address 10.2.2.1 24 [PE2-Vlan-interface30] mpls enable [PE2-Vlan-interface30] mpls ldp enable [PE2-Vlan-interface30] quit
# Enable OSPF for LSP establishment.
[PE2] ospf [PE2-ospf-1] area 0 [PE2-ospf-1-area-0.0.0.0] network 192.3.3.3 0.0.0.0 [PE2-ospf-1-area-0.0.0.0] network 10.2.2.0 0.0.0.255 [PE2-ospf-1-area-0.0.0.0] quit [PE2-ospf-1] quit
# Create an IBGP connection to PE 1, and enable BGP to advertise L2VPN information to PE 1.
[PE2] bgp 100 [PE2-bgp] peer 192.2.2.2 as-number 100 [PE2-bgp] peer 192.2.2.2 connect-interface loopback 0 [PE2-bgp] address-family l2vpn [PE2-bgp-l2vpn] peer 192.2.2.2 enable [PE2-bgp-l2vpn] quit [PE2-bgp] quit
# Create service instance 10 on Ten-GigabitEthernet 1/0/1 to match packets that have an outer VLAN ID of 20.
[PE2] interface ten-gigabitethernet1/0/1 [PE2-Ten-GigabitEthernet1/0/1] service-instance 10 [PE2-Ten-GigabitEthernet1/0/1-srv10]encapsulation s-vid 10 [PE2-Ten-GigabitEthernet1/0/1-srv10] quit [PE2-Ten-GigabitEthernet1/0/1] quit
# Create a cross-connect group named vpnb, create a local site named site 2, create a BGP PW from site 2 to the remote site site 1, and bind service instance 10 on Ten-GigabitEthernet 1/0/1 to the PW.
[PE2] xconnect-group vpnb [PE2-xcg-vpnb] auto-discovery bgp [PE2-xcg-vpnb-auto] route-distinguisher 2:2 [PE2-xcg-vpnb-auto] vpn-target 2:2 export-extcommunity [PE2-xcg-vpnb-auto] vpn-target 2:2 import-extcommunity [PE2-xcg-vpnb-auto] site 2 range 10 default-offset 0 [PE2-xcg-vpnb-auto-2] connection remote-site-id 1 [PE2-xcg-vpnb-auto-2-1] ac interface Ten-GigabitEthernet 1/0/1 service-instance 10 [PE2-xcg-vpnb-auto-2-1] return
Configure CE 2.
<CE2> system-view [CE2] interface ten-gigabitethernet 1/0/1 [CE2-Ten-GigabitEthernet1/0/1] port link-type trunk [CE2-Ten-GigabitEthernet1/0/1] port trunk permit vlan 10 [CE2-Ten-GigabitEthernet1/0/1] quit
Verifying the configuration
# Display L2VPN PW information on PE 1. The output shows that a PW has been established.
<PE1> display l2vpn pw Flags: M - main, B - backup, H - hub link, S - spoke link, N - no split horizon Total number of PWs: 1, 1 up, 0 blocked, 0 down, 0 defect Xconnect-group Name: vpnb Peer PW ID/Rmt Site In/Out Label Proto Flag Link ID State 192.3.3.3 2 65636/65625 BGP M 1 Up
# Display L2VPN PW information on PE 2. The output shows that a PW has been established.
<PE2> display l2vpn pw Flags: M - main, B - backup, H - hub link, S - spoke link, N - no split horizon Total number of PWs: 1, 1 up, 0 blocked, 0 down, 0 defect Xconnect-group Name: vpnb Peer PW ID/Rmt Site In/Out Label Proto Flag Link ID State 192.2.2.2 1 65625/65636 BGP M 1 Up
# Verify that CE 1 and CE 2 can ping each other. (Details not shown.)