设为首页收藏本站language 语言切换
查看: 3000|回复: 5
收起左侧

[分享] 华为设备配置BGP/MPLS IP VPN

[复制链接]
 成长值: 63385
发表于 2018-11-1 11:40:05 | 显示全部楼层 |阅读模式
如图:
CE1、CE3属于vpna。
CE2、CE4属于vpnb。
vpna使用的VPN-target属性为111:1,vpnb为222:2。
不同VPN用户之间不能互相访问。
图 配置BGP/MPLS IP VPN组网图
1.jpg


操作步骤
1、配置PE1

#
sysname PE1
#
ip vpn-instance vpna  //创建VPN实例vpna
ipv4-family
  route-distinguisher 100:1
  vpn-target 111:1 export-extcommunity
  vpn-target 111:1 import-extcommunity
#
ip vpn-instance vpnb  //创建VPN实例vpnb
ipv4-family
  route-distinguisher 100:2
  vpn-target 222:2 export-extcommunity
  vpn-target 222:2 import-extcommunity
#
mpls lsr-id 1.1.1.9  //配置MPLS
mpls
#
mpls ldp  //建立LDP
#
interface Ethernet1/0/0  //绑定VPN实例
ip binding vpn-instance vpna
ip address 10.1.1.2 255.255.255.0
#
interface Ethernet2/0/0
ip binding vpn-instance vpnb  //绑定VPN实例
ip address 10.2.1.2 255.255.255.0
#
interface Ethernet2/0/1  //接口使能MPLS
ip address 172.1.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 1.1.1.9 255.255.255.255
#
bgp 100  //配置MP-IBGP对等体
peer 3.3.3.9 as-number 100
peer 3.3.3.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 3.3.3.9 enable
#
ipv4-family vpnv4  //使能对等体交换VPNv4路由信息的能力
  policy vpn-target
  peer 3.3.3.9 enable
#
ipv4-family vpn-instance vpna  //配置PE与CE之间建立EBGP对等体关系,引入VPN路由
  peer 10.1.1.1 as-number 65410
  import-route direct
#
ipv4-family vpn-instance vpnb  //配置PE与CE之间建立EBGP对等体关系,引入VPN路由
  peer 10.2.1.1 as-number 65420
  import-route direct
#
ospf 1  //配置公网路由
area 0.0.0.0
  network 172.1.1.0 0.0.0.255
  network 1.1.1.9 0.0.0.0
#
return
2、配置P
#
sysname P
#
mpls lsr-id 2.2.2.9  //配置MPLS
mpls
#
mpls ldp
#
interface Ethernet1/0/0
ip address 172.1.1.2 255.255.255.0
mpls
mpls ldp
#
interface Ethernet2/0/0
ip address 172.2.1.1 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 2.2.2.9 255.255.255.255
#
ospf 1  //配置公网路由
area 0.0.0.0
  network 172.1.1.0 0.0.0.255
  network 172.2.1.0 0.0.0.255
  network 2.2.2.9 0.0.0.0
#
return
3、配置PE2
#
sysname PE2
#
ip vpn-instance vpna  //创建VPN实例vpna
ipv4-family
  route-distinguisher 200:1
  vpn-target 111:1 export-extcommunity
  vpn-target 111:1 import-extcommunity
#
ip vpn-instance vpnb  //创建VPN实例vpnb
ipv4-family
  route-distinguisher 200:2
  vpn-target 222:2 export-extcommunity
  vpn-target 222:2 import-extcommunity
#
mpls lsr-id 3.3.3.9  //配置MPLS LSR
mpls
#
mpls ldp
#
interface Ethernet1/0/0 //绑定VPN实例
ip binding vpn-instance vpna
ip address 10.3.1.2 255.255.255.0
#
interface Ethernet2/0/0  //绑定VPN实例
ip binding vpn-instance vpnb
ip address 10.4.1.2 255.255.255.0
#
interface Ethernet2/0/1  //接口使能MPLS
ip address 172.2.1.2 255.255.255.0
mpls
mpls ldp
#
interface LoopBack1
ip address 3.3.3.9 255.255.255.255
#
bgp 100  //配置MP-IBGP对等体
peer 1.1.1.9 as-number 100
peer 1.1.1.9 connect-interface LoopBack1
#
ipv4-family unicast
  undo synchronization
  peer 1.1.1.9 enable
#
ipv4-family vpnv4  //使能对等体交换VPNv4路由信息的能力
  policy vpn-target
  peer 1.1.1.9 enable
#
ipv4-family vpn-instance vpna  //配置PE与CE之间建立EBGP对等体关系,引入VPN路由
  peer 10.3.1.1 as-number 65430
  import-route direct
#
ipv4-family vpn-instance vpnb  //配置PE与CE之间建立EBGP对等体关系,引入VPN路由
  peer 10.4.1.1 as-number 65440
  import-route direct
#
ospf 1  //配置公网路由
area 0.0.0.0
  network 172.2.1.0 0.0.0.255
  network 3.3.3.9 0.0.0.0
#
return
4、配置CE1
#
sysname CE1
#
interface Ethernet1/0/0
ip address 10.1.1.1 255.255.255.0
#
bgp 65410  //在PE与CE之间建立EBGP对等体关系
peer 10.1.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct  //引入直连路由
  peer 10.1.1.2 enable
#
return
5、配置CE2
#
sysname CE2
#
interface Ethernet1/0/0
ip address 10.2.1.1 255.255.255.0
#
bgp 65420  //在PE与CE之间建立EBGP对等体关系
peer 10.2.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct  //引入直连路由
  peer 10.2.1.2 enable
#
return
6、配置CE3
#
sysname CE3
#
interface Ethernet1/0/0
ip address 10.3.1.1 255.255.255.0
#
bgp 65430  //在PE与CE之间建立EBGP对等体关系
peer 10.3.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct  //引入直连路由
  peer 10.3.1.2 enable
#
return
7、配置CE4
#
sysname CE4
#
interface Ethernet1/0/0
ip address 10.4.1.1 255.255.255.0
#
bgp 65440  //在PE与CE之间建立EBGP对等体关系
peer 10.4.1.2 as-number 100
#
ipv4-family unicast
  undo synchronization
  import-route direct  //引入直连路由
  peer 10.4.1.2 enable
#
return
配置注意事项
PE之间必须使用32位掩码的Loopback接口地址来建立MP-IBGP对等体关系,以便能够迭代到隧道。



发表于 2018-11-1 14:17:16 | 显示全部楼层
感谢楼主分享!
沙发 2018-11-1 14:17:16 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2022-8-31 11:04:13 | 显示全部楼层
论坛宣传二维码.png
6# 2022-8-31 11:04:13 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-2-1 11:51 , Processed in 0.063719 second(s), 12 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表