MPLS IP VPN--PE和CE之间使用静态路由实现互通

参考配置

PE1


#
sysname PE1
#
ip vpn-instance vpn1  //创建VPN实例
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
#
mpls lsr-id 1.1.1.1  //配置MPLS能力
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance vpn1  //私网侧接口与VPN绑定
 ip address 10.1.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 192.168.1.1 255.255.255.0
 mpls
 mpls ldp  //公网侧接口使能mpls能力    
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255
#
bgp 100
 peer 2.2.2.2 as-number 100
 peer 2.2.2.2 connect-interface LoopBack0  //使用32位掩码的Loopback接口地址来建立MP-IBGP对等体关系     
 #
 ipv4-family unicast
  undo synchronization
  peer 2.2.2.2 enable
 #
 ipv4-family vpnv4  //使能对等体交换VPNv4路由信息的能力
  policy vpn-target
  peer 2.2.2.2 enable
 #
 ipv4-family vpn-instance vpn1
  import-route static //将本端静态路由引入BGP-VPN实例IPv4地址族路由表
#
ospf 1  //使用OSPF发布PE之间的路由,到达Loopback接口的路由
 area 0.0.0.0
  network 1.1.1.1 0.0.0.0
  network 192.168.1.0 0.0.0.255
#
ip route-static vpn-instance vpn1 10.137.1.0 255.255.255.0 10.1.1.2

#

return  
#

PE2


#
sysname PE2
#
ip vpn-instance vpn1  //创建VPN实例
 ipv4-family
  route-distinguisher 1:1
  vpn-target 1:1 export-extcommunity
  vpn-target 1:1 import-extcommunity
#
mpls lsr-id 2.2.2.2  //配置MPLS能力
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance vpn1  //私网侧接口与VPN绑定
 ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 192.168.1.2 255.255.255.0
 mpls
 mpls ldp  //公网侧接口使能mpls能力
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255
#
bgp 100
 peer 1.1.1.1 as-number 100
 peer 1.1.1.1 connect-interface LoopBack0  //使用32位掩码的Loopback接口地址来建立MP-IBGP对等体关系 
 #
 ipv4-family unicast
  undo synchronization
  peer 1.1.1.1 enable
 #
 ipv4-family vpnv4  //使能对等体交换VPNv4路由信息的能力
  policy vpn-target
  peer 1.1.1.1 enable
 #
 ipv4-family vpn-instance vpn1
  import-route static  //将本端静态路由引入BGP-VPN实例IPv4地址族路由表      
#
ospf 1  //使用OSPF发布PE之间的路由,到达Loopback接口的路由
 area 0.0.0.0
  network 192.168.1.0 0.0.0.255
  network 2.2.2.2 0.0.0.0
#
ip route-static vpn-instance vpn1 10.137.2.0 255.255.255.0 10.1.2.2
#

CE1


#
sysname CE1
#
interface GigabitEthernet0/0/0
 ip address 10.137.1.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.1.1.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.1.1.1
#
return

CE2


#
sysname CE2
#
interface GigabitEthernet0/0/0
 ip address 10.137.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
 ip address 10.1.2.2 255.255.255.0
#
ip route-static 0.0.0.0 0.0.0.0 10.1.2.1
#
return

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值