
| #configure terminal | Enter configuration mode. | 
| (config)#interface lo | Specify the loopback (lo) interface to be configured. | 
| (config-if)#ip address 1.1.1.1/32 secondary | Set the IP address of the loopback interface to 1.1.1.1/32 | 
| (config-if)#exit | Exit interface mode. | 
| (config)#ip vrf l3vpn | Configure IP VRF L3VPN. | 
| (config-vrf)#rd 1:300 | Enter RD value. | 
| (config-vrf)#route-target both 300:400 | Enter RT value. | 
| (config-vrf)#exit | Exiting from VRF mode. | 
| (config)#router ldp  | Enter router mode for LDP. | 
| (config-router)#router-id 1.1.1.1  | Set the router ID to IP address 1.1.1.1. | 
| (config-router)#targeted-peer ipv4 2.2.2.2 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted- peer-mode | Exit-targeted-peer-mode | 
| (config-router)#targeted-peer ipv4 5.5.5.5 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted- peer-mode | Exit-targeted-peer-mode | 
| (config-router)#exit  | Exit router mode | 
| (config)#interface xe1 | Enter interface mode. | 
| (config-if)#ip address 10.10.10.1/24 | Configure IPv4 address for xe1. | 
| (config-if)#label-switching | Enable label switching on interface xe1. | 
| (config-if)#enable-ldp ipv4  | Enable LDP for IPv4 on xe1.  | 
| (config-if)#exit  | Exit interface mode | 
| (config)#interface xe2.1 | Configure access-port . | 
| (config-if)#description MPLS-L3VPN | Giving Interface Description | 
| (config-if)#encapsulation dot1q 4 | Setting Encapsulation to dot1q with VLAN ID 4 | 
| (config-if)#load-interval 30 | Load interval setting | 
| (config-if)#ip vrf forwarding l3vpn | Bind the interface connected to the CE router with VRF l3vpn | 
| (config-if)#ip address 172.168.25.2/24 | Assign the IPv4 address. | 
| (config)#router ospf 1  | Configure the routing process and specify the Process ID  100. The Process ID should be a unique positive integer identifying the routing process. | 
| (config)#ospf router-id 1.1.1.1 | Configure OSPF router-ID same as loopback interface IP address | 
| (config-router) #network 1.1.1.1/32 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-router) #network 10.10.10.0/24 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-if)#exit | Exit interface mode. | 
| (config)#router bgp 100 | Enter router BGP mode | 
| (config-router)#bgp router-id 1.1.1.1 | Configuring the BGP router id 1.1.1.1. | 
| (config-router)#bgp graceful-restart restart-time 100 | Enable BGP GR with restart timer 100. | 
| (config-router)#neighbor 5.5.5.5 remote-as 100 | Configure neighbor 5.5.5.5. | 
| (config-router)#neighbor 5.5.5.5 update-source lo | Update source lo for neighbor 5.5.5.5. | 
| (config-router)#address-family ipv4 unicast | Enter address-family IPv4 unicast. | 
| (config-router-af)#redistribute connected | Redistribute connected. | 
| (config-router)#neighbor 5.5.5.5 activate | Activate neighbor. | 
| (config-router)#address-family vpnv4 unicast | Entering Address family VPNv4 unicast. | 
| (config-router-af)#neighbor 5.5.5.5 activate | Activate the neighbor 5.5.5.5. | 
| (config-router-af)#neighbor 5.5.5.5 capability graceful-restart | Activate capability graceful restart for neighbor 5.5.5.5. | 
| (config-router-af)#exit-address-family | Exit address family. | 
| (config-router)#address-family ipv4 vrf l3vpn | Entering address family. | 
| (config-router-af)#redistribute connected | Redistribute connected. | 
| (config-router)#neighbor 172.168.25.1 remote-as 600 | Configure neighbor 172.168.25.1. | 
| (config-router)#neighbor 172.168.25.1 activate | Activate neighbor. | 
| (config-router-af)#commit | Commit all the transactions. | 
| #configure terminal | Enter configuration mode. | 
| (config)#interface lo | Specify the loopback (lo) interface to be configured. | 
| (config-if)#ip address 2.2.2.2/32 secondary | Set the IP address of the loopback interface to 2.2.2.2/32. | 
| (config-if)#exit | Exit interface mode. | 
| (config)#router ldp  | Enter router mode for LDP. | 
| (config-router)#router-id 2.2.2.2  | Set the router ID to IP address 2.2.2.2. | 
| (config-router)#transport-address ipv4 2.2.2.2 0 | Configure the transport address for IPV4 (for IPV6, use ipv6) to be used for a TCP session over which LDP will run.  | 
| Note:  | It is preferable to use the loopback address as the transport address. | 
| (config-router)#targeted-peer ipv4 1.1.1.1 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted- peer-mode | Exit-targeted-peer-mode. | 
| (config-router)#targeted-peer ipv4 5.5.5.5 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted- peer-mode | Exit-targeted-peer-mode. | 
| (config-router)#exit | Exit-targeted-peer-mode. | 
| (config-if)#exit | Exit router mode. | 
| (config)#interface xe1 | Enter interface mode. | 
| (config-if)#ip address 10.10.10.2/24 | Configure IPv4 address for xe1. | 
| (config-if)#label-switching | Enable label switching on interface xe1. | 
| (config-if)#enable-ldp ipv4 | Enable LDP for IPv4 on xe1.  | 
| (config-if)#exit  | Exit interface mode. | 
| (config)#interface xe2 | Enter interface mode. | 
| (config-if)#ip address 40.40.40.1/24 | Configure IPv4 address for xe2. | 
| (config-if)#label-switching | Enable label switching on interface xe2. | 
| (config-if)#enable-ldp ipv4 | Enable LDP for IPv4 on xe2.  | 
| (config-if)#exit | Exit interface mode. | 
| (config)#router ospf 1 | Configure the routing process and specify the Process ID. The Process ID should be a unique positive integer identifying the routing process. | 
| (config)#ospf router-id 2.2.2.2 | Configure OSPF router-ID same as loopback interface IP address. | 
| (config-router) #network 2.2.2.2/32 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-router) #network 10.10.10.0/24 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-router)#network 40.40.40.0/24 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-router)#bfd all-interfaces | Enable the OSPF enabled interfaces with BFD. | 
| (config-if)#exit | Exit interface mode. | 
| #configure terminal | Enter configuration mode. | 
| (config)#interface lo | Specify the loopback (lo) interface to be configured. | 
| (config-if)#ip address 5.5.5.5/32 secondary | Set the IP address of the loopback interface to 5.5.5.5/32. | 
| (config-if)#exit | Exit interface mode. | 
| (config)#ip vrf l3vpn | Configure IP VRF L3VPN. | 
| (config-vrf)#rd 1:300 | Enter RD value. | 
| (config-vrf)#route-target both 300:400 | Enter RT value. | 
| (config-vrf)#exit | Exiting from VRF mode. | 
| (config)#router ldp  | Enter router mode for LDP. | 
| (config-router)#router-id 5.5.5.5  | Set the router ID to IP address 5.5.5.5. | 
| (config-router)#targeted-peer ipv4 1.1.1.1 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted- peer-mode | Exit-targeted-peer-mode. | 
| (config-router)#targeted-peer ipv4 2.2.2.2 | Configure targeted peer. | 
| (config-router-targeted-peer)#exit-targeted-peer-mode | Exit-targeted-peer-mode. | 
| (config-router)#exit  | Exit router mode. | 
| (config)#interface xe1 | Enter interface mode. | 
| (config-if)#ip address 40.40.40.2/24 | Configure IPv4 address for xe1. | 
| (config-if)#label-switching | Enable label switching on interface xe1. | 
| (config-if)#enable-ldp ipv4  | Enable LDP for IPv4 on xe1.  | 
| (config-if)#exit | Exit interface mode. | 
| (config-if)#exit | Exit interface mode. | 
| (config)#interface xe2.1 | Enter interface mode. | 
| (config-if)#description MPLS-L3VPN | Giving Interface Description. | 
| (config-if)#encapsulation dot1q 4 | Setting Encapsulation to dot1q with VLAN ID 4. | 
| (config-if)#load-interval 30 | Load interval setting. | 
| (config-if)#ip vrf forwarding l3vpn | Bind the interface connected to the CE router with VRF L3VPN. | 
| (config-if)#ip address 172.168.25.2/24 | Assign the IPv4 address. | 
| (config)#router ospf 1 | The Process ID should be a unique positive integer identifying the routing process. | 
| (config)#ospf router-id 5.5.5.5 | Configure OSPF router-ID same as loopback interface IP address. | 
| (config-router) #network 5.5.5.5/32 area 0 | Define the interface on which OSPF runs and associate the  area ID (0) with the interface. | 
| (config-router) #network 40.40.40.0/24 area 0 | Define the interface on which OSPF runs and associate the area ID (0) with the interface. | 
| (config-if)#exit | Exit interface mode. | 
| (config)#router bgp 100 | Enter router BGP mode | 
| (config-router)#bgp router-id 5.5.5.5 | Configuring the bgp router id 1.1.1.1. | 
| (config-router)#bgp graceful-restart restart-time 100 | Enable BGP GR with restart timer 100. | 
| (config-router)#neighbor 1.1.1.1 remote-as 100 | Configure neighbor 1.1.1.1. | 
| (config-router)#neighbor 1.1.1.1 update-source lo | Update source lo for neighbor 1.1.1.1. | 
| (config-router)#address-family ipv4 unicast | Enter address-family ipv4 unicast. | 
| (config-router-af)#redistribute connected | Redistribute connected. | 
| (config-router)#neighbor 1.1.1.1 activate | Activate neighbor. | 
| (config-router)#address-family vpnv4 unicast | Entering Address family VPNv4 unicast. | 
| (config-router-af)#neighbor 1.1.1.1 activate | Activate the neighbor 1.1.1.1. | 
| (config-router-af)#neighbor 1.1.1.1 capability graceful-restart | Activate capability graceful restart for neighbor 1.1.1.1. | 
| (config-router-af)#exit-address-family | Exit address family. | 
| (config-router)#address-family ipv4 vrf l3vpn | Entering address family. | 
| (config-router-af)#redistribute connected | Redistribute connected. | 
| (config-router)#neighbor 172.168.26.1 remote-as 700 | Configure neighbor 172.168.26.1. | 
| (config-router)#neighbor 172.168.26.1 activate | Activate neighbor. | 
| (config-router-af)#commit | Commit all the transactions. |