2022年Cisco路由器配置命令大全 .pdf

上传人:C****o 文档编号:39887587 上传时间:2022-09-08 格式:PDF 页数:21 大小:150.29KB
返回 下载 相关 举报
2022年Cisco路由器配置命令大全 .pdf_第1页
第1页 / 共21页
2022年Cisco路由器配置命令大全 .pdf_第2页
第2页 / 共21页
点击查看更多>>
资源描述

《2022年Cisco路由器配置命令大全 .pdf》由会员分享,可在线阅读,更多相关《2022年Cisco路由器配置命令大全 .pdf(21页珍藏版)》请在得力文库 - 分享文档赚钱的网站上搜索。

1、Cisco 路由器配置命令大全(1)模式转换命令用户模式-特权模式,使用命令 enable 特权模式-全局配置模式,使用命令 config t 全局配置模式-接口模式,使用命令 interface+接口类型+接口号 全局配置模式-线控模式,使用命令 line+接口类型+接口号 注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut do

2、wn 关闭接口no shutdown 打开接口ip add+ip 地址配置 IP 地址secondary+IP 地址为接口配置第二个IP 地址show interface+接口类型+接口号查看接口管理性show controllers interface 查看接口是否有DCE 电缆show history 查看历史记录show terminal 查看终端记录大小hostname+主机名配置路由器或交换机的标识config memory 修改保存在NVRAM中的启动配置exec timeout 0 0 设置控制台会话超时为0 service password-encryptin 手工加密所有密码

3、enable password+密码配置明文密码ena sec+密码配置密文密码line vty 0 4/15 进入 telnet 接口password+密码 配置 telnet 密码line aux 0 进入 AUX 接口password+密码 配置密码line con 0 进入 CON 接口password+密码 配置密码bandwidth+数字配置带宽no ip address 删除已配置的IP 地址show startup config 查看 NVRAM中的配置信息copy run-config atartup config 保存信息到NVRAM write 保存信息到NVRAM er

4、ase startup-config 清除 NVRAM 中的配置信息show ip interface brief 查看接口的谪要信息banner motd#+信息+#配置路由器或交换机的描素信息description+信息配置接口听描素信息名师资料总结-精品资料欢迎下载-名师精心整理-第 1 页,共 21 页 -vlan database 进入 VLAN 数据库模式vlan+vlan 号+名称创建 VLAN switchport access vlan+vlan 号 为 VLAN 为配接口interface vlan+vlan 号 进入 VLAN 接口模式ip add+ip 地址为 VLAN

5、 配置管理IP 地址vtp+service/tracsparent/client 配置 SW 的 VTP 工作模式vtp+domain+域名配置 SW 的 VTP 域名vtp+password+密码配置 SW 的密码switchport mode trunk 启用中继no vlan+vlan 号 删除 VLAN show spamming-tree vlan+vlan 号 查看 VLAN 生成树协议2.路由器配置命令ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设

6、置show ip protocols 显示了被配置在路由器上的路由选择协议,同时给出了在路由选择协议中使用的定时器等信息router rip 激活 RIP 协议network+直连网段发布直连网段interface lookback 0 激活逻辑接口passive-interface+接口类型+接口号配置接口为被动模式debug ip+协议动态查看路由更新信息undebug all 关闭所有DEBUG 信息router eigrp+as 号 激活 EIGRP 路由协议network+网段+子网掩码发布直连网段show ip eigrp neighbors 查看邻居表show ip eigrp

7、topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf+process-ID 激活 OSPF 协议network+直连网段+area+区域号发布直连网段show ip ospf 显示 OSPF 的进程号和ROUTER-ID encapsulation+封装格式更改封装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能show user 查看 SW 的在线用户clear line+线路号清除线路3.三层交换机配置命令配置一组二层端口configure terminal 进入配置状态

8、名师资料总结-精品资料欢迎下载-名师精心整理-第 2 页,共 21 页 -nterface range port-range 进入组配置状态配置三层端口configure terminal 进入配置状态interface fastethernet|gigabitethernet interface-id|vlan vlan-id|port-channel port-channel-number 进入端口配置状态no switchport 把物理端口变成三层口ip address ip_address subnet_mask 配置 IP 地址和掩码no shutdown 激活端口例:Switch

9、(config)#interface gigabitethernet0/2 Switch(config-if)#no switchport Switch(config-if)#ip address 192.20.135.21 255.255.255.0 Switch(config-if)#no shutdown 配置 VLAN configure terminal 进入配置状态vlan vlan-id 输入一个VLAN号,然后进入vlan 配态,可以输入一个新的VLAN号或旧的来进行修改。name vlan-name 可选)输入一个VLAN名,如果没有配置VLAN名,缺省的名字是VLAN号前面

10、用0 填满的 4 位数,如 VLAN0004是 VLAN4的缺省名字mtu mtu-size(可选)改变 MTU 大小例Switch#configure terminal Switch(config)#vlan 20 Switch(config-vlan)#name test20 Switch(config-vlan)#end 或Switch#vlan database Switch(vlan)#vlan 20 name test20 Switch(vlan)#exit 将端口分配给一个VLAN configure terminal 进入配置状态interface interface-id 进

11、入要分配的端口switchport mode access 定义二层口switchport access vlan vlan-id 把端口分配给某一VLAN 例Switch#configure terminal Enter configuration commands,one per line.End with CNTL/Z.Switch(config)#interface fastethernet0/1 Switch(config-if)#switchport mode access 名师资料总结-精品资料欢迎下载-名师精心整理-第 3 页,共 21 页 -Switch(config-if)

12、#switchport access vlan 2 Switch(config-if)#end Switch#配置 VLAN trunk configure terminal 进入配置状态interface interface-Id 进入端口配置状态switchport trunk encapsulation isl|dot1q|negotiate配置 trunk 封装 ISL 或 802.1Q 或自动协商switchport mode dynamic auto|desirable|trunk 配置二层trunk 模式。dynamic auto自动协商是否成为trunk dynamic des

13、irable把端口设置为trunk 如果对方端口是trunk,desirable,配置 Native VLAN(802.1q)或自动模式,trunk设置端口为强制的trunk 方式,而不理会对方端口是否为trunk switchport access vlan vlan-id 可选)指定一个缺省VLAN,如果此端口不再是trunk switchport trunk native vlan vlan-id 指定 802.1Q native VLAN号例:Switch#configure terminal Enter configuration commands,one per line.End

14、with CNTL/Z.Switch(config)#interface fastethernet0/4 Switch(config-if)#switchport mode trunk Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#end 定义 TRUNK 允许的 VLAN configure terminal 子 进入配置状态interface interface-id 进入端口配置switchport mode trunk 配置二层口为trunk switchport trunk allow

15、ed vlan add|all|except|remove vlan-list可选)配置 trunk 允许的 VLAN.使用 add,all,except,remove 关健字no switchport trunk allowed vlan 允许所有VLAN 通过例Switch(config)#interface fastethernet0/1 Switch(config-if)#switchport trunk allowed vlan remove 2 Switch(config-if)#end 配置 Native VLAN(802.1q)configure terminal 进入配置状态

16、interface interface-id 进入配置成802.1qtrunk 的端口switchport trunk native vlan vlan-Id 配置 native VLAN 号no switchport trunk native vlan 端口配置命令回到缺省的状态配置基于端口权值的负载均衡configure terminal 进入 Switch 1 配置状态vtp domain domain-name 配置 VTP 域名师资料总结-精品资料欢迎下载-名师精心整理-第 4 页,共 21 页 -vtp mode server 将 Switch 1 配置成 VTP server.s

17、how vtp status 验证 VTP 的配置show vlan 验证 VLAN configure terminal 进入配置状态interface fastethernet 0/1 进入 F0/1 端口switchport trunk encapsulation isl|dot1q|negotiate配置 trunk 封装switchport mode trunk 配置成 trunk show interfaces fastethernet0/1 switchport 验证 VLAN 配置按以上步骤对想要负载均衡的接口进行配置在另一个交换机上进行此配置show vlan 当 trunk

18、 已经起来,在switch2 上验证已经学到相的vlan 配置configure terminal 在 Switch 1 上进入配置状态interface fastethernet0/1 进入要配置的端口spanning-tree vlan 8 port-priority 10 将端口权值10 赋与 VLAN 8.spanning-tree vlan 9 port-priority 10 将端口权值10 赋与 VLAN 9.spanning-tree vlan 10 port-priority 10 将端口权值10 赋与 VLAN 10.interface fastethernet0/2 进入

19、 F0/2 spanning-tree vlan 3 port-priority 10 将端口权值10 赋与 VLAN 3.spanning-tree vlan 4 port-priority 10 将端口权值10 赋与 VLAN 4 spanning-tree vlan 5 port-priority 10 将端口权值10 赋与 VLAN 5 spanning-tree vlan 6 port-priority 10 将端口权值10 赋与 VLAN 10 end 退出show running-config 验证配置copy running-config startup-config 保存配置

20、配置 STP 路径值的负载均衡Trunk1 走 VLAN8 10,Trunk2 走 VLAN2 4 configure terminal 进入Switch 1 配置状态interface fastethernet 0/1 进入 F0/1 switchport trunk encapsulation isl|dot1q|negotiate配置封装switchport mode trunk 配置 Trunk,缺省是 ISL 封装exit 退回在 F0/2 口上重复24 步骤exit 退回show running-config 验证配置show vlan 验证 switch1 已经学到Vlan co

21、nfigure terminal 进入配置状态interface fastethernet 0/1 进入 F0/1 spanning-tree vlan 2 cost 30 设置 Vlan2 生成树路径值为30 spanning-tree vlan 3 cost 30 设置 Vlan3 生成树路径值为30 spanning-tree vlan 4 cost 30 设置 Vlan4 生成树路径值为30 end 退出在 switch1 的 F0/2 上重复 911 步骤设置VLAN8,9,10 生成树路径值为30 名师资料总结-精品资料欢迎下载-名师精心整理-第 5 页,共 21 页 -end 退

22、出show running-config 验证配置copy running-config startup-config 保存配置补充:CISCO 命令集路由选择协议及排障*ip route 命令Router(config)#ip route 子网掩码 管理距离0255,默认为1(注:静态地址配置)*ip default-network命令Router(config)#ip default-network (注:配合路由协使用,用其中的一个动态路由号作默认路由配置)Router(config)#ip route 0.0.0.0 0.0.0.0 (注:只有一个公网地址时,在出口路由器上的配置)*内

23、部路由选择协议*使用 router 和 network 命令Router(config)#router 自主系统号 Router(config-router)#network Router(config-router)#network *路由信息协议RIP Router(config)#router rip Router(config-router)#network Router#show ip protocols Router#show ip route Router#debug ip rip*内部网关路由协议IGRP Router(config)#router igrp Router(co

24、nfig-router)#network Router#show ip interface Router#show ip protocols Router#show ip route Router#debug ip rip 名师资料总结-精品资料欢迎下载-名师精心整理-第 6 页,共 21 页 -*排除网络故障排除网络故障的一个总体模型Router#ping Router#show ip route Router#show interface Router#show run*IP 的故故障排除检查可用的路由Router#show ip route 27.4.4 跟踪路由(Tracing the

25、 Route)SUN-A traceroute C:windows winipcfg C:windows ipconfig C:windows ipconfig/all C:windows tracert 使用扩展的ping 来跟踪连接性Router#ping*其它可能的故障一个地址解析(ARP)的故障Router#show arp Router#show interface C:windows arp-a SUN-A arp a 验证终端系统的路由表C:windows netstat rn C:windows route f add 0.0.0.0 mask 0.0.0.0 C:window

26、s route f print|add|delete|change destination mask netmask gateway C:windows route add mask C:windows route delete mask C:windows nbtstat SUN-A netstat-rn 路由器名师资料总结-精品资料欢迎下载-名师精心整理-第 7 页,共 21 页 -CISCO 交换机配置命令大全2009-08-13 21:131.在基于 IOS 的交换机上设置主机名/系统名:switch(config)#hostname hostname 在基于 CLI 的交换机上设置主

27、机名/系统名:switch(enable)set system name name-string 2.在基于 IOS 的交换机上设置登录口令:switch(config)#enable password level 1 password 在基于 CLI 的交换机上设置登录口令:switch(enable)set password switch(enable)set enalbepass 3.在基于 IOS 的交换机上设置远程访问:switch(config)#interface vlan 1 switch(config-if)#ip address ip-address netmask swi

28、tch(config-if)#ip default-gateway ip-address 在基于 CLI 的交换机上设置远程访问:switch(enable)set interface sc0 ip-address netmask broadcast-address switch(enable)set interface sc0 vlan switch(enable)set ip route default gateway 4.在基于 IOS 的交换机上启用和浏览CDP 信息:switch(config-if)#cdp enable switch(config-if)#no cdp enabl

29、e 为了查看 Cisco 邻接设备的CDP 通告信息:switch#show cdp interface type modle/port switch#show cdp neighbors type module/port detail 在基于 CLI 的交换机上启用和浏览CDP 信息:switch(enable)set cdp enable|disable module/port 为了查看 Cisco 邻接设备的CDP 通告信息:switch(enable)show cdp neighborsmodule/port vlan|duplex|capabilities|detail 5.基于 I

30、OS 的交换机的端口描述:switch(config-if)#description description-string 基于 CLI 的交换机的端口描述:switch(enable)set port name module/number description-string 名师资料总结-精品资料欢迎下载-名师精心整理-第 8 页,共 21 页 -6.在基于 IOS 的交换机上设置端口速度:switch(config-if)#speed10|100|auto 在基于 CLI 的交换机上设置端口速度:switch(enable)set port speed moudle/number 10|

31、100|auto switch(enable)set port speed moudle/number 4|16|auto 7.在基于 IOS 的交换机上设置以太网的链路模式:switch(config-if)#duplex auto|full|half 在基于 CLI 的交换机上设置以太网的链路模式:switch(enable)set port duplex module/number full|half 8.在基于 IOS 的交换机上配置静态VLAN:switch#vlan database switch(vlan)#vlan vlan-num name vla switch(vlan)#

32、exit switch#configure teriminal switch(config)#interface interface module/number switch(config-if)#switchport mode access switch(config-if)#switchport access vlan vlan-num switch(config-if)#end 在基于 CLI 的交换机上配置静态VLAN:switch(enable)set vlan vlan-num name name switch(enable)set vlan vlan-num mod-num/po

33、rt-list 9.在基于 IOS 的交换机上配置VLAN 中继线:switch(config)#interface interface mod/port switch(config-if)#switchport mode trunk switch(config-if)#switchport trunk encapsulation isl|dotlq switch(config-if)#switchport trunk allowed vlan remove vlan-list switch(config-if)#switchport trunk allowed vlan add vlan-l

34、ist 在基于 CLI 的交换机上配置VLAN中继线:switch(enable)set trunk module/port on|off|desirable|auto|nonegotiate Vlan-range isl|dotlq|dotl0|lane|negotiate 10.在基于 IOS 的交换机上配置VTP 管理域:switch#vlan database switch(vlan)#vtp domain domain-name 在基于 CLI 的交换机上配置VTP 管理域:switch(enable)set vtp domain domain-name 11.在基于 IOS 的交换

35、机上配置VTP 模式:switch#vlan database 名师资料总结-精品资料欢迎下载-名师精心整理-第 9 页,共 21 页 -switch(vlan)#vtp domain domain-name switch(vlan)#vtp sever|cilent|transparent switch(vlan)#vtp password password 在基于 CLI 的交换机上配置VTP 模式:switch(enable)set vtp domain domain-name mode sever|cilent|transparent password password 12.在基于

36、IOS 的交换机上配置VTP 版本:switch#vlan database switch(vlan)#vtp v2-mode 在基于 CLI 的交换机上配置VTP 版本:switch(enable)set vtp v2 enable 13.在基于 IOS 的交换机上启动VTP 剪裁:switch#vlan database switch(vlan)#vtp pruning 在基于 CL I 的交换机上启动VTP 剪裁:switch(enable)set vtp pruning enable 14.在基于 IOS 的交换机上配置以太信道:switch(config-if)#port group

37、 group-number distribution source|destination 在基于 CLI 的交换机上配置以太信道:switch(enable)set port channel moudle/port-range modeon|off|desirable|auto 15.在基于 IOS 的交换机上调整根路径成本:switch(config-if)#spanning-tree vlan vlan-list cost cost 在基于 CLI 的交换机上调整根路径成本:switch(enable)set spantree portcost moudle/port cost swit

38、ch(enable)set spantree portvlancost moudle/port cost costvlan-list 16.在基于 IOS 的交换机上调整端口ID:switch(config-if)#spanning-treevlan vlan-listport-priority port-priority 在基于 CLI 的交换机上调整端口ID:switch(enable)set spantree portpri mldule/portpriority switch(enable)set spantree portvlanpri module/portpriority vla

39、ns 17.在基于 IOS 的交换机上修改STP 时钟:switch(config)#spanning-tree vlan vlan-list hello-time seconds switch(config)#spanning-tree vlan vlan-list forward-time seconds switch(config)#spanning-tree vlan vlan-list max-age seconds 在基于 CLI 的交换机上修改STP 时钟:switch(enable)set spantree hello intervalvlan switch(enable)se

40、t spantree fwddelay delay vlan 名师资料总结-精品资料欢迎下载-名师精心整理-第 10 页,共 21 页 -switch(enable)set spantree maxage agingtiamevlan 18.在基于 IOS 的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast 在基于 CLI 的交换机端口上启用或禁用Port Fast 特征:switch(enable)set spantree portfast module/portenable|disable 19.在基于 IOS

41、 的交换机端口上启用或禁用UplinkFast 特征:switch(config)#spanning-tree uplinkfast max-update-rate pkts-per-second 在基于 CLI 的交换机端口上启用或禁用UplinkFast 特征:switch(enable)set spantree uplinkfast enable|disablerate update-rate all-protocols off|on 20.为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP 地址,然后使用下列命令:switch(config)#cluster enab

42、le cluster-name 21.为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable)clear trunk module/port vlan-range 22.用 show vtp domain 显示管理域的VTP 参数.23.用 show vtp statistics 显示管理域的VTP 参数.24.在 Catalyst 交换机上定义TrBRF 的命令如下:switch(enable)set vlan vlan-name name name type trbrf bridge bridge-numstp ieee|ibm 25.在 Catalyst 交换机上定

43、义TrCRF 的命令如下:switch(enable)set vlan vlan-num name name type trcrf ring hex-ring-num|decring decimal-ring-num parent vlan-num 26.在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给 VLAN分配端口:switch(enable)set vlan vlan-num mod-num/port-num 27.命令 show spantree显示一个交换机端口的STP 状态.28.配置一个ELAN 的 LES 和 BUS,可以使用下列

44、命令:ATM(config)#interface atm number.subint multioint ATM(config-subif)#lane serber-bus ethernet elan-name 29.配置 LECS:ATM(config)#lane database database-name ATM(lane-config-databade)#name elan1-name server-atm-address les1-nsap-address ATM(lane-config-databade)#name elan2-name server-atm-address les

45、2-nsap-address ATM(lane-config-databade)#name 名师资料总结-精品资料欢迎下载-名师精心整理-第 11 页,共 21 页 -30.创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)#interface atm number ATM(config-if)#lane config database database-name ATM(config-if)#lane config auto-config-atm-address 31.将每个 LEC 配置到一个不同的ATM 子接口上.命令如下:ATM(config)#interfa

46、ce atm number.subint multipoint ATM(config)#lane client ethernet vlan-num elan-num 32.用 show lane server 显示 LES 的状态.33.用 show lane bus 显示 bus的状态.34.用 show lane database显示 LECS 数据库可内容.35.用 show lane client 显示 LEC 的状态.36.用 show module 显示已安装的模块列表.37.用物理接口建立与VLAN 的连接:router#configure terminal router(con

47、fig)#interface media module/port router(config-if)#description description-string router(config-if)#ip address ip-addr subnet-mask router(config-if)#no shutdown 38.用中继链路来建立与VLAN 的连接:router(config)#interface module/port.subinterface router(config-ig)#encapsulationisl|dotlq vlan-number router(config-i

48、f)#ip address ip-address subnet-mask 39.用 LANE 来建立与VLAN 的连接:router(config)#interface atm module/port router(config-if)#no ip address router(config-if)#atm pvc 1 0 5 qsaal router(config-if)#atm pvc 2 0 16 ilni router(config-if)#interface atm module/port.subinterface multipoint router(config-if)#ip ad

49、dress ip-address subnet-mask router(config-if)#lane client ethernet elan-num router(config-if)#interface atm module/port.subinterface multipoint router(config-if)#ip address ip-address subnet-name router(config-if)#lane client ethernet elan-name router(config-if)#名师资料总结-精品资料欢迎下载-名师精心整理-第 12 页,共 21 页

50、 -40.为了在路由处理器上进行动态路由配置,可以用下列IOS 命令来进行:router(config)#ip routing router(config)#router ip-routing-protocol router(config-router)#network ip-network-number router(config-router)#network ip-network-number 41.配置默认路由:switch(enable)set ip route default gateway 42.为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(conf

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知得利文库网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号-8 |  经营许可证:黑B2-20190332号 |   黑公网安备:91230400333293403D

© 2020-2023 www.deliwenku.com 得利文库. All Rights Reserved 黑龙江转换宝科技有限公司 

黑龙江省互联网违法和不良信息举报
举报电话:0468-3380021 邮箱:hgswwxb@163.com