348
# 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 VLAN 10 and assign Ten-GigabitEthernet 1/0/1 to the VLAN.
[PE1] vlan 10
[PE1-vlan10] port ten-gigabitethernet 1/0/1
[PE1-vlan10] quit
# Create Ethernet service instance 10 on Ten-GigabitEthernet 1/0/1 to match packets that have
an outer VLAN ID of 10.
[PE1] interface ten-gigabitethernet 1/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 Ethernet 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