图一拓扑图
一、实验目的
1.配置BGP/MPLS 虚拟专用网络 Option B
二、BGP/MPLS 虚拟专用网络 Option B
1.底层路由协议可以配置为OSPF、ISIS等
2.利用MPLS为每条路由或每个实例分配一个标签,进行数据包的传输
3.利用BGP VPNv4传递私网路由
4.ASBR之间相连的接口,使能MPLS功能
5.ASBR之间建立BGP VPNv4关系
三、简单配置
1.CE_1
sysname CE_1
#
interface GigabitEthernet0/0/0
ip address 10.0.12.1 255.255.255.0
#
interface LoopBack1
ip address 1.1.1.1 255.255.255.255
#
ospf 1
area 0.0.0.0
network 1.1.1.1 0.0.0.0
network 10.0.12.0 0.0.0.255
#
return
2.CE_2
sysname CE_2
#
interface GigabitEthernet0/0/0
ip address 10.0.22.1 255.255.255.0
#
interface LoopBack1
ip address 9.9.9.9 255.255.255.255
#
ospf 1
area 0.0.0.0
network 9.9.9.9 0.0.0.0
network 10.0.22.0 0.0.0.255
#
return
3.PE_1
sysname PE_1
#
ip vpn-instance vpna
ipv4-family
route-distinguisher 1:1
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
ip vpn-instance vpnb
ipv4-family
route-distinguisher 2:1
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip binding vpn-instance vpna
ip address 10.0.12.2 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.13.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet2/0/0
ip binding vpn-instance vpnb
ip address 10.0.22.2 255.255.255.0
#
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 4.4.4.4 enable
#
ipv4-family vpnv4
policy vpn-target
peer 4.4.4.4 enable
#
ipv4-family vpn-instance vpna
import-route ospf 2
#
ipv4-family vpn-instance vpnb
import-route ospf 3
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 10.0.13.0 0.0.0.255
#
ospf 2 vpn-instance vpna
import-route bgp
area 0.0.0.0
network 10.0.12.0 0.0.0.255
#
ospf 3 vpn-instance vpnb
import-route bgp
area 0.0.0.0
network 10.0.22.0 0.0.0.255
#
return
4.P_1
sysname P_1
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip address 10.0.14.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 10.0.13.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack3
ip address 3.3.3.3 255.255.255.255
#
ospf 1
area 0.0.0.0
network 3.3.3.3 0.0.0.0
network 10.0.13.0 0.0.0.255
network 10.0.14.0 0.0.0.255
#
return
5.ASBR_PE1
sysname ASBR_PE1
#
ip vpn-instance vpna
ipv4-family
route-distinguisher 1:3
vpn-target 1:1 export-extcommunity
vpn-target 1:1 2:2 import-extcommunity
#
mpls lsr-id 4.4.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip address 10.0.14.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 10.0.15.1 255.255.255.0
mpls
#
interface LoopBack1
ip address 4.4.4.4 255.255.255.255
#
bgp 100
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
peer 10.0.15.2 as-number 200
#
ipv4-family unicast
undo synchronization
peer 2.2.2.2 enable
peer 10.0.15.2 enable
#
ipv4-family vpnv4
undo policy vpn-target
peer 2.2.2.2 enable
peer 10.0.15.2 enable
#
ospf 1
area 0.0.0.0
network 4.4.4.4 0.0.0.0
network 10.0.14.0 0.0.0.255
#
return
6.ASBR_PE2
sysname ASBR_PE2
#
ip vpn-instance vpna
ipv4-family
route-distinguisher 1:4
vpn-target 1:1 export-extcommunity
vpn-target 1:1 2:2 import-extcommunity
#
ip vpn-instance vpnb
#
mpls lsr-id 5.5.5.5
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip address 10.0.16.1 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 10.0.15.2 255.255.255.0
mpls
#
interface LoopBack1
ip address 5.5.5.5 255.255.255.255
#
bgp 200
peer 7.7.7.7 as-number 200
peer 7.7.7.7 connect-interface LoopBack1
peer 10.0.15.1 as-number 100
#
ipv4-family unicast
undo synchronization
peer 7.7.7.7 enable
peer 10.0.15.1 enable
#
ipv4-family vpnv4
undo policy vpn-target
peer 7.7.7.7 enable
peer 10.0.15.1 enable
#
ospf 1
area 0.0.0.0
network 5.5.5.5 0.0.0.0
network 10.0.16.0 0.0.0.255
#
return
7.P_2
sysname P_2
#
mpls lsr-id 6.6.6.6
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip address 10.0.16.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet0/0/1
ip address 10.0.17.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 6.6.6.6 255.255.255.255
#
ospf 1
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 10.0.16.0 0.0.0.255
network 10.0.17.0 0.0.0.255
#
return
8.PE_2
sysname PE_2
#
ip vpn-instance vpna
ipv4-family
route-distinguisher 1:2
vpn-target 1:1 export-extcommunity
vpn-target 1:1 import-extcommunity
#
ip vpn-instance vpnb
ipv4-family
route-distinguisher 2:2
vpn-target 2:2 export-extcommunity
vpn-target 2:2 import-extcommunity
#
mpls lsr-id 7.7.7.7
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
ip binding vpn-instance vpna
ip address 10.0.18.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 10.0.17.2 255.255.255.0
mpls
mpls ldp
#
interface GigabitEthernet2/0/0
ip binding vpn-instance vpnb
ip address 10.0.23.2 255.255.255.0
#
interface LoopBack1
ip address 7.7.7.7 255.255.255.255
#
bgp 200
peer 5.5.5.5 as-number 200
peer 5.5.5.5 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
peer 5.5.5.5 enable
#
ipv4-family vpnv4
policy vpn-target
peer 5.5.5.5 enable
#
ipv4-family vpn-instance vpna
import-route ospf 2
#
ipv4-family vpn-instance vpnb
import-route ospf 3
#
ospf 1
area 0.0.0.0
network 7.7.7.7 0.0.0.0
network 10.0.17.0 0.0.0.255
#
ospf 2 vpn-instance vpna
import-route bgp
area 0.0.0.0
network 10.0.18.0 0.0.0.255
#
ospf 3 vpn-instance vpnb
import-route bgp
area 0.0.0.0
network 10.0.23.0 0.0.0.255
#
return
9.CE_3
sysname CE_3
#
interface GigabitEthernet0/0/0
ip address 10.0.18.2 255.255.255.0
#
interface LoopBack1
ip address 8.8.8.8 255.255.255.255
#
ospf 1
area 0.0.0.0
network 8.8.8.8 0.0.0.0
network 10.0.18.0 0.0.0.255
#
return
10.CE_4
sysname CE_4
#
interface GigabitEthernet0/0/0
ip address 10.0.23.1 255.255.255.0
#
interface LoopBack1
ip address 10.10.10.10 255.255.255.255
#
ospf 1
area 0.0.0.0
network 10.0.23.0 0.0.0.255
network 10.10.10.10 0.0.0.0
#
return