ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

MPLS_VPN搭建拓扑详细命令

2019-08-29 09:43:33  阅读:352  来源: 互联网

标签:R5 R6 R1 ip 拓扑 MPLS router VPN config


四、MPLS_VPN具体部署实现

4.1 拓扑图(初次搭建,拓扑图设计不是很nice)

4.2详细配置命令

4.2.1 配置IP地址

(注意:PE没有运行MPLS的接口,先让接口与VRF关联,再配接口IP)

R1配置命令:

R1#conf t

R1(config-if)#interface f0/0

R1(config-if)#ip address 14.14.14.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#interface lo0

R1(config-if)#ip address 1.1.1.1 255.255.255.255

 

R2#conf t

R2(config)#interface f0/0

R2(config-if)#ip address 23.23.23.2 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#interface lo0

R2(config-if)#ip address 2.2.2.2 255.255.255.255

 

R3#conf t

R3(config)#interface lo0

R3(config-if)#ip address 3.3.3.3 255.255.255.255

R3(config-if)#interface f0/0

R3(config-if)#ip address 23.23.23.3 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#interface f0/1

R3(config-if)#ip address 36.36.36.3 255.255.255.0

R3(config-if)#no shutdown

R3(config-if)#

 

R4#conf t

R4(config)#interface lo0

R4(config-if)#ip address 4.4.4.4 255.255.255.255

R4(config-if)#interface f0/0

R4(config-if)#ip address 14.14.14.4 255.255.255.0

R4(config-if)#no shutdown

R4(config-if)#interface f0/1

R4(config-if)#ip address 45.45.45.4 255.255.255.0

R4(config-if)#no shutdown

R4(config-if)#

 

R5#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R5(config)#interface lo0

R5(config-if)#ip address 5.5.5.5 255.255.255.255

R5(config-if)#interface f0/1

R5(config-if)#ip address 45.45.45.5 255.255.255.0

R5(config-if)#no shutdown

R5(config-if)#interface f0/0

R5(config-if)#ip address 56.56.56.5 255.255.255.0

R5(config-if)#no shutdown

 

R6#conf t

R6(config)#interface lo0

R6(config-if)#ip address 6.6.6.6 255.255.255.255

R6(config-if)#interface f0/1

R6(config-if)#ip address 36.36.36.6 255.255.255.0

R6(config-if)#no shutdown

R6(config-if)#interface f0/0

R6(config-if)#ip address 56.56.56.6 255.255.255.0

R6(config-if)#no shutdown

 

R7#conf t

R7(config)#interface s1/0

R7(config-if)#ip address 17.17.17.7 255.255.255.0

R7(config-if)#no shutdown

R7(config-if)#interface s1/1

R7(config-if)#ip address 27.27.27.2 255.255.255.0

R7(config-if)#no shutdown

R7(config-if)#interface lo0

R7(config-if)#ip address 7.7.7.7 255.255.255.255

R7(config-if)#

 

R8(config)#interface lo0

R8(config-if)#ip address 8.8.8.8 255.255.255.255

R8(config-if)#interface s1/0

R8(config-if)#ip address 58.58.58.8 255.255.255.0

R8(config-if)#no shutdown

R8(config-if)#

 

R9#conf t

R9(config)#interface lo0

R9(config-if)#ip address 9.9.9.9 255.255.255.255

R9(config-if)#interface s1/0

R9(config-if)#ip address 69.69.69.9 255.255.255.0

R9(config-if)#no shutdown

R9(config-if)#

 

 

4.2.2运营商域启用IGP协议

R1(config)#router ospf 52

R1(config-router)#network 14.14.14.0 0.0.0.255 area 0

R1(config-router)#network 1.1.1.0 0.0.0.255 area 0

R1(config-router)#

 

R2(config-if)#router ospf 52

R2(config-router)#network 23.23.23.0 0.0.0.255 area 0

R2(config-router)#network 2.2.2.0 0.0.0.255 area 0

R2(config-router)#

 

R3(config-if)#router ospf 52

R3(config-router)#network 23.23.23.0 0.0.0.255 area 0

R3(config-router)#network 36.36.36.0 0.0.0.255 area 0

R3(config-router)#network 3.3.3.0 0.0.0.255 area 0

R3(config-router)#

 

R4(config-if)#router ospf 52

R4(config-router)#network 14.14.14.0 255.255.255.0 area 0

R4(config-router)#network 45.45.45.0 255.255.255.0 area 0

R4(config-router)#network 4.4.4.0 255.255.255.0 area 0

R4(config-router)#

 

R5(config)#router ospf 52

R5(config-router)#network 45.45.45.0 0.0.0.255 area 0

R5(config-router)#network 56.56.56.0 0.0.0.255 area 0

R5(config-router)#network 5.5.5.0 0.0.0.255 area 0

R5(config-router)#

 

R6(config)#router ospf 52

R6(config-router)#network 36.36.36.0 0.0.0.255 area 0

R6(config-router)#network 56.56.56.0 0.0.0.255 area 0

R6(config-router)#network 6.6.6.0 0.0.0.255 area 0

R6(config-router)#

 

4.2.3运营商域启用MPLS

R1#conf t

R1(config)#ip cef

R1(config)#interface  f0/0

R1(config-if)#mpls ip

*Aug 23 17:13:11.167: %LDP-5-NBRCHG: LDP Neighbor 4.4.4.4:0 (1) is UP

R1(config)#mpls ldp router-id loopback 0 force

R1(config-if)#

 

 

R2#conf t

R2(config)#ip cef

R2(config)#interface f0/0

R2(config-if)#mpls ip

R2(config)#mpls ldp router-id loopback 0 force

R2(config-if)#   

 

R3#conf t

R3(config)#ip cef

R3(config)#interface f0/0

R3(config-if)#mpls ip

R3(config-if)#interface f0/1

R3(config-if)#mpls ip

R3(config)#mpls ldp router-id loopback 0 force

 

R4#conf t

R4(config)#ip cef

R4(config)#interface f0/0

R4(config-if)#mpls ip

*Aug 23 17:07:42.175: %LDP-5-NBRCHG: LDP Neighbor 1.1.1.1:0 (1) is UP

R4(config-if)#interface f0/1

R4(config-if)#mpls ip

R4(config)#mpls ldp router-id loopback 0 force

 

 

R5#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

R5(config)#ip cef

R5(config)#interface f0/1

R5(config-if)#mpls ip

R5(config-if)#interface f0/0

R5(config-if)#mpls ip

R5(config)#mpls ldp router-id loopback 0 force

 

 

R6#conf t

R6(config)#ip cef

R6(config)#interface f0/0

R6(config-if)#mpls ip

R6(config-if)#interface f0/1

R6(config-if)#mpls ip

R6(config-if)#

R6(config)#mpls ldp router-id loopback 0 force

 

4.3在PE路由器上创建vrf进程并将没有启用MPLS的接口绑定vrf

4.3.1 创建vrf,修改RD,RT值

R1(config)#ip vrf A

R1(config-vrf)#rd 10:10

R1(config-vrf)#rou

R1(config-vrf)#route-target 10:10

 

R2(config)#ip vrf A

R2(config-vrf)#rd 10:10

R2(config-vrf)#route

R2(config-vrf)#route-target 10:10

 

R5(config)#ip vrf A

R5(config-vrf)#rd 10:10

R5(config-vrf)#route

R5(config-vrf)#route-target 10:10

 

R6(config)#ip vrf A

R6(config-vrf)#rd 10:10

R6(config-vrf)#route

R6(config-vrf)#route-target 10:10

R6(config-vrf)#

 

查看子路由表    show ip route vrf 名称

 

4.3.2将接口与vrf绑定,并给接口加上IP地址

R1(config)#interface s1/0

R1(config-if)#ip vrf forwarding A

R1(config-if)# ip address 17.17.17.1 255.255.255.0

R1(config-if)#no shutdown

 

R2(config)#interface  s1/1

R2(config-if)#ip vrf forwarding A

R2(config-if)#ip address 27.27.27.2 255.255.255.0

R2(config-if)#no shutdown

 

R5(config)#interface s1/0

R5(config-if)#ip vrf forwarding A

R5(config-if)#ip address 58.58.58.5 255.255.255.0

R5(config-if)#no shutdown

 

R6(config)#interface s1/0

R6(config-if)#ip vrf forwarding A

R6(config-if)#ip address 69.69.69.6 255.255.255.0

R6(config-if)#no shutdown

 

关联VRF之后接口IP被加入子路由表中,普通的ping查找的是主路由表肯定ping不通,所以需要

           ( ping vrf 名称 IP )

 

4.4在端与端之间的PE上配置MPBGP的邻接关系

 

R1(config)#router bgp 52

R1(config-router)#no bgp default ipv4-unicast

R1(config-router)#bgp router-id 1.1.1.1

R1(config-router)#neighbor 5.5.5.5 remote-as 52

R1(config-router)#neighbor 5.5.5.5 update-source loopback 0

R1(config-router)#address-family vpnv4

R1(config-router-af)#neighbor 5.5.5.5 activate

R1(config-router-af)#neighbor 5.5.5.5 next-hop-self

 

R2(config)#router bgp 52

R2(config-router)#no bgp de

R2(config-router)#no bgp defa

R2(config-router)#no bgp default ip

R2(config-router)#no bgp default ipv4-unicast

R2(config-router)#bgp router

R2(config-router)#bgp router-id 2.2.2.2

R2(config-router)#neighbor 6.6.6.6 remote-as 52

R2(config-router)#neighbor 6.6.6.6 update-source loopback 0

R2(config-router)#address-family vpnv4

R2(config-router-af)#neighbor 6.6.6.6 activate

R2(config-router-af)#neighbor 6.6.6.6 next-hop-self

 

R5(config)#router bgp 52

R5(config-router)#no bgp default ipv4-unicast

R5(config-router)#bgp router-id 5.5.5.5

R5(config-router)#neighbor 1.1.1.1 remote-as 52

R5(config-router)#neighbor 1.1.1.1 update-source loopback 0

R5(config-router)#neighbor 6.6.6.6 remote-as 52

R5(config-router)#neighbor 6.6.6.6 update-source loopback 0

R5(config-router)#address-family vpnv4

R5(config-router-af)#neighbor 1.1.1.1 activate

R5(config-router-af)#neighbor 1.1.1.1 next-hop-self

R5(config-router-af)#neighbor 6.6.6.6 activate

R5(config-router-af)#neighbor 6.6.6.6 next-hop-self

 

R6(config)#router bgp 52

R6(config-router)#no bgp default ipv4-unicast

R6(config-router)#bgp router-id 6.6.6.6

R6(config-router)#neighbor 2.2.2.2 remote-as 52

R6(config-router)#neighbor 2.2.2.2 update-source loopback 0

R6(config-router)#neighbor 5.5.5.5 remote-as 52

R6(config-router)#neighbor 5.5.5.5 update-source loopback 0

R6(config-router)#address-family vpnv4

R6(config-router-af)#neighbor 2.2.2.2 activate

R6(config-router-af)#neighbor 2.2.2.2 next-hop-self

R6(config-router-af)#neighbor 5.5.5.5 activate

R6(config-router-af)#neighbor 5.5.5.5 next-hop-self

 

4.5将A公司总部路由分发到两个PE路由器R1、R2上

4.5.1  A公司总部R7与PE路由器R1使用RIP协议,分发总部路由到PE路由器R1

R7(config)#router rip

R7(config-router)#version 2

R7(config-router)#no auto-summary

R7(config-router)#network 17.0.0.0

R7(config-router)#network 7.7.7.0

 

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#no auto-summary

R1(config-router)#address-family ipv4 vrf A

R1(config-router-af)#network 17.17.17.0

 

经过以上操作,在R1上已经可以看到R7总部的路由,在R1上用show ip route vrf A查看

4.5.2  A公司总部R7与PE路由器R2静态分发A总部路由到PE路由器R2  

(如果使用eigrp需要设置as号 address-family ipv4 vrf A   autonomous-system 52)

R2(config)#ip route vrf A 7.7.7.0 255.255.255.0 27.27.27.7

此时在R2上已经能够看到总部R7上的路由: show  ip bgp all

分发R1上的总公司路由到另一端的R5

R1(config)#router bgp 52

R1(config-router)#address-family ipv4 vrf A

R1(config-router-af)#network 7.7.7.0 mask 255.255.255.0

 

此时在R5上已经能够看到总部R7上的路由: show  ip bgp all

 

分发R2上的总公司路由到另一端的R6

(eigrp的话address-family ipv4 vrf A redistribute eigrp 90 metric 10)

R2(config)#router bgp 52

R2(config-router)#address-family ipv4 vrf A

R2(config-router-af)#network 7.7.7.0 mask 255.255.255.0

 

此时在R6上已经可以查看到经运营商分发过来的vpnv4路由

 

4.5.3 发完整私网路由表:

R1(config)#router bgp 52

R1(config-router)#address-family vpnv4

R1(config-router-af)#neighbor 5.5.5.5 send-community both

 

在R5上查看vrf表(使用IGP动态协议会比静态路由多一条)

 

R2(config)#router bgp 52

R2(config-router)#address-family vpnv4

R2(config-router-af)#neighbor 6.6.6.6 send-community both

 

在R6上查看vrf表

 

 

4.6分发R5、R6到R8、R9

4.6.1  R5分发到R8:

R5(config)#router rip

R5(config-router)#version 2

R5(config-router)#no auto-summary

R5(config-router)#address-family ipv4 vrf A

R5(config-router-af)#network 58.0.0.0

R5(config-router-af)#redistribute bgp 52 metric transparent

 

R8(config)#router rip

R8(config-router)#version 2

R8(config-router)#no auto-summary

R8(config-router)#network 58.0.0.0

R8(config-router)# network 8.8.8.0

 

此时R8上已经有了总部所有的路由:(pe和ce使用的rip,应该有17那条)

 

R6(config)#router rip

R6(config-router)#version 2

R6(config-router)#no auto-summary

R6(config-router)#address-family  ipv4 vrf A

R6(config-router-af)#network 69.0.0.0

R6(config-router-af)#no redistribute bgp 52 metric transparent

 

R9(config)#router rip

R9(config-router)#version 2

R9(config-router)#no auto-summary

R9(config-router)#network 69.0.0.0

R9(config-router)#network 9.9.9.0

 

此时R9就收到了总部R7传过来的路由

 

4.7将分公司R8、R9的所有路由分发回来

bgp路由不会默认把IGP学到的路由传递给R1

       (要么network,要么重分发)

 

R5(config)#router bgp 52

R5(config-router)#address

R5(config-router)#address-family  ipv4

R5(config-router)#address-family  ipv4 vrf A

R5(config-router-af)#red

R5(config-router-af)#redistribute rip me

R5(config-router-af)#redistribute rip metric 10

 

接下来在R1上看一下   show ip bgp  all(如果使用静态路由无7.7.7.7那条,但是这个因为pe和ce使用的rip应该有7.7.7.7)

接下来需要做的就是将R1上学到的路由分发给R7

R1#conf t

R1(config)#router rip

R1(config-router)#address-family ipv4 vrf A

R1(config-router-af)#redistribute bgp 52 metric transparent

此时查看R7的路由,发现分支R8的路由已经全部分发过来了

 

R6(config)#router bgp 52

R6(config-router)#addre

R6(config-router)#address-family ipv4 vrf A

R6(config-router-af)#

R6(config-router-af)#red

R6(config-router-af)#redistribute rip me

R6(config-router-af)#redistribute rip metric 10

 

接下来在R2上看一下   show  ip  bgp  all

接下来需要做的就是将R2上学到的路由分发给R7

R7(config)#ip route 9.9.9.0 255.255.255.0 s1/1 27.27.27.2

 

此时全部部署已经做完,PE与CE之间建议使用IGP动态协议,可以动态获取私网路由条目。

 

 

 

 

 

 

★★  项目排错

① bgp邻居建立过程(显示状态一直是idle)

解决:

  默认情况下路由器有直连检测功能,如果发现建邻居的地址不是本地的直连地址,那么则不发送数据包,自然邻居无法建立,可以在BGP进程下采用以下命令关闭直连检测功能

      neighborx.x.x.x disable-connected-check         

 

② bgp邻居状态持续卡在active状态

问题分析:

    当邻居建立时持续卡在活跃状态时,可能是由于路由器无法收到初始报文的确认消息,

当路由器上没有输入neighbor remote-as命令或neighbor remote-as指定了错误的IP地址或AS号时也会导致邻居状态卡在活跃状态。

解决:

    

如图,自治系统号指定错误,将as系统号改为正确的。

 

③ 出现如下问题

解决:

将环回接口的ip改为32位掩码,网上参考还说另一种解决方法是将环回接口改为ospf的point-to-point类型

标签:R5,R6,R1,ip,拓扑,MPLS,router,VPN,config
来源: https://blog.csdn.net/qq_42103479/article/details/100130207

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有