华为MPLS VPN配置

配置mpls vpn

拓扑如下:
在这里插入图片描述

配置思路:

1.公网互通
2.建立vpn实例
3.在两台PE间建立MP-BGP VPN
4.ospf与bgp的双向引入


配置ip,启用ospf全网互通

**R1**
#
interface GigabitEthernet0/0/0
 ip address 192.168.1.1 255.255.255.0 
#
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
#
interface LoopBack10
 ip address 172.16.1.1 255.255.255.255 
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 1.1.1.1 0.0.0.0 
  network 172.16.1.1 0.0.0.0 
  network 192.168.1.1 0.0.0.0 
#
------------------------------------------------
**R2**
#
interface GigabitEthernet0/0/0
 ip address 192.168.1.2 255.255.255.0 
#
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
#
interface LoopBack10
 ip address 172.16.2.1 255.255.255.255 
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 2.2.2.2 0.0.0.0 
  network 172.16.2.1 0.0.0.0 
  network 192.168.1.2 0.0.0.0 
#
------------------------------------------------
R6与R7的配置略
------------------------------------------------
**R3**
#
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
 #
interface GigabitEthernet0/0/2
 ip address 100.1.34.1 255.255.255.252 
#
先不配置g0/0/0口和g0/0/1
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 3.3.3.3 0.0.0.0 
  network 100.1.34.1 0.0.0.0 
#
------------------------------------------------
**R4**
#
interface GigabitEthernet0/0/0
 ip address 100.1.34.2 255.255.255.252 
#
interface GigabitEthernet0/0/1
 ip address 100.1.45.1 255.255.255.252 
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 4.4.4.4 0.0.0.0 
  network 100.1.34.2 0.0.0.0 
  network 100.1.45.1 0.0.0.0 
#
------------------------------------------------
**R5**
#
interface GigabitEthernet0/0/0
 ip address 100.1.45.2 255.255.255.252
#

在公网区域内开启mpls ldp

**R3**
#
mpls lsr-id 3.3.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/2
 mpls
 mpls ldp
#
------------------------------------------------
**R4**
#
mpls lsr-id 4.4.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 mpls
 mpls ldp
#
------------------------------------------------
**R5**
#
mpls lsr-id 5.5.5.5
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 mpls
 mpls ldp
#

在PE设备中开启vpn实例,并绑定到相应接口

**R3**
#
ip vpn-instance 1
 ipv4-family
  route-distinguisher 1:2
  vpn-target 100:100 export-extcommunity
  vpn-target 100:200 import-extcommunity
#
ip vpn-instance 2
 ipv4-family
  route-distinguisher 2:2
  vpn-target 200:100 export-extcommunity
  vpn-target 200:200 import-extcommunity
#
interface GigabitEthernet0/0/0
 ip binding vpn-instance 1
 ip address 192.168.1.3 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance 2
 ip address 192.168.1.3 255.255.255.0 
#
------------------------------------------------
**R5**
#
ip vpn-instance 1
 ipv4-family
  route-distinguisher 1:2
  vpn-target 100:200 export-extcommunity
  vpn-target 100:100 import-extcommunity
#
ip vpn-instance 2
 ipv4-family
  route-distinguisher 2:2
  vpn-target 200:200 export-extcommunity
  vpn-target 200:100 import-extcommunity
#
interface GigabitEthernet0/0/1
 ip binding vpn-instance 1
 ip address 192.168.2.3 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip binding vpn-instance 2
 ip address 192.168.2.3 255.255.255.0 
#

CE设备和PE设备配置私网路由

**R3**
#
ospf 100 vpn-instance 1
 area 0.0.0.0 
  network 192.168.1.3 0.0.0.0 
#
ospf 200 vpn-instance 2
 area 0.0.0.0 
  network 192.168.1.3 0.0.0.0 
#
------------------------------------------------
**R5**
#
ospf 100 vpn-instance 1
 area 0.0.0.0 
  network 192.168.2.3 0.0.0.0 
#
ospf 200 vpn-instance 2
 area 0.0.0.0 
  network 192.168.2.3 0.0.0.0 
#

配置MP-BGP VPN

**R3**
#
bgp 300
 peer 5.5.5.5 as-number 300 
 peer 5.5.5.5 connect-interface LoopBack0
 #
 ipv4-family vpnv4
  policy vpn-target
  peer 5.5.5.5 enable
--------------------------------------------
**R5**
#
bgp 300
 peer 3.3.3.3 as-number 300 
 peer 3.3.3.3 connect-interface LoopBack0
# 
 ipv4-family vpnv4
  policy vpn-target
  peer 3.3.3.3 enable

配置ospf和bgp的双向引入

**R3**
#
ospf 100 vpn-instance 1
 import-route bgp
#
ospf 200 vpn-instance 2
 import-route bgp
#
#
bgp 300
#
 ipv4-family vpn-instance 1 
  import-route ospf 100
 #
 ipv4-family vpn-instance 2 
  import-route ospf 200
#
-----------------------------------------
**R5**
#
ospf 100 vpn-instance 1
 import-route bgp
#
ospf 200 vpn-instance 2
 import-route bgp
#
#
bgp 300
 #
 ipv4-family vpn-instance 1 
  import-route ospf 100
 #
 ipv4-family vpn-instance 2 
  import-route ospf 200
#

通道建立成功
在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值