1、把安装软件包中的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为
2、普通路由器,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(conf
3、ig-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#s
4、how 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 loopb
5、ack0R2(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/0
6、R3(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#write R4#config t 进入全局配置模式R4(config)#int f0/0 进入接口f0/0配置模式R4(config-if)#ip address46
7、.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#write R5#config t 进入全局配置模式R5(config)#int f0/0 进入接口f0/0配置模式R5(config-if)#ip address
8、57.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#write R6#config t 进入全局配置模式R6(config)#int f0/0 进入接口f0/0配置模式R6(config-if)#ip addres
9、s 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#write R7#config t 进入全局配置模式R7(config)#int f0/0 进入接口f0/0配置模式R7(config-if)#ip address 57
10、.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#write 3配置骨干网络路由协议。(1)、根据下列代码配置骨干网络路由协议R1#config t R1(config)#router ospf 123 建立OSPF路由进程,进
11、程号为123R1(config-router)#router-id 1.1.1.1R1(config-router)#network 1.1.1.1 0.0.0.0 a 0R1(config-router)#network 12.1.1.0 0.0.0.255 a 0R1(config-router)#endR1#write R2#config t R2(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)#
12、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)#endR2#write R3#config t R3(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(
13、config-router)#network 23.1.1.0 0.0.0.255 a 0R3(config-router)#end4配置骨干网络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-if)#mpls l
14、abel protocol ldp R2(config-if)#mpls ipR2(config)#int f1/0R3(config)#int f1/0R3(config-if)#mpls label protocol ldp R3(config-if)#mpls ip 3)利用下列代码保存配置5配置普通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-rout
15、er)#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 synchr
16、onizationR3(config-router)#neighbor 1.1.1.1 remote-as 100R3(config-router)#neighbor 1.1.1.1 update-source loopback0 3) 利用下列代码保存配置:6在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(
17、config-vrf)#rd 100:3)在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/0R
18、3(config-if)#ip vrf forwarding vpn1R3(config-if)#ip add 35.1.1.3 255.255.255.0当一个正常的接口被划入VRF之后,接口上的地址会消失,所以需要重新配置一次该接口的IP地址。 4)利用下列代码保存配置:7创建MP-BGP。通过上面在PE上查看VRF路由表发现,VRF路由表中并没有双方用户的路由,所以必须创建MP-BGP,来为双方用户网络传递路由信息。1)在PE R1及R3上创建MP-BGP:R1(config-router)#no auto-summary R1(config-router)#address-family
19、 vpnv4R1(config-router-af)#neighbor 3.3.3.3 activate R1(config-router-af)#neighbor 3.3.3.3 send-munity bothR3(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-munity both因为要传递vpnv4的路由,所以创建的
20、address-family为vpnv4,并且将正常的BGP邻居在vpnv4里面激活,而且还需要将这些BGP的扩展属性手工强行发给对端,否则对方收到的路由信息不会携带扩展属性,也就无常区分用户的路由信息。2)为MP-BGP创建VRFMP-BGP在收到用户的路由信息后,必须将其放入相应的VRF路由表,但是这个VRF表是要手工创建的,并且和该用户相关联的VRF名字保持一致:R1(config-router)#address-family ipv4 vrf vpn1R1(config-router-af)#no synchronizationR3(config-router)#address-fam
21、ily 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:R3(config-vrf)#route-target both 100:由以上设置可实现VRF vpn1允许RD为100:1的路由进入和出去。4)配置PE-C
22、E的路由协议,并将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-af)#no auto-summary R1(config-
23、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-rou
24、ter)#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(con
25、fig-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-af)#redistribute rip 在R3上将OSPP路由导入MP-BGP:R3(config-router-af)#
26、redistribute ospf 100 6)利用下列代码保存配置:8配置用户端路由协议。用户端(通常称为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保存路由器配置和工程。至此,设置已完全结束。五、实验结果
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1