MPLS VPN简单实例

一个简单的MPLS VPN的例子:
其中CE1和CE2的配置就不多写了。
图谱图如下:

PE1配置:

#
 sysname PE1
#
ip vpn-instance AAA
 ipv4-family
  route-distinguisher 1:1
  vpn-target 200:1 export-extcommunity
  vpn-target 100:1 import-extcommunity
#
mpls lsr-id 1.1.1.1
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance AAA
 ip address 10.0.11.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 10.0.12.1 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
 ospf network-type broadcast
#
bgp 100
 peer 3.3.3.3 as-number 100 
 peer 3.3.3.3 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 3.3.3.3 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 3.3.3.3 enable
 #
 ipv4-family vpn-instance AAA 
  import-route ospf 2
#
ospf 1 
 area 0.0.0.0 
  network 1.1.1.0 0.0.0.255 
  network 10.0.12.0 0.0.0.255 
#
ospf 2 vpn-instance AAA
 import-route bgp
 area 0.0.0.0 
  network 10.0.11.0 0.0.0.255 
#
return

P配置:

#
 sysname P
#
mpls lsr-id 2.2.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.0.12.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 10.0.23.2 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
 ospf network-type broadcast
#
ospf 1 
 area 0.0.0.0 
  network 2.2.2.0 0.0.0.255 
  network 10.0.12.0 0.0.0.255 
  network 10.0.23.0 0.0.0.255 
#
return

PE2配置:

#
 sysname PE2
#
ip vpn-instance AAA
 ipv4-family
  route-distinguisher 1:1
  vpn-target 100:1 export-extcommunity
  vpn-target 200:1 import-extcommunity
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 10.0.23.3 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance AAA
 ip address 10.0.22.3 255.255.255.0 
#
interface GigabitEthernet0/0/2
#
interface NULL0
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
 ospf network-type broadcast
#
bgp 100
 peer 1.1.1.1 as-number 100 
 peer 1.1.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 1.1.1.1 enable
 # 
 ipv4-family vpnv4
  policy vpn-target
  peer 1.1.1.1 enable
 #
 ipv4-family vpn-instance AAA 
  import-route ospf 2
#
ospf 1 
 area 0.0.0.0 
  network 3.3.3.0 0.0.0.255 
  network 10.0.23.0 0.0.0.255 
#
ospf 2 vpn-instance AAA
 import-route bgp
 area 0.0.0.0 
  network 10.0.22.0 0.0.0.255 
#
return

配置结果验证:
CE1的lo口可以PING通CE2的lo口,在P上查看display mpls ldp lsp分配标签正确,可以分配公网标签。PE1和PE2上MP-BGP建立正确,可以分配私网标签。

发表评论

您的电子邮箱地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据