334
[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 VLAN 10 and assign GigabitEthernet 1/0/1 to the VLAN.
[PE2] vlan 10
[PE2-vlan10] port gigabitethernet 1/0/1
[PE2-vlan10] quit
# Create Ethernet service instance 10 on GigabitEthernet 1/0/1 to match packets that have an
outer VLAN ID of 20.
[PE2] interface gigabitethernet1/0/1
[PE2-GigabitEthernet1/0/1] service-instance 10
[PE2-GigabitEthernet1/0/1-srv10]encapsulation s-vid 10
[PE2-GigabitEthernet1/0/1-srv10] quit
[PE2-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 Ethernet service instance 10 on
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