MPLS-VPN实验

1、拓扑

MPLS-VPN实验_第1张图片

 

2、需求:

pc1通过访问pc2

3、配置思路

第一步:配置接口地址

第二步:配置ospf

第三步:配置bgp

第四步:配置mpls

第五步:配置VRF

    -创建VRF

    -开启 ipv4-family

    -接口加入VRF

    -给接口重新配置地址

    -配置静态路由

第六步:配置RD

    --在VRF中配置RD

    --在BGP--ipv4地址族中关闭邻居

    --在BGP--v4地址族中开启邻居

    --在BGP中创建-instance 并注入路由

第七步:配置RT

    --在VRF中配置RT(出入方向)

第八步:验证

    --验证路由表

    --验证pc1访问pc2

    --验证标签转发路径

4、完整实验命令
 sysname R6
#
interface GigabitEthernet0/0/0
 ip address 192.168.16.6 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.1.254 255.255.255.0 
#
ip route-static 0.0.0.0 0.0.0.0 192.168.16.1


 sysname R1
#
ip -instance b1
 ipv4-family
  route-distinguisher 1:5
  -target 6:7 export-extcommunity
  -target 7:6 import-extcommunity
#
mpls lsr-id 10.10.1.1
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip binding -instance b1
 ip address 192.168.16.1 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.12.1 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 10.10.1.1 255.255.255.255 
#
bgp 200
 router-id 1.1.1.1
 peer 10.10.5.5 as-number 200 
 peer 10.10.5.5 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo peer 10.10.5.5 enable
 # 
 ipv4-family v4
  policy -target    //不需要敲
  peer 10.10.5.5 enable
 #
 ipv4-family -instance b1 
  network 192.168.1.0 
#
ospf 1 router-id 1.1.1.1 
 area 0.0.0.0 
  network 10.10.1.1 0.0.0.0 
  network 192.168.12.0 0.0.0.255 
#
ip route-static -instance b1 192.168.1.0 255.255.255.0 192.168.16.6

 sysname R2
#
mpls lsr-id 10.10.2.2
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 192.168.12.2 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 192.168.23.2 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 10.10.2.2 255.255.255.255 
#
ospf 1 router-id 2.2.2.2 
 area 0.0.0.0 
  network 10.10.2.2 0.0.0.0 
  network 192.168.12.0 0.0.0.255 
  network 192.168.23.0 0.0.0.255 
  
   sysname R3
#
mpls lsr-id 10.10.3.3
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 192.168.23.3 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 192.168.34.3 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 10.10.3.3 255.255.255.255 
#
ospf 1 router-id 3.3.3.3 
 area 0.0.0.0 
  network 10.10.3.3 0.0.0.0 
  network 192.168.23.0 0.0.0.255 
  network 192.168.34.0 0.0.0.255 


 sysname R4
#
mpls lsr-id 10.10.4.4
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 192.168.34.4 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip address 192.168.45.4 255.255.255.0 
 mpls
 mpls ldp
#
interface LoopBack0
 ip address 10.10.4.4 255.255.255.255 
#
ospf 1 router-id 4.4.4.4 
 area 0.0.0.0 
  network 10.10.4.4 0.0.0.0 
  network 192.168.34.0 0.0.0.255 
  network 192.168.45.0 0.0.0.255 


 sysname R5
#
ip -instance b1
 ipv4-family
  route-distinguisher 1:5
  -target 7:6 export-extcommunity
  -target 6:7 import-extcommunity
#
mpls lsr-id 10.10.5.5
mpls
#
mpls ldp
#
interface GigabitEthernet0/0/0
 ip address 192.168.45.5 255.255.255.0 
 mpls
 mpls ldp
#
interface GigabitEthernet0/0/1
 ip binding -instance b1
 ip address 192.168.57.5 255.255.255.0 
#
interface LoopBack0
 ip address 10.10.5.5 255.255.255.255 
#
bgp 200
 router-id 5.5.5.5
 peer 10.10.1.1 as-number 200 
 peer 10.10.1.1 connect-interface LoopBack0
 #
 ipv4-family unicast
  undo peer 10.10.1.1 enable
 # 
 ipv4-family v4
  policy -target     //不需要敲
  peer 10.10.1.1 enable
 #
 ipv4-family -instance b1 
  network 192.168.2.0 
#
ospf 1 router-id 5.5.5.5 
 area 0.0.0.0 
  network 10.10.5.5 0.0.0.0 
  network 192.168.45.0 0.0.0.255 
#
ip route-static -instance b1 192.168.2.0 255.255.255.0 192.168.57.7

 sysname R7
#
interface GigabitEthernet0/0/0
 ip address 192.168.57.7 255.255.255.0 
#
interface GigabitEthernet0/0/1
 ip address 192.168.2.254 255.255.255.0 
#
ip route-static 0.0.0.0 0.0.0.0 192.168.57.5
 

你可能感兴趣的:(网络安全,网络,安全,运维)