华为 BGP MPLS VPN 实验(一)单域

文章目录

    • 华为单域BGP MPLS VPN实验
      • 1.1 实验拓扑图
      • 1.2 各设备IP地址基本配置及BGP设备环回口IGP互通示例
      • 1.3 实例配置示例
      • 1.4 MP-BGP配置示例
      • 1.5 查看邻居表
      • 1.6 在PE上对OSPF与BGP双向引入示例
      • 1.7 查看PE上面学习到的CE的路由
      • 1.8 测试结果
      • 1.9 所有配置文件

华为单域BGP MPLS VPN实验

1.1 实验拓扑图

华为 BGP MPLS VPN 实验(一)单域_第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 24

RT4的关键配置
[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 32

RT5的关键配置
[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.0

RT5的关键配置
[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 实例配置示例

【RT4的VPN配置】
[RT4]ip -instance 1
[RT4--instance-1]route-distinguisher 10:10
[RT4--instance-1-af-ipv4]-target 10:10 both 
[RT4]int g0/0/0
[RT4-GigabitEthernet0/0/0]ip binding -instance 1	//接口与VPN实例关联
[RT4-GigabitEthernet0/0/0]ip add 14.1.1.4 24	//关联后IP被删除,需要重新配置

[RT4]ip -instance 2
[RT4--instance-2]route-distinguisher 20:20
[RT4--instance-2-af-ipv4]-target 20:20 both 
[RT4-GigabitEthernet0/0/0]int g0/0/1
[RT4-GigabitEthernet0/0/1]ip bin  2
[RT4-GigabitEthernet0/0/1]ip add 24.1.1.4 24

[RT4]ip -instance 3
[RT4--instance-3]route-distinguisher 30:30
[RT4--instance-3-af-ipv4]-target 30:30 both
[RT4-GigabitEthernet0/0/1]int g0/0/2
[RT4-GigabitEthernet0/0/2]ip bin  3
[RT4-GigabitEthernet0/0/2]ip add 34.1.1.4 24

【RT7的VPN配置】
[RT7]ip -instance 4
[RT7--instance-4]route-distinguisher 40:40
[RT7--instance-4-af-ipv4]-target 10:10 20:20 both
[RT7]int g0/0/1
[RT7-GigabitEthernet0/0/1]ip bin  4
[RT7-GigabitEthernet0/0/1]ip add 78.1.1.7 24

[RT7]ip -instance 5
[RT7--instance-5]route-distinguisher 50:50
[RT7--instance-5-af-ipv4]-target 30:30 both
[RT7]int g0/0/2
[RT7-GigabitEthernet0/0/2]ip bin  5
[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 v4 
[RT4-bgp-af-v4]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 v4
[RT7-bgp-af-v4]pee 4.4.4.4 enable 

1.5 查看邻居表

【RT4的邻居】
[RT4]dis bgp v4 all peer 
 BGP local router ID : 4.4.4.4
 Local AS number : 200
 Total number of peers : 1		  Peers in established state : 1

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State PrefRcv

  7.7.7.7         4         200        2        4     0 00:00:50	 Established       0

[RT4]dis mpls ldp peer 
 LDP Peer Information in Public network
 A '*' 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 network
 A '*' before a peer means the peer is being deleted.
 ------------------------------------------------------------------------------
 PeerID                 TransportAddress   DiscoverySource
 ------------------------------------------------------------------------------
 4.4.4.4:0              4.4.4.4            GigabitEthernet0/0/0
 6.6.6.6:0              6.6.6.6            GigabitEthernet0/0/1
 ------------------------------------------------------------------------------
 TOTAL: 2 Peer(s) Found.

【RT7的邻居】
[RT7]dis bgp v4 all peer 
 BGP local router ID : 7.7.7.7
 Local AS number : 200
 Total number of peers : 1		  Peers in established state : 1

  Peer            V          AS  MsgRcvd  MsgSent  OutQ  Up/Down       State PrefRcv

  4.4.4.4         4         200        6        6     0 00:04:12	 Established       0

[RT7]dis mpls ldp peer  
 LDP Peer Information in Public network
 A '*' 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 -instance 1 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 -instance 2 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 -instance 1
[RT4-bgp-1]import-route ospf 10
[RT4-bgp]ipv4-family -instance 2
[RT4-bgp-2]import-route ospf 20

1.7 查看PE上面学习到的CE的路由

【PE1】
[RT4]dis ip routing-table -instance 1 
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: 1
         Destinations : 9        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        1.1.1.1/32  OSPF    10   1           D   14.1.1.1        GigabitEthernet0/0/0
        8.8.8.8/32  IBGP    255  2          RD   7.7.7.7         GigabitEthernet3/0/0
       14.1.1.0/24  Direct  0    0           D   14.1.1.4        GigabitEthernet0/0/0
       14.1.1.4/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
     14.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/0
       78.1.1.0/24  IBGP    255  0          RD   7.7.7.7         GigabitEthernet3/0/0
      192.1.1.1/32  OSPF    10   1           D   14.1.1.1        GigabitEthernet0/0/0
      192.8.8.8/32  IBGP    255  2          RD   7.7.7.7         GigabitEthernet3/0/0

[RT4]dis ip routing-table -instance 2
Route Flags: R - relay, D - download to fib
------------------------------------------------------------------------------
Routing Tables: 2
         Destinations : 9        Routes : 9        

Destination/Mask    Proto   Pre  Cost      Flags NextHop         Interface

        2.2.2.2/32  OSPF    10   1           D   24.1.1.2        GigabitEthernet0/0/1
        8.8.8.8/32  IBGP    255  2          RD   7.7.7.7         GigabitEthernet3/0/0
       24.1.1.0/24  Direct  0    0           D   24.1.1.4        GigabitEthernet0/0/1
       24.1.1.4/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
     24.1.1.255/32  Direct  0    0           D   127.0.0.1       GigabitEthernet0/0/1
       78.1.1.0/24  IBGP    255  0          RD   7.7.7.7         GigabitEthernet3/0/0
      192.2.2.2/32  OSPF    10   1           D   24.1.1.2        GigabitEthernet0/0/1
      192.8.8.8/32  IBGP    255  2          RD   7.7.7.7         GigabitEthernet3/0/0

1.8 测试结果

【RT1 ping RT8】
华为 BGP MPLS VPN 实验(一)单域_第2张图片


【RT2 ping RT8】
华为 BGP MPLS VPN 实验(一)单域_第3张图片


【RT3 ping RT9】
华为 BGP MPLS VPN 实验(一)单域_第4张图片

1.9 所有配置文件

【RT1配置文件】
[RT1]dis cu
interface GigabitEthernet0/0/0
 ip address 14.1.1.1 255.255.255.0 
interface LoopBack0
 ip address 1.1.1.1 255.255.255.255 
interface LoopBack10
 ip 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/0
 ip address 24.1.1.2 255.255.255.0 
interface LoopBack0
 ip address 2.2.2.2 255.255.255.255 
interface LoopBack10
 ip 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/0
 ip address 34.1.1.3 255.255.255.0 
interface LoopBack0
 ip address 3.3.3.3 255.255.255.255 
interface LoopBack10
 ip address 192.3.3.3 255.255.255.0 
bgp 100
 router-id 3.3.3.3
 peer 34.1.1.4 as-number 200 
 #
 ipv4-family unicast
  undo synchronization
  import-route direct
  peer 34.1.1.4 enable
return

【RT4配置文件】
[RT4]dis cu
ip -instance 1
 ipv4-family
  route-distinguisher 10:10
  -target 10:10 export-extcommunity
  -target 10:10 import-extcommunity
#
ip -instance 2
 ipv4-family
  route-distinguisher 20:20
  -target 20:20 export-extcommunity
  -target 20:20 import-extcommunity
#
ip -instance 3
 ipv4-family
  route-distinguisher 30:30
  -target 30:30 export-extcommunity
  -target 30:30 import-extcommunity
#
mpls lsr-id 4.4.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding -instance 1
 ip address 14.1.1.4 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip binding -instance 2
 ip address 24.1.1.4 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip binding -instance 3
 ip address 34.1.1.4 255.255.255.0 
#
interface GigabitEthernet3/0/0
 ip address 45.1.1.4 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 4.4.4.4 255.255.255.255 
#
bgp 200
 router-id 4.4.4.4
 peer 7.7.7.7 as-number 200 
 peer 7.7.7.7 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 7.7.7.7 enable
 # 
 ipv4-family v4
  policy -target
  peer 7.7.7.7 enable
 #
 ipv4-family -instance 1 
  import-route ospf 10
 #
 ipv4-family -instance 2 
  import-route ospf 20
 #
 ipv4-family -instance 3 
  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 -instance 1
 import-route bgp
 area 0.0.0.0 
  network 14.1.1.4 0.0.0.0 
#
ospf 20 router-id 4.4.4.4 -instance 2
 import-route bgp
 area 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/0
 ip address 45.1.1.5 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 56.1.1.5 255.255.255.0 
 mpls
 mpls ldp
interface LoopBack0
 ip 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/0
 ip address 56.1.1.6 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 67.1.1.6 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip 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 -instance 4
 ipv4-family
  route-distinguisher 40:40
  -target 10:10 20:20 export-extcommunity
  -target 10:10 20:20 import-extcommunity
#
ip -instance 5
 ipv4-family
  route-distinguisher 50:50
  -target 30:30 export-extcommunity
  -target 30:30 import-extcommunity
#
mpls lsr-id 7.7.7.7
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 67.1.1.7 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding -instance 4
 ip address 78.1.1.7 255.255.255.0 
#
interface GigabitEthernet0/0/2
 ip binding -instance 5
 ip address 79.1.1.7 255.255.255.0 
#
interface LoopBack0
 ip address 7.7.7.7 255.255.255.255 
#
bgp 200
 router-id 7.7.7.7
 peer 4.4.4.4 as-number 200 
 peer 4.4.4.4 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo synchronization
  undo peer 4.4.4.4 enable
 # 
 ipv4-family v4
  policy -target
  peer 4.4.4.4 enable
 #
 ipv4-family -instance 4 
  import-route ospf 10
 #
 ipv4-family -instance 5 
  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 -instance 4
 import-route bgp
 area 0.0.0.0 
  network 78.1.1.7 0.0.0.0 
return

【RT8配置文件】
[RT8]dis cu
interface GigabitEthernet0/0/0
 ip address 78.1.1.8 255.255.255.0 
interface LoopBack0
 ip address 8.8.8.8 255.255.255.255 
#
interface LoopBack10
 ip 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/0
 ip address 79.1.1.9 255.255.255.0 
interface LoopBack0
 ip address 9.9.9.9 255.255.255.255 
interface LoopBack10
 ip address 192.9.9.9 255.255.255.0 
#
bgp 300
 peer 79.1.1.7 as-number 200 
 #
 ipv4-family unicast
  undo synchronization
  import-route direct
  peer 79.1.1.7 enable
return

你可能感兴趣的:(网络,学习笔记,华为,网络)