本文主要是介绍华为 BGP MPLS VPN 实验(一)单域,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
文章目录
- 华为单域BGP MPLS VPN实验
- 1.1 实验拓扑图
- 1.2 各设备IP地址基本配置及BGP设备环回口IGP互通示例
- 1.3 vpn实例配置示例
- 1.4 MP-BGP配置示例
- 1.5 查看邻居表
- 1.6 在PE上对OSPF与BGP双向引入示例
- 1.7 查看PE上面学习到的CE的路由
- 1.8 测试结果
- 1.9 所有配置文件
华为单域BGP MPLS VPN实验
1.1 实验拓扑图
说明:1、R1 R2 R8为同一家公司,R8为总部,R2 R3为分支,与PE运行OSPF协议。
2、R3与R9为另一家公司,与PE运行BGP协议。
3、其他配置参数如上图所示。
1.2 各设备IP地址基本配置及BGP设备环回口IGP互通示例
【一、基础IP配置】
RT1的关键配置:
[RT1]int g0/0/0 //互联口
[RT1-GigabitEthernet0/0/0]ip add 14.1.1.1 24
[RT1-GigabitEthernet0/0/0]int l 0 //环回口
[RT1-LoopBack0]ip add 1.1.1.1 32
[RT1-LoopBack0]int l 10 //业务口
[RT1-LoopBack10]ip add 192.1.1.1 24RT4的关键配置
[RT4]int g0/0/0
[RT4-GigabitEthernet0/0/0]ip add 14.1.1.4 24
[RT4-GigabitEthernet0/0/0]int g0/0/1
[RT4-GigabitEthernet0/0/1]ip add 24.1.1.4 24
[RT4-GigabitEthernet0/0/1]int g0/0/2
[RT4-GigabitEthernet0/0/2]ip add 34.1.1.4 24
[RT4-GigabitEthernet0/0/2]int g3/0/0
[RT4-GigabitEthernet3/0/0]ip add 45.1.1.4 24
[RT4-GigabitEthernet3/0/0]int l 0
[RT4-LoopBack0]ip add 4.4.4.4 32RT5的关键配置
[RT5]int g0/0/0
[RT5-GigabitEthernet0/0/0]ip add 45.1.1.5 24
[RT5-GigabitEthernet0/0/0]int g0/0/1
[RT5-GigabitEthernet0/0/1]ip add 56.1.1.5 24
[RT5-GigabitEthernet0/0/1]int l 0
[RT5-LoopBack0]ip add 5.5.5.5 32【二、BGP AS域内的OSPF配置】
RT4的关键配置
[RT4]ospf 1 rou 4.4.4.4
[RT4-ospf-1]a 0
[RT4-ospf-1-area-0.0.0.0]net 45.1.1.4 0.0.0.0
[RT4-ospf-1-area-0.0.0.0]netw 4.4.4.4 0.0.0.0RT5的关键配置
[RT5]ospf 1 rou 5.5.5.5
[RT5-ospf-1]a 0
[RT5-ospf-1-area-0.0.0.0]netw 45.1.1.5 0.0.0.0
[RT5-ospf-1-area-0.0.0.0]netw 56.1.1.5 0.0.0.0
[RT5-ospf-1-area-0.0.0.0]netw 5.5.5.5 0.0.0.0
1.3 vpn实例配置示例
【RT4的VPN配置】
[RT4]ip vpn-instance vpn1
[RT4-vpn-instance-vpn1]route-distinguisher 10:10
[RT4-vpn-instance-vpn1-af-ipv4]vpn-target 10:10 both
[RT4]int g0/0/0
[RT4-GigabitEthernet0/0/0]ip binding vpn-instance vpn1 //接口与VPN实例关联
[RT4-GigabitEthernet0/0/0]ip add 14.1.1.4 24 //关联后IP被删除,需要重新配置[RT4]ip vpn-instance vpn2
[RT4-vpn-instance-vpn2]route-distinguisher 20:20
[RT4-vpn-instance-vpn2-af-ipv4]vpn-target 20:20 both
[RT4-GigabitEthernet0/0/0]int g0/0/1
[RT4-GigabitEthernet0/0/1]ip bin vpn vpn2
[RT4-GigabitEthernet0/0/1]ip add 24.1.1.4 24[RT4]ip vpn-instance vpn3
[RT4-vpn-instance-vpn3]route-distinguisher 30:30
[RT4-vpn-instance-vpn3-af-ipv4]vpn-target 30:30 both
[RT4-GigabitEthernet0/0/1]int g0/0/2
[RT4-GigabitEthernet0/0/2]ip bin vpn vpn3
[RT4-GigabitEthernet0/0/2]ip add 34.1.1.4 24【RT7的VPN配置】
[RT7]ip vpn-instance vpn4
[RT7-vpn-instance-vpn4]route-distinguisher 40:40
[RT7-vpn-instance-vpn4-af-ipv4]vpn-target 10:10 20:20 both
[RT7]int g0/0/1
[RT7-GigabitEthernet0/0/1]ip bin vpn vpn4
[RT7-GigabitEthernet0/0/1]ip add 78.1.1.7 24[RT7]ip vpn-instance vpn5
[RT7-vpn-instance-vpn5]route-distinguisher 50:50
[RT7-vpn-instance-vpn5-af-ipv4]vpn-target 30:30 both
[RT7]int g0/0/2
[RT7-GigabitEthernet0/0/2]ip bin vpn vpn5
[RT7-GigabitEthernet0/0/2]ip add 79.1.1.7 24
1.4 MP-BGP配置示例
【RT4的配置】
[RT4]mpls lsr-id 4.4.4.4
[RT4]mpls
[RT4]mpls ldp
[RT4]int g3/0/0
[RT4-GigabitEthernet3/0/0]mpls
[RT4-GigabitEthernet3/0/0]mpls ldp[RT4]bgp 200
[RT4-bgp]router-id 4.4.4.4
[RT4-bgp]peer 7.7.7.7 as 200
[RT4-bgp]pee 7.7.7.7 con loop 0
[RT4-bgp]ipv4-family vpnv4
[RT4-bgp-af-vpnv4]peer 7.7.7.7 enable【RT5的配置】
[RT5]mpls lsr-id 5.5.5.5
[RT5]mpls
[RT5]mpls ldp
[RT5]int g0/0/0
[RT5-GigabitEthernet0/0/0]mpls
[RT5-GigabitEthernet0/0/0]mpls ldp
[RT5]int g0/0/1
[RT5-GigabitEthernet0/0/1]mpls
[RT5-GigabitEthernet0/0/1]mpls ldp【RT7的配置】
[RT7]mpls lsr 7.7.7.7
[RT7]mpls
[RT7]mpls ldp
[RT7]int g0/0/0
[RT7-GigabitEthernet0/0/0]mpls
[RT7-GigabitEthernet0/0/0]mpls ldp[RT7]bgp 200
[RT7-bgp]router-id 7.7.7.7
[RT7-bgp]pee 4.4.4.4 as 200
[RT7-bgp]pee 4.4.4.4 con loop 0
[RT7-bgp]ipv4-family vpnv4
[RT7-bgp-af-vpnv4]pee 4.4.4.4 enable
1.5 查看邻居表
【RT4的邻居】
[RT4]dis bgp vpnv4 all peer BGP local router ID : 4.4.4.4Local AS number : 200Total number of peers : 1 Peers in established state : 1Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv7.7.7.7 4 200 2 4 0 00:00:50 Established 0[RT4]dis mpls ldp peer LDP Peer Information in Public networkA '*' before a peer means the peer is being deleted.------------------------------------------------------------------------------PeerID TransportAddress DiscoverySource------------------------------------------------------------------------------5.5.5.5:0 5.5.5.5 GigabitEthernet3/0/0------------------------------------------------------------------------------TOTAL: 1 Peer(s) Found.【RT5的邻居】
[RT5]dis mpls ldp peer LDP Peer Information in Public networkA '*' before a peer means the peer is being deleted.------------------------------------------------------------------------------PeerID TransportAddress DiscoverySource------------------------------------------------------------------------------4.4.4.4:0 4.4.4.4 GigabitEthernet0/0/06.6.6.6:0 6.6.6.6 GigabitEthernet0/0/1------------------------------------------------------------------------------TOTAL: 2 Peer(s) Found.【RT7的邻居】
[RT7]dis bgp vpnv4 all peer BGP local router ID : 7.7.7.7Local AS number : 200Total number of peers : 1 Peers in established state : 1Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv4.4.4.4 4 200 6 6 0 00:04:12 Established 0[RT7]dis mpls ldp peer LDP Peer Information in Public networkA '*' before a peer means the peer is being deleted.------------------------------------------------------------------------------PeerID TransportAddress DiscoverySource------------------------------------------------------------------------------6.6.6.6:0 6.6.6.6 GigabitEthernet0/0/0------------------------------------------------------------------------------TOTAL: 1 Peer(s) Found.
1.6 在PE上对OSPF与BGP双向引入示例
【PE1的路由引入配置】
[RT1]ospf 1 rou 1.1.1.1
[RT1-ospf-1]a 0
[RT1-ospf-1-area-0.0.0.0]netw 14.1.1.1 0.0.0.0
[RT1-ospf-1-area-0.0.0.0]netw 1.1.1.1 0.0.0.0
[RT1-ospf-1-area-0.0.0.0]netw 192.1.1.1 0.0.0.255[RT4]ospf 10 vpn-instance vpn1 router-id 4.4.4.4 //ospf实例10与RT1对接
[RT4-ospf-10]import-route bgp
[RT4-ospf-10]a 0
[RT4-ospf-10-area-0.0.0.0]netw 14.1.1.4 0.0.0.0[RT4]ospf 20 vpn-instance vpn2 router-id 4.4.4.4 //ospf实例20与RT2对接
[RT4-ospf-20]import-route bgp
[RT4-ospf-20]a 0
[RT4-ospf-20-area-0.0.0.0]netw 24.1.1.4 0.0.0.0[RT4]bgp 200
[RT4-bgp]ipv4-family vpn-instance vpn1
[RT4-bgp-vpn1]import-route ospf 10
[RT4-bgp]ipv4-family vpn-instance vpn2
[RT4-bgp-vpn2]import-route ospf 20
1.7 查看PE上面学习到的CE的路由
【PE1】
[RT4]dis ip routing-table vpn-instance vpn1
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: vpn1Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface1.1.1.1/32 OSPF 10 1 D 14.1.1.1 GigabitEthernet0/0/08.8.8.8/32 IBGP 255 2 RD 7.7.7.7 GigabitEthernet3/0/014.1.1.0/24 Direct 0 0 D 14.1.1.4 GigabitEthernet0/0/014.1.1.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/014.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/078.1.1.0/24 IBGP 255 0 RD 7.7.7.7 GigabitEthernet3/0/0192.1.1.1/32 OSPF 10 1 D 14.1.1.1 GigabitEthernet0/0/0192.8.8.8/32 IBGP 255 2 RD 7.7.7.7 GigabitEthernet3/0/0[RT4]dis ip routing-table vpn-instance vpn2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: vpn2Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface2.2.2.2/32 OSPF 10 1 D 24.1.1.2 GigabitEthernet0/0/18.8.8.8/32 IBGP 255 2 RD 7.7.7.7 GigabitEthernet3/0/024.1.1.0/24 Direct 0 0 D 24.1.1.4 GigabitEthernet0/0/124.1.1.4/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/124.1.1.255/32 Direct 0 0 D 127.0.0.1 GigabitEthernet0/0/178.1.1.0/24 IBGP 255 0 RD 7.7.7.7 GigabitEthernet3/0/0192.2.2.2/32 OSPF 10 1 D 24.1.1.2 GigabitEthernet0/0/1192.8.8.8/32 IBGP 255 2 RD 7.7.7.7 GigabitEthernet3/0/0
1.8 测试结果
【RT1 ping RT8】
【RT2 ping RT8】
【RT3 ping RT9】
1.9 所有配置文件
【RT1配置文件】
[RT1]dis cu
interface GigabitEthernet0/0/0ip address 14.1.1.1 255.255.255.0
interface LoopBack0ip address 1.1.1.1 255.255.255.255
interface LoopBack10ip address 192.1.1.1 255.255.255.0
ospf 1 router-id 1.1.1.1 area 0.0.0.0 network 1.1.1.1 0.0.0.0 network 14.1.1.1 0.0.0.0 network 192.1.1.0 0.0.0.255
return【RT2配置文件】
[RT2]dis cu
interface GigabitEthernet0/0/0ip address 24.1.1.2 255.255.255.0
interface LoopBack0ip address 2.2.2.2 255.255.255.255
interface LoopBack10ip address 192.2.2.2 255.255.255.0
ospf 1 router-id 2.2.2.2 area 0.0.0.0 network 2.2.2.2 0.0.0.0 network 24.1.1.2 0.0.0.0 network 192.2.2.0 0.0.0.255
return【RT3配置文件】
[RT3]dis cu
interface GigabitEthernet0/0/0ip address 34.1.1.3 255.255.255.0
interface LoopBack0ip address 3.3.3.3 255.255.255.255
interface LoopBack10ip address 192.3.3.3 255.255.255.0
bgp 100router-id 3.3.3.3peer 34.1.1.4 as-number 200 #ipv4-family unicastundo synchronizationimport-route directpeer 34.1.1.4 enable
return【RT4配置文件】
[RT4]dis cu
ip vpn-instance vpn1ipv4-familyroute-distinguisher 10:10vpn-target 10:10 export-extcommunityvpn-target 10:10 import-extcommunity
#
ip vpn-instance vpn2ipv4-familyroute-distinguisher 20:20vpn-target 20:20 export-extcommunityvpn-target 20:20 import-extcommunity
#
ip vpn-instance vpn3ipv4-familyroute-distinguisher 30:30vpn-target 30:30 export-extcommunityvpn-target 30:30 import-extcommunity
#
mpls lsr-id 4.4.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0ip binding vpn-instance vpn1ip address 14.1.1.4 255.255.255.0
#
interface GigabitEthernet0/0/1ip binding vpn-instance vpn2ip address 24.1.1.4 255.255.255.0
#
interface GigabitEthernet0/0/2ip binding vpn-instance vpn3ip address 34.1.1.4 255.255.255.0
#
interface GigabitEthernet3/0/0ip address 45.1.1.4 255.255.255.0 mplsmpls ldp
#
interface LoopBack0ip address 4.4.4.4 255.255.255.255
#
bgp 200router-id 4.4.4.4peer 7.7.7.7 as-number 200 peer 7.7.7.7 connect-interface LoopBack0#ipv4-family unicastundo synchronizationundo peer 7.7.7.7 enable# ipv4-family vpnv4policy vpn-targetpeer 7.7.7.7 enable#ipv4-family vpn-instance vpn1 import-route ospf 10#ipv4-family vpn-instance vpn2 import-route ospf 20#ipv4-family vpn-instance vpn3 peer 34.1.1.3 as-number 100
#
ospf 1 router-id 4.4.4.4 area 0.0.0.0 network 4.4.4.4 0.0.0.0 network 45.1.1.4 0.0.0.0
#
ospf 10 router-id 4.4.4.4 vpn-instance vpn1import-route bgparea 0.0.0.0 network 14.1.1.4 0.0.0.0
#
ospf 20 router-id 4.4.4.4 vpn-instance vpn2import-route bgparea 0.0.0.0 network 24.1.1.4 0.0.0.0
return【RT5配置文件】
[RT5]dis cu
mpls lsr-id 5.5.5.5
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0ip address 45.1.1.5 255.255.255.0 mplsmpls ldp
#
interface GigabitEthernet0/0/1ip address 56.1.1.5 255.255.255.0 mplsmpls ldp
interface LoopBack0ip address 5.5.5.5 255.255.255.255
#
ospf 1 router-id 5.5.5.5 area 0.0.0.0 network 5.5.5.5 0.0.0.0 network 45.1.1.5 0.0.0.0 network 56.1.1.5 0.0.0.0
return【RT6配置文件】
[RT6]dis cu
mpls lsr-id 6.6.6.6
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0ip address 56.1.1.6 255.255.255.0 mplsmpls ldp
#
interface GigabitEthernet0/0/1ip address 67.1.1.6 255.255.255.0 mplsmpls ldp
#
interface LoopBack0ip address 6.6.6.6 255.255.255.255
#
ospf 1 router-id 6.6.6.6 area 0.0.0.0 network 6.6.6.6 0.0.0.0 network 56.1.1.6 0.0.0.0 network 67.1.1.6 0.0.0.0
return【RT7配置文件】
[RT7]dis cu
ip vpn-instance vpn4ipv4-familyroute-distinguisher 40:40vpn-target 10:10 20:20 export-extcommunityvpn-target 10:10 20:20 import-extcommunity
#
ip vpn-instance vpn5ipv4-familyroute-distinguisher 50:50vpn-target 30:30 export-extcommunityvpn-target 30:30 import-extcommunity
#
mpls lsr-id 7.7.7.7
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0ip address 67.1.1.7 255.255.255.0 mplsmpls ldp
#
interface GigabitEthernet0/0/1ip binding vpn-instance vpn4ip address 78.1.1.7 255.255.255.0
#
interface GigabitEthernet0/0/2ip binding vpn-instance vpn5ip address 79.1.1.7 255.255.255.0
#
interface LoopBack0ip address 7.7.7.7 255.255.255.255
#
bgp 200router-id 7.7.7.7peer 4.4.4.4 as-number 200 peer 4.4.4.4 connect-interface LoopBack0#ipv4-family unicastundo synchronizationundo peer 4.4.4.4 enable# ipv4-family vpnv4policy vpn-targetpeer 4.4.4.4 enable#ipv4-family vpn-instance vpn4 import-route ospf 10#ipv4-family vpn-instance vpn5 peer 79.1.1.9 as-number 300
#
ospf 1 router-id 7.7.7.7 area 0.0.0.0 network 7.7.7.7 0.0.0.0 network 67.1.1.7 0.0.0.0
#
ospf 10 router-id 7.7.7.7 vpn-instance vpn4import-route bgparea 0.0.0.0 network 78.1.1.7 0.0.0.0
return【RT8配置文件】
[RT8]dis cu
interface GigabitEthernet0/0/0ip address 78.1.1.8 255.255.255.0
interface LoopBack0ip address 8.8.8.8 255.255.255.255
#
interface LoopBack10ip address 192.8.8.8 255.255.255.0
#
ospf 1 router-id 8.8.8.8 area 0.0.0.0 network 8.8.8.8 0.0.0.0 network 78.1.1.8 0.0.0.0 network 192.8.8.0 0.0.0.255
return【RT9配置文件】[RT9]dis cu
interface GigabitEthernet0/0/0ip address 79.1.1.9 255.255.255.0
interface LoopBack0ip address 9.9.9.9 255.255.255.255
interface LoopBack10ip address 192.9.9.9 255.255.255.0
#
bgp 300peer 79.1.1.7 as-number 200 #ipv4-family unicastundo synchronizationimport-route directpeer 79.1.1.7 enable
return
这篇关于华为 BGP MPLS VPN 实验(一)单域的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!