思科路由器和交换机各种命令Word格式.docx
- 文档编号:19233775
- 上传时间:2023-01-04
- 格式:DOCX
- 页数:16
- 大小:536.30KB
思科路由器和交换机各种命令Word格式.docx
《思科路由器和交换机各种命令Word格式.docx》由会员分享,可在线阅读,更多相关《思科路由器和交换机各种命令Word格式.docx(16页珍藏版)》请在冰豆网上搜索。
switch#showvtpstatus查看VTP配置信息
switch#showinterface;
查看所有的端口信息
switch#showinterfacef0/3;
查看指定的f0/3快速以太网端口信息
switch#showinterfacef0/3switchport查看指定的f0/3快速以太网端口trunk信息
switch#showipinerfacebrief用类似表格的形式列出路由器或者交换机接口对应的第三层配置,这个命令是使用频率最高的一个,也是最实用的一个。
switch#showspanning-tree查看交换机生成树协议情况
switch#showspanning-treevlan2查看交换机VLAN2的生成树协议情况
switch#showspanning-treeinterfacef0/1查看交换机F0/1端口生成树协议情况
switch#showcdp显示交换机当前邻居更新信息
switch#showcdpneighbor;
显示邻居直连路由信息
switch#showcdpneighbordetail显示邻居直连路由详细信息
switch#showcdpinterface显示所有端口是否开启cdp功能
switch(config-if)#nocdpenable关闭指定端口的cdp功能
switch(config-if)#cdpenable打开指定端口的cdp功能
switch(config)#nocdprun关闭所有端口的cdp功能
switch(config)#cdprun打开所有端口的cdp功能
switch#showversion查看交换机版本信息
switch#showflash查看flash里面的IOS信息
switch#showmac-address-table查看交换机所有端口的MAC
地址信息
switch#showlogging查看交换机日志信息
交换机口令设置:
switch>
enable;
进入特权模式
switch#configterminal;
进入全局配置模式
switch(config)#hostname<
hostname>
设置交换机的主机名
switch(config)#enablesecretxxx;
设置特权加密口令(真正进入enable特权模式需要输入这个口令)
switch(config)#enablepasswordxxa;
设置特权非密口令
登录console控制台需要输入密码的方法
switch(config)#lineconsole0;
进入console控制台口
switch(config-line)#login;
允许登录控制台
switch(config-line)#passwordxx设置登陆控制台口口令
switch(config-line)#exec-timeout00设置控制台口多长时间不操作会自动退出,前面一个0表示分钟后面一个0表示秒两个都是0表示一直不会自动退出。
switch(config-line)#loggingsy
switch(config-line)#noipdomain-lookup关闭域名查找功能(如果你输错了命令,switch会认为你输入的是域名,就会查找。
。
浪费时间。
noipdomain-lookup就是取消这种查找)
登录telnet虚拟终端需只要输入密码的方法
switch(config-line)#linevty04;
进入telnet虚拟终端
允许登录虚拟终端
switch(config-line)#passwordxx;
设置登录虚拟终端口令xx
登录telnet虚拟终端需要输入用户名和密码的方法
switch(config)#usernameadminpassword12345设置登录交换机的用户名为admin密码12345
switch(config)#linevty04进去虚拟终端
switch(config-line)#loginlocal设定通过虚拟终端登录需要输入用户名
switch#exit;
返回命令
交换机常规配置
switch(config)#nomac-address-tablestatic(需要删掉的mac地址)fastethernetf0/7清除掉交换机F0/7端口的MAC地址
switch(config-if)#duplexfull/halt/auto;
设置交换机端口工作方式
(full全双工halt半双工模式auto自动检测)
switch(config-if)#speed10/100/1000/auto;
设置交换机对应端口局域网交换速度
switch(config)#interfacef0/1进入快速以太网端口端口f0/1
switch(config-if)#descriptiontrunkinterface设置交换机端口描述,描述为trunkinterface
switch(config)#interfacevlan1;
进入vlan1
switch(config)#interfacerangef0/1–24进入快速以太网端口f0/1到f0/24
交换机备份还原文件操作:
switch#copyrunning-configstartup-config将RAM的当前配置存储到NVRAM
switch#copyrunning-configtftp备份RAM存储的配置信息到tftp
switch#copystartup-configtftp备份NVRAM配置备份到tftp
switch#copyflashtftp;
备份路由器的flash文件IOS到tftp
switch#copytftpstartup-config;
恢复NVRAM配置文件
switch#copytftprunning-config恢复NVRAM配置文件
switch#copytftpflash:
将flash文件IOS从tftp恢复到路由器
switch#erasestartup-config清除NVRAM存储的配置文件
switch#deletevlan.dat将所有的VLAN的信息恢复到出厂配置自建的vlan信息实际上保存在交换机Flash的vlan.dat文件内,该文件不会在删除startup-config的时候被删除,也不会在reload之后清空内容或被删除,需要手动进行清除。
Cisco清除配置使用:
erasestartup-config(删除NVRAM中的内容),然后重启路由器reload
交换机生成树协议配置
switch(config)#spanning-treevlan2开启VLAN2的生成树协议
switch(config)#nospanning-treevlan2关闭VLAN2生成树协议
switch(config)#spanning-treevlan2priority4096设定这个VLAN2STP优先级为4096(取值范围为0~61440之间的4096的倍数,即取值范围为0、4096、8192…61440.设定数值越小,优先级越高,交换机默认优先级为32768一个局域网(或者一个VLAN内优先级最低的交换机会成为根交换机)
switch(config)#spanning-treevlan2rootprimary设定这个交换机为vlan2的最优先级的交换机,也就是根交换机)
switch(config-if)#spanning-treevlan2port-priority32设定这个交换机端口的优先级为32(端口优先级取值范围为0~240之间的16倍数,即取值范围为 0、16、32、48…240.交换机端口默认优先级为128设定数值越小,优先级越高)
switch(config-if)#spanning-treevlan2cost
交换机端口镜像配置
Switch(config)#monitorsession1destinationinterfacef0/1配置f0/1为监控端口。
Switch(config)#monitorsession1sourceinterfacef0/2both配置f0/2为被监控端口,且出入双向数据均被监控。
Switch(config)#monitorsession1sourceinterfacef0/2-f0/10both配置f0/1到f0/10为被监控端口,且出入双向数据均被监控。
Switch(config)#monitorsession1sourcevlan2both配置整个vlan2为被监控端口,且出入双向数据均被监控。
Switch(config)#nomonitorsession1去掉监控1。
交换机VLAN设置:
switch#vlandatabase;
进入VLAN设置
switch(vlan)#vlan2;
建VLAN2
switch(vlan)#vlan2name<
name>
;
设置VLAN2的名字
switch(vlan)#novlan2;
删vlan2
switch(vlan)#vtpdomain<
设置发vtp域名
switch(vlan)#vtppassword<
word>
设置发vtp密码
switch(vlan)#vtpserver;
设置发vtp服务模式
switch(vlan)#vtpclient;
设置发vtp客户模式
switch(vlan)#vtppruning;
设置vtp修剪允许
switch(config)#iprouting启动三层交换机路由转发
switch(config-if)#switchportaccessvlan2;
当前端口加入vlan2
switch(config-if)#switchportmodetrunk;
设置为干线(开启trunk干线功能)
switch(config-if)#switchporttrunkencapsulationdot1q;
设置vlan中继(开启vlan封装的802.1q协议)
switch(config-if)#switchporttrunkallowedvlanall;
设置允许的vlan(这个命令为允许所有的vlan从这个干线进行传递)
switch(config-if)#switchporttrunkallowedvlan2,3设置允许的vlan(这个命令为允许vlan2和vlan3从这个干线进行传递)
交换机设置IP地址:
switch(config)#interfacef0/3进入这台交换机的f0/3端口
switch(config-if)#noswitchport开启三层交换机的三层功能可以给这个端口设定IP地址
switch(config-if)#ipaddress192.168.5.15255.255.255.0设置
交换机这个端口的IP地址
switch(config)#ipdefault-gateway192.168.5.1255.255.255.0设置交换机的默认网关
switch(config)#interfacevlan3进入这台交换机的vlan3
switch(config-if)#ipaddress192.168.3.200255.255.255.0设定这台交换机vlan3的IP地址
switch#dirflash:
查看闪存
基于交换机的MAC地址控制访问列表操作:
switch(config)#macaccess-listextendedningtao定义这个MAC地址的控制访问列表名称为ningtao
switch(config-extended-macl)#denyhost03E6.07C2.36D6any定义不允许MAC地址为03E6.07C2.36D6的主机访问任何网络包括因特网和局域网
switch(config-extended-macl)#permitanyany允许所有的MAC地址的主机访问任何网络
switch(config)#interfacef0/3进入交换机快速以太网端口f0/3
switch(config-if)#macaccess-groupningtaoin将对应MAC地址控制访问列表应用到对应端口
交换机基于IP跟MAC地址绑定的命令
switch(config)#arp192.168.1.2003E6.07C2.36D6ARPA将192.168.1.20这个IP地址跟03E6.07C2.36D6这个MAC地址绑定到一起
路由器支持的命令:
路由器基本状态:
router:
路由器的ROM态
router>
router#;
router(config)#;
router(config-if)#;
router(config-line)#;
router(config-router)#路由状态配置模式(动态路由配置模式)
router(dhcp-config)#路由器DHCP配置模式
路由器显示命令:
router#showrunning;
显示配置信息
router#showstartup查看交换机NVROM启动配置信息
router#showinterface;
显示接口信息
router#showinterfacef0/0;
查看指定端口信息
router#showiproute;
显示路由表信息
router#showipinerfacebrief用类似表格的形式列出路由器或者交换机接口对应的第三层配置,这个命令是使用频率最高的一个,也是最实用的一个。
router#showcdp显示路由器当前邻居更新信息
router#showcdpneighbor;
router#showcdpneighbordetail显示邻居直连路由详细信息
router#showcdpinterface显示所有端口是否开启cdp功能
router#showaccess-lists
router(config-if)#nocdpenable关闭指定端口的cdp功能
router(config-if)#cdpenable打开指定端口的cdp功能
router(config)#nocdprun关闭所有端口的cdp功能
router(config)#cdprun打开所有端口的cdp功能
router#reload ;
重新起动
router#showversion查看路由器版本信息
router#showflash查看flash里面的IOS信息
router#showlogging查看路由器日志信息
路由器口令设置:
router#configterminal;
router(config)#hostname<
设置路由器的主机名
router(config)#enablesecretxxx;
router(config)#enablepasswordxxx;
router(config)#lineconsole0;
进入控制台口
router(config-line)#login;
要求口令验证
router(config-line)#passwordxx设置登陆控制台口口令
router(config-line)#exec-timeout00设置控制台口多长时间不操作会自动退出,前面一个0表示分钟后面一个0表示秒两个都是0表示一直不会自动退出。
router(config-line)#loggingsy
router(config-line)#noipdomain-lookup关闭域名查找功能(如果你输错了命令,router会认为你输入的是域名,就会查找。
登录telnet控制台需要输入密码的方法
router(config-line)#linevty04;
进入虚拟终端
router(config-line)#passwordxx设置登录虚拟终端口令xx
router(config)#usernameadminpassword12345设置登录交换机的用户名为admin密码12345
router(config)#linevty04进去虚拟终端
router(config-line)#loginlocal设定通过虚拟终端登录需要输入用户名
router#exit;
router(config)#(Ctrl+z);
返回特权模式
路由器常规配置:
router#clockset18:
10:
5320march2010设定路由器时钟,例子设定的为2010年3月20日18点10分53秒
router(config)#interfaces0/0;
进入Serail接口(串口)
router(config)#interfacef0/0进入快速以太网接口f0/0
router(config-if)#noshutdown;
激活当前接口
router(config-if)#bandwidth64;
设定指定串口带宽
router(config-if)#clockrate64000;
设置同步时钟
router(config-if)#ipaddress<
ip>
<
netmask>
设置IP地址
second;
设置第二个IP
router(config-if)#interfacef0/0.1;
进入子接口
router(config-subif.1)#ipaddress<
设置子接口IP
router(config-subif.1)#encapsulationdot1q<
n>
绑定vlan中继(802.1q)协议
router(config)#config-register0x2142;
跳过配置文件
router(config)#config-register0x2102;
正常使用配置文件
router#reload;
重新引导
路由器文件操作:
router#copyrunning-configstartup-config将RAM的当前配置存储到NVRAM
router#copyrunning-configtftp备份RAM存储的配置信息到tftp
router#copystartup-configtftp备份NVRAM配置备份到tftp
router#copyflashtftp;
router#copytftpstartup-config;
router#copytftprunning-config恢复NVRAM配置文件
router#copytftpflash:
router#erasestartup-config清除NVRAM存储的配置文件
静态路由:
router(config)#iproute192.168.1.0255.255.255.0192.168.3.2;
静态路由举例
默认缺省路由
router(config)#iproute0.0.0.00.0.0.0192.168.10.5;
默认缺省路由举例
动态路由:
(特指RIPV2动态路由协议)
router(config)#iprouting;
启动路由转发
router(config)#routerrip;
启动RIP动态路由协议。
router(config-router)#version2设置启用RIP动态路由协议为RIPV2版本
router(config-router)#network<
ipaddress>
需要宣告的路由(只能宣告直连网络)
router(config-router)#neighbor<
点对点帧中继用。
(特指EIGRP动态路由协议)
router(config)#routereigrp<
autonomous-system1-65535均可>
启用EIGRP动态路由协议
router#showipeigrpneighbor显示EIGRP协议的邻居信息
router#showipeigrptopology显示EIGRP协议的拓扑表信息
router#showiprouteeigrp显示EIGRP协议的路由表信息
(特指OSPF
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 思科 路由器 交换机 各种 命令
![提示](https://static.bdocx.com/images/bang_tan.gif)