eNSP实验BGPMPLSVPN.docx
《eNSP实验BGPMPLSVPN.docx》由会员分享,可在线阅读,更多相关《eNSP实验BGPMPLSVPN.docx(14页珍藏版)》请在冰豆网上搜索。
![eNSP实验BGPMPLSVPN.docx](https://file1.bdocx.com/fileroot1/2023-1/30/f9d193b5-c981-42cf-96de-d7b86c959cb0/f9d193b5-c981-42cf-96de-d7b86c959cb01.gif)
eNSP实验BGPMPLSVPN
BGPMPLSVPN配置实验
1网络拓扑
2配置文件
2.1PE1的相关配置
2.1.1在MPLS骨干网上配置IGP-OSPF协议,实现骨干网PE和P的互通
#
SysnaPE1
ospf1
area0.0.0.0
network10.0.0.00.0.0.3
network1.1.1.10.0.0.0(igp-ospf)
#
interfaceLoopBack0
ipaddress1.1.1.1255.255.255.255
ospfenable1area0.0.0.0端口使能ospf)
interfaceEthernet0/0/0
lsp-trigger命令用来配置LSP的触发策略。
undolsp-trigger命令用来恢复缺省情况。
缺省情况下,只有32位掩码的主机路由能够触发LDP建立LSP。
需要注意的是:
•IP地址前缀列表只对静态路由和IGP路由有效。
•LSP的建立需要LSR上有精确匹配的路由项,如果使用32位掩码的Loopback接口,则必须有精确匹配的主机路由才能触发LSP的建立。
•如果指定vpn-instancevpn-instance-name参数,则配置指定VPN的LSP触发策略;
如果未指定vpn-instancevpn-instance-name参数,则配置公网路由的LSP触发策略。
•有关IP前缀列表的介绍请参见“三层技术-IP路由配置指导”中的“路由策略”。
【举例】
#配置所有路由项都能够触发LDP建立LSP。
system-view
[Sysname]mpls
[Sysname-mpls]lsp-triggerall
ipaddress10.0.0.1255.255.255.252
ospfenable1area0.0.0.0(端口使能ospf)
#
2.1.2在PE1上配置与PE2、P的IBGP
#
bgp65115
router-id1.1.1.1
peer3.3.3.3as-number65115
peer3.3.3.3connect-interfaceLoopBack0(配置bgp)
peer2.2.2.2as-number65115
peer2.2.2.2connect-interfaceLoopBack0
ipv4-familyunicast
undosynchronization
network1.1.1.1255.255.255.255
network10.0.0.0255.255.255.252
mplslsr-id命令用来配置本节点的LSRID,缺省情况下,未配置LSRID。
配置LSRID是配置其它MPLS命令的前提。
推荐使用LSR某个Loopback接口的地址做为LSRID。
peer2.2.2.2enable
peer3.3.3.3enable(宣告网络)
#
2.1.3MPLS骨干网上配置MPLS基本能力和MPLSLDP,建立LDPLSP
#
mplslsr-id1.1.1.1
mpls
lsp-triggerall
mplsldp(使能mpls)
#
interfaceEthernet0/0/0
mpls
mplsldp(端口使能mpls)
#
2.1.4在PE设备上配置VPN实例,将CE接入PE
ipvpn-instanceVPN1创建并进入VPN实例视图
ipv4-family
route-distinguisher100:
1为vpn-instance创建RD
vpn-target111:
1export-extcommunity为vpn-instance创建vpn-target扩展团体
vpn-target111:
1import-extcommunity(配置VPN1)
#
ipvpn-instanceVPN2
ipv4-family
route-distinguisher200:
1
vpn-target222:
1export-extcommunity
vpn-target222:
1import-extcommunity(配置VPN2)
#
interfaceEthernet0/0/1
ipbindingvpn-instanceVPN1将接口与vpn-instance关联
ipaddress10.0.0.13255.255.255.252(端口绑定VPN)
interfaceGigabitEthernet0/0/0
ipbindingvpn-instanceVPN2
ipaddress10.0.0.9255.255.255.252(端口绑定VPN)
#
2.1.5在PE与CE之间建立EBGP对等体,引入VPN路由
#
bgp65115
ipv4-familyvpnv4进入MBGP的VPNv4地址族视图
policyvpn-target
peer2.2.2.2enable激活MBGP对等体
peer3.3.3.3enable(建立邻居关系)
#
ipv4-familyvpn-instanceVPN1进入BGP的VPN地址族视图
import-routedirect
import-routestatic(配置vpn路由)
ipv4-familyvpn-instanceVPN2
import-routedirect
import-routestatic(配置vpn路由)
#
iproute-staticvpn-instanceVPN10.0.0.00.0.0.010.0.0.14
iproute-staticvpn-instanceVPN20.0.0.00.0.0.010.0.0.10(配置vpn静态路由:
PE和CE间通过静态路由链接的配置)
#
2.2P的相关配置
2.2.1在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通
#
sysnaP
ospf1
area0.0.0.0
network10.0.0.00.0.0.3
network10.0.0.40.0.0.3
network2.2.2.20.0.0.0(igp-ospf)
#
interfaceLoopBack0
ipaddress2.2.2.2255.255.255.255
ospfenable1area0.0.0.0(端口使能ospf)
interfaceEthernet0/0/0
ipaddress10.0.0.2255.255.255.252
ospfenable1area0.0.0.0(端口使能ospf)
interfaceEthernet0/0/1
ipaddress10.0.0.5255.255.255.252
ospfenable1area0.0.0.0(端口使能ospf)
#
2.2.2P上配置与PE1、PE2的IBGP
#
bgp65115
router-id2.2.2.2
peer1.1.1.1as-number65115
peer1.1.1.1connect-interfaceEthernet0/0/0
peer3.3.3.3as-number65115
peer3.3.3.3connect-interfaceEthernet0/0/1(配置bgp)
#
ipv4-familyunicast
undosynchronization
network2.2.2.2255.255.255.255
network10.0.0.0255.255.255.252
network10.0.0.4255.255.255.252
peer1.1.1.1enable
peer3.3.3.3enable(宣告网络)
#
2.2.3MPLS骨干网上配置MPLS基本能力和MPLSLDP,建立LDPLSP
#
mplslsr-id2.2.2.2
mpls
lsp-triggerall
mplsldp(使能mpls)
#
interfaceEthernet0/0/0
mpls
mplsldp(端口使能mpls)
#
interfaceEthernet0/0/1
mpls
mplsldp(端口使能mpls)
#
2.2.4建立P与PE1、PE2的邻居关系
#
bgp65115
ipv4-familyvpnv4
policyvpn-target
peer1.1.1.1enable
peer3.3.3.3enable(建立邻居关系)
#
2.3PE2相关配置
和PE1类似
2.3.1在MPLS骨干网上配置IGP协议,实现骨干网PE和P的互通
#
SysnaPE2
ospf1
area0.0.0.0
network10.0.0.40.0.0.3
network3.3.3.30.0.0.0(igp-ospf)
#
interfaceLoopBack0
ipaddress3.3.3.3255.255.255.255
ospfenable1area0.0.0.0端口使能ospf)
interfaceEthernet0/0/0
ipaddress10.0.0.6255.255.255.252
ospfenable1area0.0.0.0(端口使能ospf)
#
2.3.2在PE2上配置与P、PE1的IBGP
#
bgp65115
router-id3.3.3.3
peer1.1.1.1as-number65115
peer1.1.1.1connect-interfaceLoopBack0(配置bgp)
ipv4-familyunicast
undosynchronization
network3.3.3.3255.255.255.255
network10.0.0.4255.255.255.252
peer2.2.2.2enable
peer1.1.1.1enable(宣告网络)
#
2.3.3MPLS骨干网上配置MPLS基本能力和MPLSLDP,建立LDPLSP
#
mplslsr-id3.3.3.3
mpls
lsp-triggerall
mplsldp(使能mpls)
#
interfaceEthernet0/0/0
mpls
mplsldp(端口使能mpls)
#
2.3.4在PE设备上配置VPN实例,将CE接入PE
#
ipvpn-instanceVPN1
ipv4-family
route-distinguisher100:
1
vpn-target111:
1export-extcommunity
vpn-target111:
1import-extcommunity
#(配置VPN1)
ipvpn-instanceVPN2
ipv4-family
route-distinguisher200:
1
vpn-target222:
1export-extcommunity
vpn-target222:
1import-extcommunity(配置VPN2)
#
interfaceEthernet0/0/1
ipbindingvpn-instanceVPN1
ipaddress10.0.0.17255.255.255.252(端口绑定VPN)
interfaceGigabitEthernet0/0/0
ipbindingvpn-instanceVPN2
ipaddress10.0.0.21255.255.255.252(端口绑定VPN)
#
2.3.5PE与CE之间建立EBGP对等体,引入VPN路由
bgp65115
ipv4-familyvpnv4
policyvpn-target
peer2.2.2.2enable
peer1.1.1.1enable(建立邻居关系)
#
ipv4-familyvpn-instanceVPN1
import-routedirect
import-routestatic(配置vpn路由)
ipv4-familyvpn-instanceVPN2
import-routedirect
import-routestatic(配置vpn路由)
#
iproute-staticvpn-instanceVPN10.0.0.00.0.0.010.0.0.18
iproute-staticvpn-instanceVPN20.0.0.00.0.0.010.0.0.22
#
(配置vpn静态路由)
2.4CE1的相关配置
#
SysnCE1
interfaceEthernet0/0/0
ipaddress10.0.0.10255.255.255.252
iproute-static0.0.0.00.0.0.010.0.0.9(配置静态路由)
#
save
2.5CE2的相关配置
#
SysnCE2
interfaceEthernet0/0/0
ipaddress10.0.0.14255.255.255.252
iproute-static0.0.0.00.0.0.010.0.0.13
#
2.6CE3的相关配置
#
SysnCE3
interfaceEthernet0/0/0
ipaddress10.0.0.18255.255.255.252
iproute-static0.0.0.00.0.0.010.0.0.17
#
2.7CE4的相关配置
#
Sys
SysnCE4
interfaceEthernet0/0/0
ipaddress10.0.0.22255.255.255.252
iproute-static0.0.0.00.0.0.010.0.0.21
#
3实验结果:
3.1PE1vpn路由表
[PE1]dispiprout
[PE1]dispiprouting-table
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
Public
Destinations:
8Routes:
8
Destination/MaskProtoPreCostFlagsNextHopInterface
1.1.1.1/32Direct00D127.0.0.1LoopBack0
2.2.2.2/32OSPF101D10.0.0.2Ethernet0/0/0
3.3.3.3/32OSPF102D10.0.0.2Ethernet0/0/0
10.0.0.0/30Direct00D10.0.0.1Ethernet0/0/0
10.0.0.1/32Direct00D127.0.0.1Ethernet0/0/0
10.0.0.4/30OSPF102D10.0.0.2Ethernet0/0/0
127.0.0.0/8Direct00D127.0.0.1InLoopBack0
127.0.0.1/32Direct00D127.0.0.1InLoopBack0
[PE1]dispiprouting-tablevp
[PE1]dispiprouting-tablevpn-instance?
STRING<1-31>VPNinstancename
[PE1]dispiprouting-tablevpn-instanceVPN1
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
VPN1
Destinations:
4Routes:
4
Destination/MaskProtoPreCostFlagsNextHopInterface
0.0.0.0/0Static600RD10.0.0.14Ethernet0/0/1
10.0.0.12/30Direct00D10.0.0.13Ethernet0/0/1
10.0.0.13/32Direct00D127.0.0.1Ethernet0/0/1
10.0.0.16/30IBGP2550RD3.3.3.3Ethernet0/0/0
[PE1]
[PE1]dispiprouting-tablevpn-instanceVPN2
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
VPN2
Destinations:
4Routes:
4
Destination/MaskProtoPreCostFlagsNextHopInterface
0.0.0.0/0Static600RD10.0.0.10GigabitEthernet0/0/0
10.0.0.8/30Direct00D10.0.0.9GigabitEthernet0/0/0
10.0.0.9/32Direct00D127.0.0.1GigabitEthernet0/0/0
10.0.0.20/30IBGP2550RD3.3.3.3Ethernet0/0/0
[PE1]
3.2P路由表
dispiprouting
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
Public
Destinations:
9Routes:
9
Destination/MaskProtoPreCostFlagsNextHopInterface
1.1.1.1/32OSPF101D10.0.0.1Ethernet0/0/0
2.2.2.2/32Direct00D127.0.0.1LoopBack0
3.3.3.3/32OSPF101D10.0.0.6Ethernet0/0/1
10.0.0.0/30Direct00D10.0.0.2Ethernet0/0/0
10.0.0.2/32Direct00D127.0.0.1Ethernet0/0/0
10.0.0.4/30Direct00D10.0.0.5Ethernet0/0/1
10.0.0.5/32Direct00D127.0.0.1Ethernet0/0/1
127.0.0.0/8Direct00D127.0.0.1InLoopBack0
127.0.0.1/32Direct00D127.0.0.1InLoopBack0
PE2Vpn路由表
disiprout
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
Public
Destinations:
8Routes:
8
Destination/MaskProtoPreCostFlagsNextHopInterface
1.1.1.1/32OSPF102D10.0.0.5Ethernet0/0/0
2.2.2.2/32OSPF101D10.0.0.5Ethernet0/0/0
3.3.3.3/32Direct00D127.0.0.1LoopBack0
10.0.0.0/30OSPF102D10.0.0.5Ethernet0/0/0
10.0.0.4/30Direct00D10.0.0.6Ethernet0/0/0
10.0.0.6/32Direct00D127.0.0.1Ethernet0/0/0
127.0.0.0/8Direct00D127.0.0.1InLoopBack0
127.0.0.1/32Direct00D127.0.0.1InLoopBack0
disiprou
disiprouting-tablevpn-instanceVPN1
RouteFlags:
R-relay,D-downloadtofib
------------------------------------------------------------------------------
RoutingTables:
VPN1
Destinations:
3Routes:
3
Destination/MaskProtoPreCostFlagsNextHopInterface
10.0.0.12/30IBGP2550RD1.1.1.1Ethernet0/0/0
10.0.0.16/30Direct00D10.0.0.17Ethernet0/0/1
10.0.0.17/32Direct00D127.0.0.1Ethernet0/0/1
dis