cisco交换机路由器配置12个经典试验.docx
《cisco交换机路由器配置12个经典试验.docx》由会员分享,可在线阅读,更多相关《cisco交换机路由器配置12个经典试验.docx(21页珍藏版)》请在冰豆网上搜索。
cisco交换机路由器配置12个经典试验
cisco交换机、路由器配置12个经典试验
实验一:
1.口令和设备名设置
添加任意的交换机或路由器,先对交换机进行操作,双击SwitchA
1. switch>en
2. password:
;第一次密码为空,直接回车
3. switch#conft;进入全局配置模式
4. switch(config)#hostnameswa;设置交换机名
5. swa(config)#enablesecretaaa;设置特权加密口令为aaa
6. swa(config)#enablepasswordaax;设置特权非密口令为aax
7. swa(config)#lineconsole0;进入控制台口(Rs232)状态
8. swa(config-line)#login;允许登录
9. swa(config-line)#passwordaa;设置登录口令aa
10. swa(config-line)#linevty04;进入虚拟终端virtualtty
11. swa(config-line)#login;允许登录
12. swa(config-line)#passworda;设置登录口令a
13. swa(config-line)#exit;返回上一层
14. swa(config)#exit;返回上一层
15. swa#shrun;看配置信息
16. swa#exit;返回命令
17. swa>en
18. password:
;试验哪一个口令可以通过
复制代码
双击ROA对路由器进行与交换机类似的设置。
2.清除口令
清除交换机口令,实际中是在开机时按住交换机上的mode钮,本模拟机按Ctrl+Break
清除路由器口令,参考如下:
双击ROA
先配置路由的特权口令:
1. router>en
2. password:
;第一次密码为空,直接回车
3. router#conft;进入全局配置模式
4. router(config)#enablesecretaaa;设置特权加密口令为aaa
5. router(config)#exit;返回
6. router#exit
7. router>en
8. password:
aaa
9. router#
10. 清除口令是打开寄存器配置开关:
11. router#reload;重新启动,按Ctrl+Break
12. rommon>
13. rommon>confreg0x2142;跳过配置,26xx36xx45xx
14. rommon>reset ;重新引导,等效于重开机
15. router>en
16. password:
17. router#conft
18. router(config)#enablesecretbbb;设置特权加密口令为aaa
19. router(config)#config-register0x2102;正常使用配置文件
20. router(config)#exit
21. router#exit
22. router>en
23. password:
bbb
24. router#
复制代码
实验二:
计算机与交换机IP地址设置
图文件:
switch1
规划ip地址:
PCA:
10.65.1.1
PCB:
10.65.1.2
SWA:
10.65.1.3
1.双击PCA
输入用户名:
root
输入口令:
linux
设置IP:
[root#PCAroot]#ifconfigeth010.65.1.1netmask255.255.0.0
查看IP:
[root#PCAroot]#ifconfig
删除IP:
[root#PCAroot]#ifconfigeth010.65.1.1netamsk255.255.0.0down
设置网关:
[root#PCAroot]#routeadddefaultgw10.65.1.9
查看网关:
[root#PCAroot]#route
删除网关:
[root#PCAroot]#routedeldefaultgw10.65.1.9
2.双击PCB
输入用户名:
root
输入口令:
linux
设置IP:
[root#PCBroot]#ifconfigeth010.65.1.2netmask255.255.0.0
设置网关:
[root#PCBroot]#routeadddefaultgw10.65.1.9
3.双击SWA
进入特权模式:
switch>en
进入全局配置模式:
switch#conft
进入默认VLAN状态:
switch(config)#intvlan1
设置ip地址和掩码:
switch(config-if)#ipaddress10.65.1.3255.255.0.0
设置switch的网关:
switch(config)#ipdefaule-gateway10.65.1.9
查看设置:
#shrun
4.回PCA
[root@PCAroot]#ping10.65.1.1
[root@PCAroot]#ping10.65.1.2
[root@PCAroot]#ping10.65.1.3
5.修改PCB的ip地址
修改为不同网段的一个ip地址,再从PCAPingPCB。
修改为相同网段的一个ip地址,再从PCAPingPCB。
断开交换机与PCB计算机连线,再从PCAPingPCB。
[root@PCAroot]#ping10.65.1.2
实验三交换机VLAN实验
图文件:
switch2
规划ip地址
PCA的ip地址:
10.65.1.1
PCB的ip地址:
10.66.1.1
PCC的ip地址:
10.65.1.3
PCD的ip地址:
10.66.1.3
SWA的ip地址:
10.65.1.7
SWB的ip地址:
10.65.1.8
SWA的f0/1~f0/3vlan2,f0/8为trunk
SWB的f0/2~f0/4valn2,f0/1为trunk
2.设置VLAN
双击SWA:
改名Switch为SWA,建立2个vlan:
23
1. SWA#vlandatabase
2. SWA(vlan)#vlan2
3. SWA(vlan)#vlan3
4. SWA(vlan)#exit
5. SWA#conft
6. SWA#shvlan
复制代码
将f0/1,f0/2,f0/3加入到vlan2
1. SWA(config)#intf0/1
2. SWA(config-if)#switchportaccessvlan2
3. SWA(config-if)#intf0/2
4. SWA(config-if)#switchportaccessvlan2
5. SWA(config-if)#intf0/3
6. SWA(config-if)#switchportaccessvlan2
7. SWA(config-if)#Ctrl+z
8. SWA#shvlan
复制代码
与SWA类似设置SWB的VLAN。
3.测试可通性
从PCA到PCC测试:
(通)
[root@PCAroot]#ping10.65.1.3
从PCA到PCB测试:
(不通:
不是一个网段,且不在一个VLAN)
[root@PCAroot]#ping10.66.1.1
从PCB到PCD测试:
(不通:
要求trunk)
[root@PCBroot]#ping10.66.1.3
从PCA到SWA测试:
(通)
[root@PCAroot]#ping10.65.1.7
从PCA到SWB测试:
(通)
[root@PCAroot]#ping10.65.1.8
从SWA到PCA测试:
(通)
SWA#ping10.65.1.1
从SWA到SWB测试:
(通)
SWB#ping10.65.1.8
再将连接两个交换机的接口设置成trunk。
1. SWA(config)#intf0/8
2. SWA(config-if)#switchportmodetrunk
3. SWB(config)#intf0/1
4. SWB(config-if)#switchportmodetrunk
复制代码
测试从PCA和PCB到PCC、PCD、SWA、SWB的可通性。
5.装入Switch3图文件
(1)都不设vlan情况下,测试连通性。
(2)设置有vlan情况下,测试连通性。
(3)使用trunk情况下,测试连通性。
实验四:
路由器的升级
1.在ROM监控模式下,使用console通过计算机的超级终端设置。
装入图文件:
router1a
要求路由器的console与计算机的rs232相连。
router>Ctrl+Break;进入ROM监控状态
rommon>copyxmodem:
c2621.binflash:
c2621.bin;从console升级IOS
###############################################################
###############################################################
#######################################
ok!
rommon>dirflash:
c2621.bin
这种方式传送的速度比较慢,使用的是RS232串行接口的速率,波特率一般为9600,
但不需要IOS的支持,在IOS损坏的情况下往往使用这种方式。
2.在特权模式下的升级
装入图文件:
router1b
要求TFTPServer(PCA)接入路由器的以太口,且PCA的ip地址与路由接口的ip地址
在一个网络段。
设置TFTP的ip地址为:
10.65.1.1
双击HostA:
1. login:
root
2. password:
linux
3. [root#linuxroot]#ifconfigeth010.65.1.1netmask255.255.0.0
4. [root#linuxroot]#ifconfig;查看IP地址
复制代码
双击要升级的路由器:
设置与之tftpserver相联接口f0/0的ip地址
1. router(cnfig-if)#ipaddress10.65.1.2255.255.0.0
2. router#copytftpflash:
3. tftpserveripaddress:
10.65.1.1
4. flashfilename:
C2621.bin
5. ###############################################################
6. ###############################################################
7. #######
8. ok!
9. router#dirflash:
10. c2621.bin
复制代码
这种方式传输的速度较快,使用的是以太网的速率。
但要求IOS是好的,所以升级
IOS使用这种方式较好。
3.在rommon监控状态下,使用TFTP升级
装入图文件:
router1c
要求路由器console与计算机rs232相连,路由器f0/0与计算机网卡相连。
1. router>Ctrl+Break;进入ROM监控状态
2. rommon>ip_address=10.65.1.10;设置路由器IP
3. rommon>ip_subnet_mask=255.255.0.0;设置路由器掩码
4. rommon>tftp_server=10.65.1.1;指定TFTP服务器IP
5. rommon>tftp_file=c2600.bin;所要下载的文件
6. rommon>tftpdnld;ROM监控状态升级IOS
7. ###############################################################
8. ###############################################################
9. #######
10. ok!
11. rommon>dirflash:
;查看闪存中的内容
12. c2621.bin
13. rommon>boot;引导IOS
14. router>
复制代码
实验五路由器接口ip设置
装入图文件:
router1d
本实验两个计算机,一个路由器,测试路由器的直路由。
设置PCA的IP地址为:
10.65.1.1255.255.0.0
设置PCB的IP地址为:
10.66.1.1255.255.0.0
设置ROf0/0的IP为:
10.65.1.2255.255.0.0
设置ROf0/1的IP为:
10.66.1.2255.255.0.0
1.设置计算机ip地址
设置IP:
[root#PCAroot]#ifconfigeth010.65.1.1netmask255.255.0.0
查看IP:
[root#PCAroot]#ifconfig
设置网关:
[root#PCAroot]#routeadddefaultgw10.65.1.2
查看网关:
[root#PCAroot]#route
设置IP:
[root#PCBroot]#ifconfigeth010.65.1.1netmask255.255.0.0
查看IP:
[root#PCBroot]#ifconfig
2.双击ROA,配置路由器的接口IP地址:
1. router>en
2. router#conft
3. router(config)#hostnameroa
4. roa(config)intf0/0
5. roa(config-if)#ipaddress10.65.1.2255.255.0.0
6. roa(config-if)#noshutdown
7. roa(config)intf0/1
8. roa(config-if)#ipaddress10.66.1.2255.255.0.0
9. roa(config-if)#noshut
10. roa(config)ints0/0
11. roa(config-if)#clockrate64000
12. roa(config-if)#ipaddress10.67.1.2255.255.0.0
13. roa(config-if)#noshut
14. roa(config)ints0/1
15. roa(config-if)#clockrate64000
16. roa(config-if)#ipaddress10.68.1.2255.255.0.0
17. roa(config-if)#noshut
复制代码
3.在计算机PCA分别ping路由器的四个接口f0/0、f0/1、s0/0、s0/1
1. [root#PCAroot]#ping10.65.1.2
2. [root#PCAroot]#ping10.66.1.2
3. [root#PCAroot]#ping10.67.1.2
4. [root#PCAroot]#ping10.68.1.2
5. [root#PCBroot]#ping10.65.1.2
6. [root#PCBroot]#ping10.66.1.2
7. [root#PCBroot]#ping10.67.1.2
8. [root#PCBroot]#ping10.68.1.2
复制代码
上面的ping命令,这PCA都可以通,但PCB只能与直联口通,因为PCB没有设置网关。
下面设置PCB的网关:
1. [root#PCBroot]#routeadddefaultgw10.66.1.2
2. [root#PCBroot]#route
复制代码
设置网关:
[root#PCBroot]#routeadddefaultgw10.65.1.9
查看网关:
[root#PCBroot]#route
再从PCBping各个接口,结果如何?
(通)。
实验六路由器接口的secondaryip
装入图文件:
router1e
这个图含有一个路由器,一个交换机,两个计算机。
计算机的IP不变,即:
1.检查计算机和交换机的IP和网关,要求:
PCA的IP地址:
10.65.1.1网关指向:
10.65.1.2
PCB的IP地址:
10.66.1.1网关指向:
10.66.1.2
此时PCA与PCB是不通的,因为它们的网络Id不一样。
设置交换机的IP地址:
1. switch(config)#intvlan1
2. switch(config-if)#ipaddress10.65.1.8255.255.0.0
复制代码
2.设置路由器的接口f0/0的有两个ip地址。
1. roa(config)intf0/0
2. roa(config-if)#ipaddress10.65.1.2255.255.0.0
3. roa(config-if)#noshut
4. roa(config-if)#ipaddress10.66.1.2255.255.0.0secondary
5. roa(config-if)#noshut
6. roa#shrun
复制代码
3.测试可通性
1. [root#PCAroot]#ping10.66.1.1
2. [root#PCAroot]#ping10.66.1.2
3. [root#PCBroot]#ping10.65.1.1
4. [root#PCBroot]#ping10.65.1.2
5. switch#ping10.65.1.1
6. switch#ping10.66.1.1
复制代码
以上都是可以通的,如果去掉交换机与路由的连线,PCA和PCB还可以通吗?
可见PCA到PCB的发包是经过路由器的,称之为单臂路由。
这种情况PCA和PCB在同广播域中,对工作带宽不利。
如果划分VLAN可以隔离广播域,
下面实验是子接口对不同VLAN的路由。
实验七使用路由器子接口路由情况
装入图文件:
router1e(同上图)
此实验计算机和交换机的IP地址和网关不变,但要求交换机工作在两个VLAN的情况下,
一个是原有的默认VALN,另一个是新设置的VLAN2,含f0/5、f0/6。
1.设置交换机,增加一个vlan2
1. switch#vlandatabase
2. Switch(vlan)#vlan2
3. Switch(vlan)#exit
4. Switch#conft
5. Switch(config)#hostnameSWA
6. SWA(config)#intf0/5
7. SWA(config-if)#switchportaccessvlan2
8. SWA(config-if)#intf0/6
9. SWA(config-if)#switchportaccessvlan2
10. SWA(config-if)#intf0/1
11. SWA(config-if)#switchportmodetrunk
12. SWA(config-if)#
13. SWA#shvlan
14. SWA#shrun(检查设置情况)
复制代码
2.路由器f0/0有两个子接口
1. roa(config)intf0/0
2. roa(config-if)#intf0/0.1
3. roa(config-subif.1)#encapsulationisl
4. roa(config-subif.1)#ipaddress10.65.1.2255.255.0.0
5. roa(config-subif.1)#noshut
6. roa(config-subif.1)#intf0/0.2
7. roa(config-subif.2)#encapsulationisl
8. roa(config-subif.2)#ipaddress10.66.1.2255.255.0.0
9. roa(config-subif.2)#noshut
10. roa#shrun
复制代码
检查计算机ip地址与子接口ip地址同网络,计算机网关指向网络的子接口ip。
3.测试可通性
1. [root#PCAroot]#ping10.66.1.1
2. [root#PCAroot]#ping10.66.1.2
3. [root#PCBroot]#ping10.65.1.1
4. [root#PCBroot]#ping10.65.1.2
复制代码
在使用一个路由器接口的情况下,如果下接的网络含有不同的VLAN,则要求路由