路由器交换机配置命令及模拟软件中的实验内容.docx
- 文档编号:6429281
- 上传时间:2023-01-06
- 格式:DOCX
- 页数:41
- 大小:868.32KB
路由器交换机配置命令及模拟软件中的实验内容.docx
《路由器交换机配置命令及模拟软件中的实验内容.docx》由会员分享,可在线阅读,更多相关《路由器交换机配置命令及模拟软件中的实验内容.docx(41页珍藏版)》请在冰豆网上搜索。
路由器交换机配置命令及模拟软件中的实验内容
路由器、交换机配置命令
计算机命令:
PCAlogin:
root;使用root用户
password:
linux;口令是linux
#shutdown-hnow;关机
#init0;关机
#logout
#login
#ifconfig;显示IP地址
#ifconfigeth0
#ifconfigeht0
#routeadd0.0.0.0gw
#routedel0.0.0.0gw
#routeadddefaultgw
#routedeldefaultgw
#route;显示网关
#ping
#telnet
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
交换机基本状态:
switch:
;ROM状态,路由器是
rommon>
hostname>;用户模式
hostname#;特权模式
hostname(config)#;全局配置模式
hostname(config-if)#;接口状态
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
交换机口令设置:
switch>enable;进入特权模式
switch#configterminal;进入全局配置模式
switch(config)#hostname
switch(config)#enablesecretxxx;设置特权加密口令为xxx
switch(config)#enablepasswordxxx;设置特权非密口令为xxx
switch(config)#lineconsole0;进控制台口(Rs232)初始化
switch(config-line)#linevty04;进入虚拟终端virtualtty
switch(config-line)#login;允许登录
switch(config-line)#passwordxx;设置登录口令xx
switch#exit;返回命令
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
交换机VLAN设置:
switch#vlandatabase;进入VLAN设置
switch(vlan)#vlan2;建VLAN2
switch(vlan)#novlan2;删vlan2
switch(config)#intf0/1;进入端口1
switch(config-if)#switchportaccessvlan2;当前端口1加入VLAN2
switch(config-if)#switchportmodetrunk;设置为干线
switch(config-if)#switchporttrunkallowedvlan1,2;设置允许的vlan
switch(config-if)#switchporttrunkencapdot1q;设置vlan中继
switch(config)#vtpdomain
switch(config)#vtppassword
switch(config)#vtpmodeserver
switch(config)#vtpmodeclient
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
交换机设置IP地址:
switch(config)#interfacevlan1;进入vlan1
switch(config-if)#ipaddress
switch(config)#ipdefault-gateway
switch#dirflash:
;查看内存
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
交换机显示命令:
switch#write;写入保存
switch#showvtp
switch#showrun;查看当前配置信息
switch#showvlan;看VLAN
switch#showinterface;显示所有端口信息
switch#showintf0/0;显示端口0的信息
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
路由器显示命令:
router#showrun;显示接口
router#showinterface;显示接口
router#showiproute;显示路由
router#showcdpnei;看邻居
router#reload ;重新起动
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
设置口令:
router>enable;进入特权模式
router#configterminal;进入全局配置模式
router(config)#hostname
router(config)#enablesecretxxx;设置特权加密口令为xxx
router(config)#enablepasswordxxx;设置特权非密口令为xxx
router(config)#lineconsole0;进控制台口(Rs232)初始化
router(config-line)#linevty04;进入虚拟终端virtualtty
router(config-line)#login;允许登录
router(config-line)#passwordxx;设置登录口令xx
router(config)#(Ctrl+z);返回特权模式
router#exit;返回命令
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
配置IP地址:
router(config)#ints0/0;进行串Serail接口
router(config-if)#noshutdown;起动接口
router(config-if)#clockrate64000;设置时钟
router(config-if)#ipaddress10.1.1.1255.255.0.0;设置IP地址和子网掩码
router(config-if)#ipadd10.1.1.2255.255.0.0second;
router(config-if)#intf0/0.1;进入子接口
router(config-subif.1)#ipaddress
router(config-subif.1)#encapsulationdot1q
router(config)#config-register0x2142;跳过配置文件
router(config)#config-register0x2102;正常使用配置文件
router#reload;重新引导
复制操作:
router#copyrunning-configstartup-config;存配置
router#copyrunning-configtftp;上载
router#copystartup-configtftp
router#copytftpflash:
;特权模式下升级IOS
router#copytftpstartup-config ;下载配置文件到nvram
ROM状态:
Ctrl+Break;进入ROM监控状态
rommon>confreg0x2142;跳过配置,263645xx
rommon>confreg0x2102;使用配置,恢复工作状态
rommon>reset ;重新引导,等效于重开机
rommon>copyxmodem:
rommon>IP_ADDRESS=10.65.1.2;设置路由器IP
rommon>IP_SUBNET_MASK=255.255.0.0;设置路由器掩码
rommon>TFTP_SERVER=10.65.1.1;指定TFTP服务器IP
rommon>TFTP_FILE=c2600.bin;所要下载的文件
rommon>tftpdnld;ROM监控状态下升级IOS
rommon>dirflash:
;查看闪存中的内容
rommon>boot;引导IOS
静态路由:
iproute
router(config)#iproute10.1.0.0255.255.0.010.2.1.1
router(config)#iproute0.0.0.00.0.0.01.1.1.2
动态路由:
router(config)#iprouting;启动路由
router(config)#routerrip;启动RIP路由协议。
router(config-router)#network
router(config-router)#negihbor
帧中继命令:
router(config)#frame-relayswitching;使能帧中继交换
router(config-s0)#encapsulationframe-relay;使能帧中继
router(config-s0)#frame-relayintf-typeDCE;DCE端(需要配虚电路)
router(config-s0)#frame-relaylocal-dlci20;配置虚电路号
基本访问控制列表:
router(config)#access-list
router(config)#interface
denyany
router(config-if)#ipaccess-group
out
例:
RB(config)#access-list4permit10.8.1.1
RB(config)#access-list4deny10.8.1.00.0.0.255
RB(config)#access-list4permit10.8.0.00.0.255.255
RB(config)#access-list4deny10.0.0.00.255.255.255
RB(config)#access-list4permitany
RB(config)#intf0/0
RB(config-if)#ipaccess-group4in
扩展访问控制列表:
access-list wild>[type] access-list wild>[port] 例1: router(config)#access-list101denyicmpany10.64.0.20.0.0.0echo router(config)#access-list101permitipanyany router(config)#ints0/0 router(config-if)#ipaccess-group101in 例2: router(config)#access-list102denytcpany10.65.0.20.0.0.0eq80 router(config)#access-list102permitipanyany router(config)#interfaces0/1 router(config-if)#ipaccess-group102out router(config)#noaccess-list102 router(config-if)#noipaccess-group101in ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^交换机路由器模拟软件中的实验 实验一 实验一口令和主机名设置 1.口令和设备名设置 添加一个交换机或一个路由器,先对交换机进行操作,双击SwitchA switch>en password: ;第一次密码为空,直接回车 switch#conft;进入全局配置模式 switch(config)#hostnameswa;设置交换机名 swa(config)#enablesecretaaa;设置特权加密口令为aaa swa(config)#enablepasswordaax;设置特权非密口令为aax swa(config)#lineconsole0;进入控制台口(Rs232)状态 swa(config-line)#login;允许登录 swa(config-line)#passwordaa;设置登录口令aa swa(config-line)#linevty04;进入虚拟终端virtualtty swa(config-line)#login;允许登录 swa(config-line)#passworda;设置登录口令a swa(config-line)#exit;返回上一层 swa(config)#exit;返回上一层 swa#shrun;看配置信息 swa#exit;返回命令 swa>en password: ;哪一个口令可以通过 双击ROA对路由器进行与交换机类似的设置。 2.清除口令 清除交换机口令,实际中是在开机时按住交换机上的mode钮,本模拟机按 Ctrl+Break。 口令请除,可以重新配置口令了。 清除路由器口令,实际中是在开机时上电时,按Ctrl+Break,本模拟机按 Ctrl+Break。 参考操作如下: 双击RouterA。 先配置路由的特权口令: router>en password: ;第一次密码为空,直接回车 router#conft;进入全局配置模式 router(config)#enablesecretaaa;设置特权加密口令为aaa router(config)#exit;返回 router#exit router>en password: aaa router# 清除路由器的口令是在假设口令丢失情况下使用的方法,具体的操作是 开机进入rommon状态,打开寄存器配置开关: router#reload;重新启动,按Ctrl+Break rommon> rommon>confreg0x2142;跳过配置,26xx36xx45xx rommon>reset ;重新引导,等效于重开机 router>en password: router#conft router(config)#enablesecretbbb;设置特权加密口令为aaa router(config)#config-register0x2102;正常使用配置文件 router(config)#exit router#exit router>en password: bbb router# 在实际工作中一般要备份路由器的配置文件,当系统有问题时将配置文件复原。 可以这样操作: router#dirnvram: router#copynvram: startup-configtftp: router#copytftp: startup-configflash: router# 实验二 实验二计算机与交换机IP地址设置 1.双击PCA,输入用户名和入口令,打“? ”可以求得帮助。 PCAlogin: root Password: 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,输入用户名和入口令,打“? ”可以求得帮助。 PCBlogin: root Password: linux 设置IP: [root#PCBroot]#ifconfigeth010.65.1.2netmask255.255.0.0 [root#PCBroot]#ifconfig 设置网关: [root#PCBroot]#routeadddefaultgw10.65.1.9 [root#PCBroot]#route 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 查看当前配置: switch#shrun 测试联通情况: switch#ping10.65.1.1 switch#ping10.65.1.2 switch#ping10.65.1.3 switch#ping10.65.1.4没有这个IP,所以不通。 4.双击PCA [root@PCAroot]#ping10.65.1.1 [root@PCAroot]#ping10.65.1.2 [root@PCAroot]#ping10.65.1.3 [root@PCAroot]#ping10.65.1.4没有这个IP,所以不通。 5.修改PCB的ip地址 修改为不同网段的一个ip地址,为10.66.1.2,再从PCAPingPCB。 [root#PCBroot]#ifconfigeth010.66.1.2netmask255.255.0.0 [root@PCAroot]#ping10.66.1.2 修改为相同网段的一个ip地址,为10.65.1.4,再从PCAPingPCB。 [root#PCBroot]#ifconfigeth010.65.1.4netmask255.255.0.0 [root@PCAroot]#ping10.65.1.4 断开交换机与PCA计算机连线,理解如下操作: [root@PCAroot]#ping10.65.1.4 [root@PCAroot]#ping10.65.1.1 [root@PCAroot]#ping127.0.0.1 实验三 实验三交换机VLAN实验 1.规划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/5~f0/7vlan2,f0/8为trunk SWB的f0/5~f0/7valn2,f0/1为trunk 用ping命令测试,从PCA和PCB到各点的连通情况。 由于交换机初始化为vlan1, 所以同网段的可以通。 即PCA到PCC、SWA、SWB是通的,而PCB只与PCD通。 2.设置VLAN 双击SwitchA,改名SwitchA为SWA,建立2个vlan,分别为2、3 switch>en switch#shvlan switch#conft switch(config)#hosthameSWA switch(config)#exit SWA#vlandatabase SWA(vlan)#vlan2 SWA(vlan)#vlan3 SWA(vlan)#exit 将SWA交换机的f0/5,f0/6,f0/7加入到vlan2 SWA(config)#intf0/5 SWA(config-if)#switchportaccessvlan2 SWA(config-if)#intf0/6 SWA(config-if)#switchportaccessvlan2 SWA(config-if)#intf0/7 SWA(config-if)#switchportaccessvlan2 SWA(config-if)#end SWA#shvlan 在SWB上与SWA上类似,将SWB交换机f0/5,f0/6,f0/7加入到vlan2。 3.测试可通性 从PCA到PCC测试: [root@PCAroot]#ping10.65.1.3(通) 从PCA到PCB测试: [root@PCAroot]#ping10.66.1.1(不通,因为不同网段,不同VLAN) 从PCB到PCD测试: [root@PCBroot]#pin
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 路由器 交换机 配置 命令 模拟 软件 中的 实验 内容
![提示](https://static.bdocx.com/images/bang_tan.gif)