MPLS Configuration
67 min
\<font color="#1d50a2">introduction\</font> 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 \<font color="#1d50a2">configuration example\</font> \<font color="#1d50a2">example of mpls static lsp configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2"> \</font> 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 \<font color="#1d50a2">example of mpls l3vpn configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2">configuration steps\</font> 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 \<font color="#1d50a2"> \</font> 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 \<font color="#1d50a2">example of mpls l2vpn vpls configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2">configuration steps\</font> 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 \<font color="#1d50a2">verification\</font> 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 \<font color="#1d50a2">example of mpls l2vpn vpws configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2">configuration steps\</font> 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 \<font color="#1d50a2">verification\</font> 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 \<font color="#1d50a2">exampleof mpls l3vpn optiona configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2">configuration steps\</font> 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 \<font color="#1d50a2">verification\</font> 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 \<font color="#1d50a2">example of mpls l3vpn optionb configuration\</font> \<font color="#1d50a2">networking requirements\</font> 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 \<font color="#1d50a2">configuration steps\</font> 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 \<font color="#1d50a2">verification\</font> 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
