通信网实验:mpls.doc_第1页
通信网实验:mpls.doc_第2页
通信网实验:mpls.doc_第3页
通信网实验:mpls.doc_第4页
通信网实验:mpls.doc_第5页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

南京邮电大学 课程名称_ 实验名称_ 班级学号_ 学生姓名_ 指导老师_实验日期 / 年第 学期 月 日 一、实验目的该实验通过MPLS VPN的数据配置,使学生掌握路由器相关接口的IP地址设置、路由协议的配置以及MPLS VPN的完整的创建过程, 从而加深对IP网络的IP编址、路由协议以及MPLS的相关理论的理解。二、实验内容利用网络模拟器GNS3模拟Cisco的实验环境,搭建IP网络,完成CE、PE和P路由器上的数据配置, 使属于同一VPN的两个路由器能够互通。三、实验设备1硬件:PC机。2软件: 网络模拟器 GNS3-0.8.6-all-in-one终端仿真程序 SecureCRT6.7Cisco IOS文件 C3640-JK9O3S-M-12.4(7a).BIN四、实验步骤1 创建网络拓扑结构并把该拓扑结构记录在实验报告中。(1) 如图配置“首选项”“一般”设置中的“中端设置” 红圈部分填写相应的程序位置 (2) 如图配置Dynamips设置 红圈部分填写相应的文件夹位置,端口适当改变,点击测试,显示绿色提示时即为正常。(3)IOS设置把安装软件包中的C3640-JK9O3S-M-12.4(7a).BIN文件拷贝到C:GNS3IMAGES目录下在GNS3主界面中选择“编辑-IOS和Hypervisor”。在“IOS”窗口选择Cisco IOS文件为C3640-JK9O3S-M-12.4(7a).BIN,选择IOS文件对应的“平台”和“型号”后,单击“保存”,如下图所示:(4)创建工程打开GNS3软件,新建项目,命名为:MPLS_VPN_学号,如下图所示。(5)选择路由器从左竖栏路由器图标中拖出7个c3600路由器,分别为R1R7,其中R1、R3为PE,R2为P路由器,R1R3组成MPLS骨干网,R4和R5为CE,R6和R7为普通路由器,R4和R6组成VPN1 Site1,R5和R7组成VPN1 Site2,如下图所示。(6)配置路由器插槽选择R1,右键选择“配置”项,设置插槽如下图所示:同理设置R2R7,其中R6和R7只需设置插槽口slot0即可,不需设置slot1。(7)如图连接路由器最终创建的网络拓扑结构2 配置各个路由器相关接口的IP地址并记录在实验报告中。(1)、设置Idle PC 选择如图所示IDLE PC值(2) 、根据以下代码在SecureCrt中配置各路由器IP接口 在如图框中写代码 R1#config t进入全局配置模式R1(config)#int f0/0进入接口f0/0配置模式R1(config-if)#ip address 12.1.1.1 255.255.255.0配置接口f0/0的IP地址R1(config-if)#no shutdown激活接口f0/0R1(config-if)#int f1/0R1(config-if)#ip address 14.1.1.1 255.255.255.0R1(config-if)#no shutdownR1(config-if)#int loopback0R1(config-if)#ip address 1.1.1.1 255.255.255.255 配置loopback地址R1(config-if)#end 退出全局配置模式R1#show ip int b 显示接口IP配置简报R1#write 保存配置R2#config t进入全局配置模式R2(config)#int f0/0进入接口f0/0配置模式R2(config-if)#ip address 12.1.1.2 255.255.255.0配置接口f0/0的IP地址R2(config-if)#no shutdown激活接口f0/0R2(config-if)#int f1/0R2(config-if)#ip address 23.1.1.2 255.255.255.0R2(config-if)#no shutdownR2(config-if)#int loopback0R2(config-if)#ip address 2.2.2.2 255.255.255.255 配置loopback地址R2(config-if)#end退出全局配置模式R2#show ip int b显示接口IP配置简报R2#write保存配置R3#config t进入全局配置模式R3(config)#int f0/0进入接口f0/0配置模式R3(config-if)#ip address 35.1.1.3 255.255.255.0配置接口f0/0的IP地址R3(config-if)#no shutdown激活接口f0/0R3(config-if)#int f1/0R3(config-if)#ip address 23.1.1.3 255.255.255.0R3(config-if)#no shutdownR3(config-if)#int loopback0R3(config-if)#ip address 3.3.3.3 255.255.255.255 配置loopback地址R3(config-if)#end退出全局配置模式R3#show ip int b显示接口IP配置简报R3#writeR4#config t进入全局配置模式R4(config)#int f0/0进入接口f0/0配置模式R4(config-if)#ip address46.1.1.4 255.255.255.0配置接口f0/0的IP地址R4(config-if)#no shutdown激活接口f0/0R4(config-if)#int f1/0R4(config-if)#ip address 14.1.1.4 255.255.255.0R4(config-if)#no shutdownR4(config-if)#end退出全局配置模式R4#show ip int b显示接口IP配置简报R4#writeR5#config t进入全局配置模式R5(config)#int f0/0进入接口f0/0配置模式R5(config-if)#ip address57.1.1.5 255.255.255.0配置接口f0/0的IP地址R5(config-if)#no shutdown激活接口f0/0R5(config-if)#int f1/0R5(config-if)#ip address35.1.1.5 255.255.255.0R5(config-if)#no shutdownR5(config-if)#end退出全局配置模式R5#show ip int b显示接口IP配置简报R5#writeR6#config t进入全局配置模式R6(config)#int f0/0进入接口f0/0配置模式R6(config-if)#ip address 46.1.1.6 255.255.255.0配置接口f0/0的IP地址R6(config-if)#no shutdown激活接口f0/0R6(config-if)#int loopback0R6(config-if)#ip address6.6.6.6 255.255.255.255 配置loopback地址R6(config-if)#end退出全局配置模式R6#show ip int b显示接口IP配置简报R6#writeR7#config t进入全局配置模式R7(config)#int f0/0进入接口f0/0配置模式R7(config-if)#ip address 57.1.1.7 255.255.255.0配置接口f0/0的IP地址R7(config-if)#no shutdown激活接口f0/0R7(config-if)#int loopback0R7(config-if)#ip address7.7.7.7 255.255.255.255 配置loopback地址R7(config-if)#end退出全局配置模式R7#show ip int b显示接口IP配置简报R7#write3 配置骨干网络内路由协议。(1) 、根据下列代码配置骨干网络内路由协议R1#config tR1(config)#router ospf 123 建立OSPF路由进程,进程号为123R1(config-router)#router-id 1.1.1.1R1(config-router)#network 1.1.1.1 0.0.0.0 a 0 R1(config-router)#network 12.1.1.0 0.0.0.255 a 0R1(config-router)#endR1#writeR2#config tR2(config)#router ospf 123R2(config-router)#router-id 2.2.2.2R2(config-router)#network 2.2.2.2 0.0.0.0 a 0R2(config-router)#network 12.1.1.0 0.0.0.255 a 0R2(config-router)#network 23.1.1.0 0.0.0.255 a 0R2(config-router)#exitR2(config)#int f0/0R2(config-if)#ip ospf priority 255R2(config-if)#int f1/0R2(config-if)#ip ospf priority 255R2(config-if)#endR2#writeR3#config tR3(config)#router ospf 123R3(config-router)#router-id 3.3.3.3R3(config-router)#network 3.3.3.3 0.0.0.0 a 0R3(config-router)#network 23.1.1.0 0.0.0.255 a 0R3(config-router)#endR3#write4 配置骨干网络内MPLS协议。 1)利用下列代码全局开启CEF (必须配置):R1(config)#ip cefR2(config)#ip cefR3(config)#ip cef2) 利用下列代码配置LDP (必须配置):配置R1、R2和R3在骨干网内的接口开通LDP。R1(config-if)#int f0/0R1(config-if)#mpls label protocol ldp R1(config-if)#mpls ipR2(config)#int f0/0R2(config-if)#mpls label protocol ldp R2(config-if)#mpls ipR2(config)#int f1/0R2(config-if)#mpls label protocol ldp R2(config-if)#mpls ipR3(config)#int f1/0R3(config-if)#mpls label protocol ldp R3(config-if)#mpls ip 3)利用下列代码保存配置R1#writeR2#writeR3#write5 配置普通BGP。在R1和R3之间配置普通BGP,因为在配置MP-BGP之前,需要保证正常的BGP邻居是正常连通的。1) 在R1上配置普通BGP:R1(config)#router bgp 100R1(config-router)#bgp router-id 1.1.1.1R1(config-router)#no auto-summaryR1(config-router)#no synchronizationR1(config-router)#neighbor 3.3.3.3 remote-as 100R1(config-router)#neighbor 3.3.3.3 update-source loopback02) 在R3上配置普通BGP:R3(config)#router bgp 100R3(config-router)#bgp router-id 3.3.3.3R3(config-router)#no auto-summaryR3(config-router)#no synchronizationR3(config-router)#neighbor 1.1.1.1 remote-as 100R3(config-router)#neighbor 1.1.1.1 update-source loopback0 3) 利用下列代码保存配置:R1#writeR3#write6 在PE上创建VRF。在PE上为用户创建相应的VRF,并且指定RD值,需要通信的两个用户网络之间,VRF和RD值保持一致。1)在R1上创建VRF,并指定RD值:R1(config)#ip vrf vpn1 R1(config-vrf)#rd 100:12)在R3上创建VRF,并指定RD值:R3(config)#ip vrf vpn1R3(config-vrf)#rd 100:13)在PE上将连CE的接口划入VRF在PE上将相应的CE接口划入相应的VRF,以后从该接口进入的用户数据包,则属于相应的VRF,该用户的数据只能根据该VRF路由表作出转发决策。 在R1上将连CE R4的接口f1/0划入VRF:R1(config-vrf)#int f1/0R1(config-if)#ip vrf forwarding vpn1 将接口划入名称为vpn1的VRFR1(config-if)#ip add 14.1.1.1 255.255.255.0 在R3上将连CE R5的接口f0/0划入VRF:R3(config-vrf)#int f0/0R3(config-if)#ip vrf forwarding vpn1R3(config-if)#ip add 35.1.1.3 255.255.255.0当一个正常的接口被划入VRF之后,接口上的地址会消失,所以需要重新配置一次该接口的IP地址。 4)利用下列代码保存配置:R1#writeR3#write7 创建MP-BGP。通过上面在PE上查看VRF路由表发现,VRF路由表中并没有双方用户的路由,所以必须创建MP-BGP,来为双方用户网络传递路由信息。1)在PE R1及R3上创建MP-BGP:R1(config)#router bgp 100R1(config-router)#no auto-summary R1(config-router)#address-family vpnv4R1(config-router-af)#neighbor 3.3.3.3 activate R1(config-router-af)#neighbor 3.3.3.3 send-community bothR3(config)#router bgp 100R3(config-router)#no auto-summary R3(config-router)#address-family vpnv4 R3(config-router-af)#neighbor 1.1.1.1 activate R3(config-router-af)#neighbor 1.1.1.1 send-community both因为要传递vpnv4的路由,所以创建的address-family为vpnv4,并且将正常的BGP邻居在vpnv4里面激活,而且还需要将这些BGP的扩展属性手工强行发给对端,否则对方收到的路由信息不会携带扩展属性,也就无法正常区分用户的路由信息。2)为MP-BGP创建VRFMP-BGP在收到用户的路由信息后,必须将其放入相应的VRF路由表,但是这个VRF表是要手工创建的,并且和该用户相关联的VRF名字保持一致:R1(config)#router bgp 100R1(config-router)#address-family ipv4 vrf vpn1R1(config-router-af)#no synchronizationR3(config)#router bgp 100R3(config-router)#address-family ipv4 vrf vpn1R3(config-router-af)#no synchronization3)配置RT控制VRF路由信息MP-BGP的VRF路由表能让什么样的路由进入,是靠RT来控制的,要想让用户的路由被MP-BGP传递,就必须为VRF配置相应的RT,只有RT允许的RD路由,才能进入和出去VRF表。R1(config)#ip vrf vpn1R1(config-vrf)#route-target both 100:1R3(config)#ip vrf vpn1R3(config-vrf)#route-target both 100:1由以上设置可实现VRF vpn1允许RD为100:1的路由进入和出去。4)配置PE-CE的路由协议,并将MP-BGP的路由重分布进该路由协议虽然MP-BGP的VRF已经允许相应的用户路由进入,但是在PE上,此时并不能获知用户的路由信息,所以MP-BGP的VRF路由表中,依然为空,要想让MP-BGP的VRF路由表能够导入相应的用户路由,那就必须和用户CE之前启用路由协议,以获得对方的路由信息,从而导入MP-BGP的VRF表。 在PE R1一端启用RIP路由协议:a. 在PE R1上配置RIP:R1(config)#router rip R1(config-router)#version 2R1(config-router)#no auto-summary R1(config-router)#address-family ipv4 vrf vpn1R1(config-router-af)#no auto-summary R1(config-router-af)#network 14.0.0.0R1(config-router-af)#redistribute bgp 100 metric 1发布路由都是在address-family中进行的,并且请关闭自动汇总功能,且将MP-BGP的路由重分布进RIP,否则对方CE将无法得知远程用户的路由信息。b. 在CE R4上配置RIP:R4(config)#router rip R4(config-router)#version 2R4(config-router)#no auto-summary R4(config-router)#network 14.0.0.0R4(config-router)#network 46.0.0.0 在PE R3一端启用OSPF路由协议:a. 在PE R3上配置OSPF:R3(config)#router ospf 100 vrf vpn1R3(config-router)#router-id 35.1.1.3R3(config-router)#network 35.1.1.3 0.0.0.0 a 0R3(config-router)#redistribute bgp 100 subnets同样也要将MP-BGP的路由重分布进OSPF,以便传递给CE端。b. 在CE R5上配置OSPF:R5(config)#router ospf 100R5(config-router)#router-id 5.5.5.5R5(config-router)#network 35.1.1.5 0.0.0.0 a 0R5(config-router)#network 57.1.1.5 0.0.0.0 a 0R5(config-router)#exit5)将PE-CE间的路由重分布进MP-BGPPE-CE之间在运行IGP时,无法自动导入MP-BGP,所以手工重分布。 在R1上将RIP路由导入MP-BGP:R1(config)#router bgp 100R1(config-router)#address-family ipv4 vrf vpn1R1(config-router-af)#redistribute rip 在R3上将OSPP路由导入MP-BGP:R3(config)#router bgp 100R3(config-router)#address-family ipv4 vrf vpn1R3(config-router-af)#redistribute ospf 100 6)利用下列代码保存配置:R1#writeR3#write8 配置用户端路由协议。用户端(通常称为C路由器)R6及R7加入各自CE的路由协议进程:R6(config)#router ripR6(config-router)#version 2R6(config-router)#no auto-summary R6(config-router)#network 46.0.0.0R6(config-router)#network 6.6.6.6R7(config)#router ospf 100R7(config-router)#router-id 7.7.7.7R7(config-router)#network 7.7.7.7 0.0.0.0 a 0R7(config-router)#network 57.1.1.0 0.0.0.255 a 0保存路由器配置和工程。至此,设置已完全结束。五、实验结果1、查看VRF路由、CE路由和客户端路由,并将R1、R4和R6的路由显示结果及分析记录在实验报告中。1)查看MP-BGP路由R2#show ip bgp vpnv4 all可得到显示如下:BGP table version is 13, local router ID is 1.1.1.1Status codes: s suppressed, d damped, h history, * valid, best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight PathRoute Distinguisher: 100:1 (default for vrf vpn1)* 6.6.6.6/32 14.1.1.4 2 32768 ?*i7.7.7.7/32 3.3.3.3 3 100 0 ?* 14.1.1.0/24 0.0.0.0 0 32768 ?*i35.1.1.0/24 3.3.3.3 0 100 0 ?* 46.1.1.0/24 14.1.1.4 1 32768 ?*i57.1.1.0/24 3.3.3.3 2 100 0 ?R3#show ip bgp vpnv4 all可得到显示如下:BGP table version is 13, local router ID is 3.3.3.3Status codes: s suppressed, d damped, h history, * valid, best, i - internal, r RIB-failure, S StaleOrigin codes: i - IGP, e - EGP, ? - incomplete Network Next Hop Metric LocPrf Weight PathRoute Distinguisher: 100:1 (default for vrf vpn1)*i6.6.6.6/32 1.1.1.1 2 100 0 ?* 7.7.7.7/32 35.1.1.5 3 32768 ?*i14.1.1.0/24 1.1.1.1 0 100 0 ?* 35.1.1.0/24 0.0.0.0 0 32768 ?*i46.1.1.0/24 1.1.1.1 1 100 0 ?* 57.1.1.0/24 35.1.1.5 2 32768 ?R3#show ip bgp vpnv4 vrf vpn1 6.6.6.6/32可得到显示如下:BGP routing table entry for 100:1:6.6.6.6/32, version 11Paths: (1 available, best #1, table vpn1) Not advertised to any peer Local 1.1.1.1 (metric 3) from 1.1.1.1 (1.1.1.1) Origin incomplete, metric 2, localpref 100, valid, internal, best Extended Community: RT:100:1 mpls labels in/out nolabel/21可以看出,MP-BGP已经拥有双方用户网络的内部路由信息,并且通过查看MP-BGP路由详细信息可知,这些路由带有BGP扩展属性RT即Extended Community: RT:100:1。2)查看PE上VRF路由R1#show ip route vrf vpn1可得显示如下:Routing Table: vpn1Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is not set 35.0.0.0/24 is subnetted, 1 subnetsB 35.1.1.0 200/0 via 3.3.3.3, 00:46:46 6.0.0.0/32 is subnetted, 1 subnetsR 6.6.6.6 120/2 via 14.1.1.4, 00:00:05, FastEthernet1/0 7.0.0.0/32 is subnetted, 1 subnetsB 7.7.7.7 200/3 via 3.3.3.3, 00:09:00 57.0.0.0/24 is subnetted, 1 subnetsB 57.1.1.0 200/2 via 3.3.3.3, 00:46:46 46.0.0.0/24 is subnetted, 1 subnetsR 46.1.1.0 120/1 via 14.1.1.4, 00:00:05, FastEthernet1/0 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet1/0R3#show ip route vrf vpn1可得显示如下:Routing Table: vpn1Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is not set 35.0.0.0/24 is subnetted, 1 subnetsC 35.1.1.0 is directly connected, FastEthernet0/0 6.0.0.0/32 is subnetted, 1 subnetsB 6.6.6.6 200/2 via 1.1.1.1, 01:08:37 7.0.0.0/32 is subnetted, 1 subnetsO 7.7.7.7 110/3 via 35.1.1.5, 00:33:38, FastEthernet0/0 57.0.0.0/24 is subnetted, 1 subnetsO 57.1.1.0 110/2 via 35.1.1.5, 00:33:38, FastEthernet0/0 46.0.0.0/24 is subnetted, 1 subnetsB 46.1.1.0 200/1 via 1.1.1.1, 01:12:23 14.0.0.0/24 is subnetted, 1 subnetsB 14.1.1.0 200/0 via 1.1.1.1, 01:12:28可以看出,PE R1及PE R3上的VRF已经拥有双方用户的网络信息。3) 查看CE路由因为PE上已经拥有双方用户的路由信息,并且PE和CE之间也运行路由协议,这些路由也会出现在CE的路由表中,从而双方用户可以实现通信:R4#show ip routeCodes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2 i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2 ia - IS-IS inter area, * - candidate default, U - per-user static route o - ODR, P - periodic downloaded static routeGateway of last resort is not set 35.0.0.0/24 is subnetted, 1 subnetsR 35.1.1.0 120/1 via 14.1.1.1, 00:00:10, FastEthernet1/0 6.0.0.0/32 is subnetted, 1 subnetsR 6.6.6.6 120/1 via 46.1.1.6, 00:00:18, FastEthernet0/0 7.0.0.0/32 is subnetted, 1 subnetsR 7.7.7.7 120/1 via 14.1.1.1, 00:00:10, FastEthernet1/0 57.0.0.0/24 is subnetted, 1 subnetsR 57.1.1.0 120/1 via 14.1.1.1, 00:00:10, FastEthernet1/0 46.0.0.0/24 is subnetted, 1 subnetsC 46.1.1.0 is directly connected, FastEthernet0/0 14.0.0.0/24 is subnetted, 1 subnetsC 14.1.1.0 is directly connected, FastEthernet1/0同理查看R6,可以看到,两个CE 上已经拥有所有用户的内部路由。4) 查看客户端路由R6#show ip route可得显示如下:Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论