CISCO配置命令大全必学
- 格式:doc
- 大小:88.00 KB
- 文档页数:22
Cisco配置命令大全1. switch配置命令(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"configt"全局配置模式----接口模式,使用命令"interface+接口类型+接口号"全局配置模式----线控模式,使用命令"line+接口类型+接口号"注:用户模式:查看初始化的信息.特权模式:查看所有信息、调试、保存配置信息全局模式:配置所有信息、针对整个路由器或交换机的所有接口接口模式:针对某一个接口的配置线控模式:对路由器进行控制的接口配置(2)配置命令show running config 显示所有的配置show versin 显示版本号和寄存器值shut down 关闭接口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 设置控制台会话超时为0service password-encryptin 手工加密所有密码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 保存信息到NVRAMwrite 保存信息到NVRAMerase startup-config 清除NVRAM中的配置信息show ip interface brief 查看接口的谪要信息banner motd # +信息 + # 配置路由器或交换机的描素信息description+信息配置接口听描素信息vlan database 进入VLAN数据库模式vlan +vlan号+ 名称创建VLANswitchport access vlan +vlan号为VLAN为配接口interface vlan +vlan号进入VLAN接口模式ip add +ip地址为VLAN配置管理IP地址vtp+service/tracsparent/client 配置SW的VTP工作模式vtp +domain+域名配置SW的VTP域名vtp +password +密码配置SW的密码switchport mode trunk 启用中继no vlan +vlan号删除VLANshow spamming-tree vlan +vlan号查看VLA怕生成树议2. 路由器配置命令ip route+非直连网段+子网掩码+下一跳地址配置静态/默认路由show ip route 查看路由表show protocols 显示出所有的被动路由协议和接口上哪些协议被设置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 topology 查看拓扑表show ip eigrp traffic 查看发送包数量router ospf +process-ID 激活OSPF协议network+直连网段+area+区域号发布直连网段show ip ospf 显示OSPF的进程号和ROUTER-IDencapsulation+封装格式更改封装格式no ip admain-lookup 关闭路由器的域名查找ip routing 在三层交换机上启用路由功能show user 查看SW的在线用户clear line +线路号清除线路3. 三层交换机配置命令配置一组二层端口configure terminal 进入配置状态nterface range {port-range} 进入组配置状态配置三层端口configureterminal 进入配置状态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(config)# interface gigabitethernet0/2Switch(config-if)# no switchportSwitch(config-if)# ip address 192.20.135.21 255.255.255.0Switch(config-if)# no shutdown配置VLANconfigure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改。
CISCO路由器常用配置命令大全CISCO路由器常用配置命令大全Access-enable允许路由器在动态访问列表中创建临时访问列表入口Access-group把访问控制列表(ACL)应用到接口上Access-list定义一个标准的IP ACLAccess-template在连接的路由器上手动替换临时访问列表入口Appn向APPN子系统发送命令Atmsig执行ATM信令命令B 手动引导操作系统Bandwidth 设置接口的带宽Banner motd 指定日期信息标语Bfe 设置突发事件手册模式Boot system 指定路由器启动时加载的系统映像Calendar 设置硬件日历Cd 更改路径Cdp enable 允许接口运行CDP协议Clear 复位功能Clear counters清除接口计数器Clear interface 重新启动接口上的件逻辑Clockrate 设置串口硬件连接的时钟速率,如网络接口模块和接口处理器能接受的速率Cmt 开启/关闭FDDI连接管理功能Config-register 修改配置寄存器设置Configure 允许进入存在的配置模式,在中心站点上维护并保存配置信息Configure memory从NVRAM加载配置信息Configure terminal 从终端进行手动配置Connect 打开一个终端连接Copy 复制配置或映像数据Copy flash tftp 备份系统映像文件到TFTP服务器Copy running-config startup-config将RAM中的当前配置存储到NVRA MCopyrunning-configtftp 将RAM中的当前配置存储到网络TFTP服务器上Copy t 从TFTP服务器上下载新映像到FlashCopy t从TFTP服务器上下载配置文件Debug 使用调试功能Debug dialer 显示接口在拨什么号及诸如此类的信息Debug ip rip显示RIP路由选择更新数据Debug ipxrouting activity 显示关于路由选择协议(RIP)更新数据包的信息Debug ipx sap 显示关于SAP(业务通告协议)更新数据包信息Debug isdn q921 显示在路由器D通道ISDN接口上发生的数据链路层(第2层)的访问过程Debug ppp 显示在实施PPP中发生的业务和交换信息delete 删除文件Deny为一个已命名的IP ACL设置条件Dialer idle-timeout规定线路断开前的空闲时间的长度Dialer map 设置一个串行接口来呼叫一个或多个地点Dialer wait-for-carrier-time 规定花多长时间等待一个载体Dialer-group通过对属于一个特定拨号组的接口进行配置来访问控制。
3、常用配置命令3.1 把端口加入到vlanSwitch>enPassword:Switch #conf t /*进入配置模式*/Enter configuration commands, one per line. End with CNTL/Z.Switch (config)#inter f 0/1 /*进入端口*/Switch (config-if)#switchport access vlan X /*把端口加入到vlan X*/Switch (config-if)#endSwitch #wr /*保存*/Building configuration...[OK]Switch #3.2 添加新vlan(在核心交换机上写)Switch>enPassword:Switch #conf t /*进入配置模式*/Enter configuration commands, one per line. End with CNTL/Z.Switch (config)#Vlan X /*添加新Vlan*/Switch (config-vlan)#inter vlan X /*进入Vlan*/Switch (config-if)#ip address x.x.x.x 255.255.255.0/*设置vlan ip地址*/ Switch (config-if)#no shut3.3 配置trunk,透传vlanSwitch>enPassword:Switch #conf t /*进入配置模式*/Enter configuration commands, one per line. End with CNTL/Z.Switch (config)#inter fast 0/x /*进入级联端口*/Switch (config-if)#switchport mode trunk /*修改端口模式*/Switch (config-if)# switchport trunk allowed vlan all /*设置允许通过的vlan*/ 保存删除命令:所有的命令前面加no。
思科路由器(CiscoRouter)常用配置命令大全思科路由器(Cisco Router)常用配置命令大全1. Access-enable允许路由器在动态访问列表中创建临时访问列表入口2. Access-group把访问控制列表(ACL)应用到接口上3. Access-list定义一个标准的IP ACL4. Access-template在连接的路由器上手动替换临时访问列表入口5. Appn向APPN子系统发送命令6. Atmsig 执行ATM信令命令7. B 手动引导操作系统8. Bandwidth 设置接口的带宽9. Banner motd 指定日期信息标语10. Bfe 设置突发事件手册模式11. Boot system 指定路由器启动时加载的系统映像12. Calendar 设置硬件日历13. Cd 更改路径14. Cdp enable 允许接口运行CDP协议15. Clear 复位功能16. Clear counters 清除接口计数器17. Clear interface 重新启动接口上的件逻辑18. Clockrate 设置串口硬件连接的时钟速率,如网络接口模块和接口处理器能接受的速率19. Cmt 开启/关闭FDDI连接管理功能20. Config-register 修改设置寄存器设置21. Configure 允许进入存在的设置模式,在中心站点上维护并保存设置信息22. Configure memory 从NVRAM加载设置信息23. Configure terminal 从终端进行手动设置24. Connect 打开一个终端连接25. Copy 复制设置或映像数据26. Copy flash tftp 备份系统映像文件到TFTP服务器27. Copy running-config startup-config 将RAM中的当前设置存储到NVRAM28. Copy running-config tftp 将RAM中的当前设置存储到网络TFTP服务器上29. Copy tftp flash 从TFTP服务器上下载新映像到Flash30. Copy tftp running-config 从TFTP服务器上下载设置文件31. Debug 使用调试功能32. Debug dialer 显示接口在拨什么号及诸如此类的信息33. Debug ip rip 显示RIP路由选择更新数据34. Debug ipx routing activity 显示关于路由选择协议(RIP)更新数据包的信息35. Debug ipx sap 显示关于SAP(业务通告协议)更新数据包信息36. Debug isdn q921 显示在路由器D通道ISDN接口上发生的数据链路层(第2层)的访问过程37. Debug ppp 显示在实施PPP中发生的业务和交换信息38. Delete 删除文件39. Deny 为一个已命名的IP ACL设置条件40. Dialer idle-timeout 规定线路断开前的空闲时间的长度41. Dialer map 设置一个串行接口来呼叫一个或多个地点42. Dialer wait-for-carrier-time 规定花多长时间等待一个载体43. Dialer-group 通过对属于一个特定拨号组的接口进行设置来访问控制44. Dialer-list protocol 定义一个数字数据接受器(DDR)拨号表以通过协议或ACL和协议的组合来控制控制拨号45. Dir 显示给定设备上的文件46. Disable 关闭特许模式47. Disconnect 断开已建立的连接48. Enable 打开特许模式49. Enable password 确定一个密码以防止对路由器非授权的访问50. Enable password 设置本地口令控制不同特权级别的访问51. Enable secret 为enable password命令定义额外一层安全性(强制安全,密码非明文显示)52. Encapsulation frame-relay 启动帧中继封装53. Encapsulation novell-ether 规定在网络段上使用的Novell 独一无二的格式54. Encapsulation PPP 把PPP设置为由串口或ISDN接口使用的封装方法55. Encapsulation sap 规定在网络段上使用的以太网802.2格式Cisco的密码是sap56. End 退出设置模式57. Erase 删除闪存或设置缓存58. Erase startup-config 删除NVRAM中的内容59. Exec-timeout 设置EXEC命令解释器在检测到用户输入前所等待的时间60. Exit 退出所有设置模式或关闭一个激活的终端会话和终止一个EXEC61. Exit 终止所有设置模式或关闭一个活动的对话和结束EXEC62. format 格式化设备63. Frame-relay local-dlci 为使用帧中继封装的串行线路启动本地管理接口(LMI)64. Help 获得交互式帮助系统65. History 查看历史记录66. Hostname 使用一个主机名来设置路由器,该主机名以提示符或缺省文件名的方式使用67. Interface 设置接口类型并且输入接口设置模式68. Interface 设置接口类型和进入接口设置模式69. Interface serial 选择接口并且输入接口设置模式70. Ip access-group 控制对一个接口的访问71. Ip address 设定接口的网络逻辑地址72. Ip address 设置一个接口地址和子网掩码并开始IP处理73. Ip default-network 建立一条缺省路由74. Ip domain-lookup 允许路由器缺省使用DNS75. Ip host 定义静态主机名到IP地址映射76. Ip name-server 指定至多6个进行名字-地址解析的服务器地址77. Ip route 建立一条静态路由78. Ip unnumbered 在为给一个接口分配一个明确的IP地址情况下,在串口上启动互连网协议(IP)的处理过程79. Ipx delay 设置点计数80. Ipx ipxwan 在串口上启动IPXWAN协议81. Ipx maximum-paths 当转发数据包时设置Cisco IOS软件使用的等价路径数量82. Ipx network 在一个特定接口上启动互连网数据包交换(IPX)的路由选择并且选择封装的类型(用帧封装)83. Ipx router 规定使用的路由选择协议84. Ipx routing 启动IPX路由选择85. Ipx sap-interval 在较慢的链路上设置较不频繁的SAP(业务广告协议)更新86. Ipx type-20-input-checks 限制对IPX20类数据包广播的传播的接受87. Isdn spid1 在路由器上规定已由ISDN业务供给商为B1信道分配的业务简介号(SPID)88. Isdn spid2 在路由器上规定已由ISDN业务供给商为B2信道分配的业务简介号(SPID)89. Isdntch-type 规定了在ISDN接口上的中心办公区的交换机的类型90. Keeplive 为使用帧中继封装的串行线路LMI(本地管理接口)机制91. Lat 打开LAT连接92. Line 确定一个特定的线路和开始线路设置93. Line concole 设置控制台端口线路94. Line vty 为远程控制台访问规定了一个虚拟终端95. Lock 锁住终端控制台96. Login 在终端会话登录过程中启动了密码检查97. Login 以某用户身份登录,登录时允许口令验证98. Logout 退出EXEC模式99. Mbranch 向下跟踪组播地址路由至终端100. Media-type 定义介质类型101. Metric holddown 把新的IGRP路由选择信息和正在使用的IGRP路由选择信息隔离一段时间102. Mrbranch 向上解析组播地址路由至枝端103. Mrinfo 从组播路由器上获取邻居和版本信息104. Mstat 对组播地址多次路由跟踪后显示统计数字105. Mtrace 由源向目标跟踪解析组播地址路径106. Name-connection 命名已存在的网络连接107. Ncia 开启/关闭NCIA服务器108. Network 把一个基于NIC的地址分配给一个和他直接相连的路由器把网络和一个IGRP的路由选择的过程联系起来在IPX路由器设置模式下,在网络上启动加强的IGRP109. Network 指定一个和路由器直接相连的网络地址段110. Network-number 对一个直接连接的网络进行规定111. No shutdown 打开一个关闭的接口112. Pad 开启一个X.29 PAD连接113. Permit 为一个已命名的IP ACL设置条件114. Ping 把ICMP响应请求的数据包发送网络上的另一个节点检查主机的可达性和网络的连通性对网络的基本连通性进行诊断115. Ping 发送回声请求,诊断基本的网络连通性116. Ppp 开始IETF点到点协议117. Ppp authentication 启动Challenge握手鉴权协议(CHAP)或密码验证协议(PAP)或将两者都启动,并且对在接口上选择的CHAP和PAP验证的顺序进行规定118. Ppp chap hostname 当用CHAP进行身份验证时,创建一批似乎是同一台主机的拨号路由器119. Ppp chap password 设置一个密码,该密码被发送到对路由器进行身份验证的主机命令对进入路由器的用户名/密码的数量进行了限制120. Ppp pap sent-username 对一个接口启动远程PAP支持,并且在PAP对同等层请求数据包验证过程中使用sent-username和password121. Protocol 对一个IP路由选择协议进行定义,该协议能是RIP,内部网关路由选择协议。
思科交换机路由基本配置命令常用命令1.配置接口:interface {interface_type} {interface_number}2.配置IP地址:ip address {IP_address} {subnet_mask}3.配置默认网关:ip default-gateway {default_gateway_IP}4.开启接口:no shutdown5.配置路由协议:router {routing_protocol}6.配置路由器ID:router-id {router_ID}7.配置路由信息:network {network_address} {subnet_mask}8.配置静态路由:ip route {destination_network} {subnet_mask}{next-hop_IP}9.配置动态路由:router {routing_protocol} {network_address}10.保存配置:copy running-config startup-config注意:上述命令仅作为参考,具体配置应根据实际环境和设备型号进行调整。
下面是一些基本的 Cisco 交换机路由配置命令:1.配置 hostname: hostname <name>2.配置 IP 地址: interface <interface> 后进入接口模式,再输入 ipaddress <ip address> <subnet mask>3.配置默认路由: ip route 0.0.0.0 0.0.0.0 <next hop IP>4.启用路由协议: router <protocol> (例如: router rip)5.配置路由连接: network <network address> (例如: network192.168.1.0)6.查看路由表: show ip routeCisco 交换机路由配置步骤1.进入配置模式:configure terminal2.配置 IP 地址和子网掩码:interface [interface-name] ; ip address[ip-address] [subnet-mask]3.配置默认路由:ip route 0.0.0.0 0.0.0.0 [next-hop-IP-address]4.启用路由协议:router [protocol-name] (如:router ospf)5.配置路由协议参数: [protocol-name] [process-id] (如:ospf 1)6.配置路由连接:network [network-address] [wildcard-mask] area[area-id] (如:network 192.168.1.0 0.0.0.255 area 0)7.保存配置:copy running-config startup-config8.退出配置模式:exit。
干货!思科网络设备配置命令大全础配置1思科设备管理基础命令enable 从用户模式进入特权模式configure terminal 进入配置模式interface g0/0进入千兆以太网接口g0/0ip address 172.16.0.1 255.255.0.0配置接口的 ip 地址no shutdown 开启接口line vty 0 4进入虚拟终端 vty 0 - vty 4password CISCO配置认证密码login 用户要进入路由器,需要先进行登录exit 退回到上一级模式enable password CISCO配置进入特权模式的密码,密码不加密end 直接回到特权模式show int g0/0 显示 g0/0 接口的信息hostname Terminal-Server 配置路由器的主机名enable secret ccielab 配置进入特权模式的密码,密码加密no ip domain-lookup 路由器不使用 DNS 服务器解析主机的 IP地址logging synchronous 路由器上的提示信息进行同步,防止信息干扰我们输入命令no ip routing 关闭路由器的路由功能ip default-gateway 10.1.14.254 配置路由器访问其他网段时所需的网关show line 显示各线路的状态line 33 48 进入 33-48 线路模式transport input all 允许所有协议进入线路int loopback0 进入 loopback0 接口ip host R1 2033 1.1.1.1 为 1.1.1.1 主机起一个主机名alias exec cr1 clear line 33 为命令起一个别名privilege exec level 0 clear line把命令 clear line 的等级改为 0,在用户模式下也可以执行它banner motd 设置用户登录路由器时的提示信show ip int brief 查看接口状态2VLAN相关命令vlan X 创建VLAN Xname SPOTO 将VLAN X命名为SPOTOexit 退出当前模式interface e0/0 进入以太网接口e0/0switchport mode access 将二层接口设置为接入模式switchport access vlan X 将接口划入vlan Xinterface e0/1switchport trunk encapsulation dot1q trunk链路封装协议为 802.1qswitchport mode trunk 将二层接口配置模式为 trunkswitchport trunk allow vlan X trunk接口单独放行某个 vlan。
思科命令大全思科常用命令大权1用户模式2:特权模式enableshow vlanshow versionshow interfaceshow mac-address-tableshow running-configcopy running-config startup-config3:全局配置模式config terminalhostnameenable passwordip default-gateway4:接口配置模式interface 端口switchport mode trunk5:line模式line console 0第2章交换机的基本配置1.配置主机hostname2.查看交换机的配置show running-config使能口令enable password加密保存的使能口令enable secret配置IP地址interface vlan1ip addressno shutdown配置交换机的网关ip default-gateway ipaddress查看交换机的MAC地址表show mac-address-table使用CDP协议show cdpshow cdp interfaceshow cdp neighborsshow cdp neighbors detailshow cdp traffic保存与删除交换机配置copy running-config startup-config第三章:虚拟局域网(VLAN)VLAN的概述VLAN是对连接在第2层交换机端口的网络用户的逻辑分段。
VLAN的作用:1。
广播控制2。
安全(副产品)3。
带宽利用4。
延迟VLAN的种类静态:基于端口的VLAN动态:基于MAC地址的VLAN在交换机上配置静态VLAN创建VLAN1。
CONFIG TERMINALVLAN 2NAME 22。
特权模式下VLAN DATABASEVLAN 2 NAME 2查看VLANSHOW VLAN删除VLANNO VLAN 2验证:SHOW VLAN BRIEF在VLAN中添加端口INTERFACE F0/2INTERFACE RANGE F0/2 - 5SWITCHPORT MODE ACCESSSWITCHPORT ACCESS VLAN 2VLAN配置实例在交换机上添加VLAN2,VLAN3,VLAN3,端口范围分别为1-4,5-8,9-12这个实例的作用就是让不同的VLAN的计算机之间的通信隔开。
CISCO配置命令大全路由器的基本配置1.配置以太网(Ethernet)端口:ﻫ# conf t ﻫ从终端配置路由器。
ﻫ#int e0ﻫ指定E0口。
ﻫ# ip addrABCD XXXX ﻫABCD为以太网地址,XXXX为子网掩码。
#ip addrABCD XXXXsecondary ﻫE0口同时支持两个地址类型。
如果第一个为A类地址,则第二个为B或C类地址。
ﻫ# no shutdownﻫ激活E0口。
# exit2.X.25的配置ﻫ# conftﻫ#int S0 ﻫ指定S0口.#ipaddrABCD XXXX ﻫABCD为以太网S0的IP地址,XXXX为子网掩码.。
#encapX25-ABC封装X.25协议。
ABC指定X.25为DTC或DCE操作,缺省为DTE。
ﻫ# x25addr ABCD ﻫABCD为S0的X.25端口地址,由邮电局提供。
ﻫ# x25 map ip ABCD XXXX br ﻫ映射的X.25地址.ABCD 为对方路由器(如:S0)的ﻫIP地址,XXXX为对方路由器(如:S0)的X.25端口地址。
# x25 htcX配置最高双向通道数.X的取值范围1-4095,要根据邮电局实际提供的数字配置。
# x25 nvc X ﻫ配置虚电路数。
X不可超过据邮电局实际提供的数,否则,将影响数据的正常传输。
#exit ﻫ---- 3 .专线的配置:# conf tﻫ# int S2ﻫ指定S2口。
# ip addr ABCD XXXXABCD为S2的IP地址,XXXX为子网掩码。
ﻫ# exitﻫ4.帧中继的配置#conft#ints0 ﻫ# ip addr ABCD XXXXABCD为S0的IP地址,XXXX为子网掩码。
ﻫ#encapfrante_relayﻫ封装frante_relay协议。
# no nrzi_encodingNRZI=NO#frame_relay lmi_type q933a ﻫLMI使用Q933A标准.LMI(LocalmanagementInterface)有3种:ANSI:T1.617;CCITTY:Q933A和CISCO特有的标准。
CISCO路由器常用配置命令大全在网络世界中,CISCO 路由器就像是交通枢纽中的指挥中心,而配置命令则是指挥其运作的指令。
熟练掌握 CISCO 路由器的常用配置命令,对于网络管理员来说至关重要。
下面就让我们一起来了解一下这些常用的配置命令。
一、基础配置命令1、`enable`:用于进入特权模式。
特权模式下可以执行更多高级的配置操作。
2、`configure terminal`:进入全局配置模式,在这个模式下可以对路由器的各种参数进行设置。
3、`hostname router_name`:设置路由器的主机名,方便识别和管理。
4、`interface interface_type interface_number`:进入指定的接口配置模式,例如`interface ethernet 0/0` 进入以太网接口 0/0 的配置。
5、`ip address ip_address subnet_mask`:为接口配置 IP 地址和子网掩码。
6、`no shutdown`:激活接口,使其处于工作状态。
二、路由配置命令1、`ip route destination_network subnet_mask next_hop_ip`:添加静态路由,指定数据包到达目标网络的路径。
2、`router rip`:启用 RIP 路由协议。
3、`network network_address`:在 RIP 协议中宣告参与路由的网络。
4、`router ospf process_id`:启用 OSPF 路由协议,并指定进程 ID。
5、`network network_address area_id`:在 OSPF 协议中宣告网络和所属区域。
三、访问控制列表(ACL)配置命令1、`accesslist access_list_number permit|deny source_addresssource_mask destination_address destination_mask protocol port`:创建访问控制列表规则,指定允许或拒绝的流量。
Cisco常用命令配置一、基本配置Switch>enable#进入全局配置模式Switch#show run#查看全局配置Switch#conf<TAB> t<TAB>#进入特权配置模式Switch#WR#保存配置Switch(config)#enable password cisco#设置全局配置模式登入密码Switch(config)#line vty 0 5#进入远程管理(telnet)0~5个用户配置模式Switch(config-vty-if)#password cisco#设置远程管理(telnet)登入密码Switch(config)#hostname JSW_C3560G#定义主机名称为JSW_C3560GSwitch(config-vty-if)#exit#返回到上一配置模式Switch(config-if)#end#退回到全局配置模式二、VLAN配置Switch(config)#interface vlan 10#进入VLAN 10配置模式Switch(config-vlan-if)#ip addree 192.168.1.10 255.255.255.0#定义VLAN 10的管理IP为192.168.1.10掩码为255.255.255.0Switch(config-vlan-if)#no shutdown#激活VLAN 10Switch(config)#vlan database#进入VLAN VTP配置模式Switch(config-vlan)#vlan domain JXJSW#定义VLAN VTP域为JXJSWSwitch(config-vlan)#vlan mode server(client)#定义VLAN VTP模式为服务端或客户端Switch(config)#ip routing#激活默认路由Switch(config)#ip route 0.0.0.0 0.0.0.0 192.168.10.10#定义静态路由允许IP为0.0.0.0掩码为0.0.0.0通过网关192.168.10.10三、端口配置Switch(config)#interface fastEthernet0/10#进入100M以太网端口配置模式Switch(config)#interface gigabitEthernet0/10#进入1000M吉比特以太网端口配置模式Switch(config)#interface range gigabitEthernet0/10 - 20#进入10~20一组1000M吉比特以太网端口配置模式Switch(config-if)#switchport access vlan 10#定义端口加入到VLAN 10Switch(config-if)#switchport trunk encapsulation dot1q#定义端口起用TRUNK的802.1Q协议Switch(config-if)#switchport mode trunk#定义端口模式为TRUNKSwitch(config-if)#no switchport#定义端口为三层接口Switch(config-if)#ip addree 192.168.1.10 255.255.255.0#定义端口的三层接口地址为IP192.168.1.10掩玛为255.255.255.0 ,四、ARP欺骗/ MITM(Man-In-The-Middle)攻击防范Switch(config)#arp access-list static-arp#定义一个ARP访问控制列表并且命名该列表名为static-arpSwitch(config)#permit ip host 10.66.227.5 mac host 0009.6b88.d387 #定义ARP访问控制列表IP为10.66.227.5MAC地址为0009.6 b88.d387 Switch(config)#ip arp inspection filter static-arp vlan 10#定义列表名为static-arp的一个ARP访问控制列表在VLAN 10中启用Switch(config)#no ip arp inspection filter static-arp vlan 10#取消列表名为static-arp的一个ARP访问控制列表在VLAN 10中启用五、基于MAC地址的扩展访问列表Switch(config)#Mac access-list extended MAC#定义一个MAC地址访问控制列表并且命名该列表名为MACSwitch(config)#permit host 0009.6bc4.d4bf any#定义MAC地址为0009.6bc4.d4bf的主机可以访问任意主机Switch(config)#permit any host 0009.6bc4.d4bf#定义所有主机可以访问MAC地址为0009.6bc4.d4bf的主机Switch(config-if )#interface Fa0/20#进入配置具体端口的模式Switch(config-if )#mac access-group MAC in#在该端口上应用名为MAC的访问列表(即前面我们定义的访问策略)Switch(config)#no mac access-list extended MAC#清除名为MAC的访问列表。
CISCO常用配置命令及参数(1)2011-10-27 10:30 佚名 NET130 我要评论(11) 字号:T | TCISCO的产品类型非常多,也是企业常常会选择的一个品牌。
所以,作为运维人员,维护企业的网络,对于Cisco的产品的配置也要有所了解。
AD:启动接口,分配IP地址:1.router>2.router>enable3.router#4.router# configure terminal5.router(config)#6.router(config)# interface Type Port7.router(config-if)# no shutdown8.router(config-if)# ip address IP-Address Subnet-Mask9.router(config-if)# ^z配置RIP路由协议:30秒更新一次1.router(config)# router rip2.router(config-if)# network Network-Number <--通告标准A,B,C类网-->3.router(config-if)# ^z配置IGRP路由协议:90秒更新一次1.router(config)# router igrp AS-Number <--AS-Number范围1~65535-->2.router(config-if)# network Network-Number <--通告标准A,B,C类网-->3.router(config-if)# ^z配置Novell IPX路由协议:1.Novell RIP 60秒更新一次2.router(config)# ipx routing [node address]3.router(config)# ipx maximum-paths Paths <--设置负载平衡,范围1~512-->4.router(config)# interface Type Port5.router(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] <--通告标准A,B,C类网-->6.router(config-if)# ^z配置DDR:1.router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number]2.router(config)# interface bri 03.router(config-if)# dialer-group Group-Number4.router(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Number5.router(config-if)# ^z配置ISDN:1.router(config)# isdn swith-type Swith-Type <--配置ISDN交换机类型,中国使用basic-net3-->2.router(config-if)# ^z配置Frame Relay:1.router(config-if)# encapsulation frame-relay [cisco| ietf ]2.router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ]3.router(config-if)# bandwidth kilobits4.router(config-if)# frame-relay invers-arp [ Protocol] [dlci ]5.<--配置静态Invers ARP表:6.router(config)# frame-relay Protocol Protocol-AddressDLCI [ Broadcast ] [ ietf | cisco ] [ payload-compress | packet-by-packet ]7.<--设置Keepalive间隔:8.router(config-if)# keepalive Number9.<--为本地接口指定DLCI:10.router(config-if)# frame-lelay local-dlci Number11.<--子接口配置:12.router(config-if)# interface Type Port.Subininterface-Number [ multipoint | point-to-point ]13.router(config-subif)# ip unnumbered Interface14.router(config-subif)# frame-lelay local-dlci Number15.router(config-if)# ^z配置标准ACL:1.router(config)# access-list Access-List-Number [ permit | deny ] source [ source-mask ] <--Access-Li st-Number 范围:1~99标准ACL;100~199扩展ACL;800~899标准IPX ACL;900~999扩展IPX ACL;1000~1099 IPX SAP ACL;600~699Apple Talk ACL-->2.router(config)# interface Type Port3.router(config-if)# ip access-group Access-List-Number[ in | out ]4.router(config-if)# ^z配置扩展ACL:1.router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]2.router(config)# interface Type Port3.router(config-if)# ip access-group Access-List-Number[ in | out ]4.router(config-if)# ^z配置命名ACL:1.router(config)# ip access-list [ standard | extended ] ACL-Name2.router(config [ std- | ext- ] nacl)# [ permit |deny ] [ IP-Access-List-Test-Conditions ]3.router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ IP-Access-List-Test-Conditions ]4.router(config [ std- | ext- ] nacl)# ^z5.router(config)# interface Type Port6.router(config-if)# ip access-group [ACL-Name | 1~199 ] [ in | out ]7.router(config-if)# ^z配置DCE时钟:1.router# show controllers Type Port <--确定DCE接口-->2.router(confin-if)# clock rate 64000 <--进入DCE接口设置时钟速率-->3.router(config-if)# ^z配置PPP协议:1.router(config)# username Name password Set-Password-Here <--验证方建立数据库-->2.router(config)# interface Type Port3.router(config-if)# encapsulation ppp <--启动PPP协议-->4.router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <--选择PPP认证-->5.router(config-if)# ppp pap sent-username Name password Password <--发送验证信息-->6.router(config-if)# ^zPAP单向认证配置实例:验证方:1.router-server(config)# username Client password 12345 <--验证方建立数据库-->2.router-server(config)# interface serial 03.router-server(config-if)# encapsulation ppp4.router-server(config-if)# ppp authentication pap <--选择使用PAP实现PPP认证-->5.router-server(config-if)# ^z被验证方:1.router-client(config-if)# encapsulation ppp2.router-client(config-if)# ppp pap sent-username Client password 12345 <--发送验证信息-->3.router-client(config-if)# ^zPAP双向认证配置实例:路由器 A:1.routerA(config)# username B password 123452.routerA(config)# interface serial 03.routerA(config-if)# encapsulation ppp4.routerA(config-if)# ppp authentication pap5.routerA(config-if)# ppp pap sent-username A password 543216.routerA(config-if)# ^z路由器 B:1.routerB(config)# username A password 543212.routerB(config)# interface serial 13.routerB(config-if)# encapsulation ppp4.routerB(config-if)# ppp authentication pap5.routerB(config-if)# ppp pap sent-username B password 123456.routerB(config-if)# ^zCHAP单向认证配置实例:验证方:1.router-server(config)# username router-client password 123452.router-server(config)# interface serial 03.router-server(config-if)# encapsulation ppp4.router-server(config-if)# ppp authentication chap5.router-server(config-if)# ^z被验证方:1.router-client(config-if)# encapsulation ppp2.router-client(config-if)# ppp authentication chap3.router-client(config-if)# ppp chap hostname router-client4.router-client(config-if)# ppp chap password 123455.router-client(config-if)# ^zCHAP双向认证配置实例:路由器 A:1.routerA(config)# username routerB password 123452.routerA(config)# interface serial 03.routerA(config-if)# encapsulation ppp4.routerA(config-if)# ppp authentication chap5.routerA(config-if)# ppp chap hostname routerA6.routerA(config-if)# ppp chap password 543217.routerA(config-if)# ^z路由器 B:1.routerB(config)# username routerA password 543212.routerB(config)# interface serial 13.routerB(config-if)# encapsulation ppp4.routerB(config-if)# ppp authentication chap5.routerB(config-if)# ppp chap hostname routerB6.routerB(config-if)# ppp chap password 123457.routerB(config-if)# ^zTelnet使用:1.routerA# terminal monitor <--可以传回在远端主机执行Debug命令的结果-->2.routerA# telnet IP-Address [ Router-Name ] <--Telnet到指定的地址或名字的主机-->3.routerB# [ exit | logout ] <--退出Telnet-->4.routerB# ++<6>再按<--挂起Telnet-->5.routerA# show sessions <--显示当前所有Telnet的信息,包括Connect-Number -->6.routerA# Connect-Number <--返回指定的Telnet连接-->7.routerA# disconnect IP-Address [ Router-Name ] <--断开指定地址或名字的主机的连接-->8.routerA# show user <--显示Telnet到本机的连接信息-->9.routerA# clear line [ 0 | 1 | 2 | 3 | 4 ]<--断开指定Telnet到本机的连接-->禁止任何Telnet到本机:1.router(config)# line vty 0 42.router(config-line)# access-class ACL-Number3.router(config)# ^z设置主机名:1.router(config)# hostname Set-Hostname2.router(config)# ^z3.router(config)# ^z设置用户模式密码:1.router(config)# line console 02.router(config-line)# login3.router(config-line)# password Set-Password4.router(config-line)# ^z设置Telnet密码:1.router(config)# line vty 0 42.router(config-line)# login3.router(config-line)# password Set-Password4.router(config-line)# ^z设置特权模式密码:1.router(config)# enable password Set-Password <--不加密的密码,明码-->2.router(config)# enable secret Set-Password <--经过加密的密码-->3.router(config)# ^z给所有密码加密:1.router(config)# service password-ancryption Set-Password-Here2.router(config)# no service password-ancryption <--取消加密-->3.router(config)# ^z设置登录Banner:1.router(config)# banner motd 分隔符Set-Banner-Information-Here 分隔符<--前后分隔符一定要一致-->设置接口的描述信息:1.router(config-if)# description Set-Port-Information-Here2.router(config)# ^zCDP的控制:1.router(config-if)# cdp enable <--在指定端口启用CDP,缺省-->2.router(config-if)# no cdp enable <--在指定端口关闭CDP-->3.router(config)# cdp run <--使所有端口启用CDP-->4.router(config)# no cdp run <--使所有端口关闭CDP--> Ping的使用:1.router# ping IP-Address2.router# ping <--扩展Ping命令-->3.Protocol [ip]:[ Protocol-Type ] <--选择协议类型-->4.Target IP address:IP-Address <--输入测试地址-->5.Repeat count [5]:<--选择发送的ICMP包数量-->6.Datagram size [100]:<--选择每个包的大小-->7.Timeout in seconds [2]:<--设置每个包的超时时间-->8.Extended commands [n]:y <--使用扩展Ping命令-->9.Sweep range of sizes [n]:Tracke的使用:1.router# trace IP-Address [ Host-Name为Cisco 4000路由器指定媒体类型:1.router(config-if)# media-type 10baset <--使AUI(默认)失效,改为使用RJ-45-->2.router(config-if)# ^z更改路由器启动顺序:1.router(config)# boot system flash IOS-FileName2.router(config)# boot system tftp IOS-FileName TFTP-IP-Address3.router(config)# boot system rom4.router(config)# ^z修改寄存器数值:1.router(config)# config-register Value <--Cisco出厂默认Value=0x2102,Value范围:0x2100(进入ROM监视器),0x2101(使系统从ROM启动),0x2102~0x210F(使系统从NVRAM启动)。
Cisco路由器应该是目前路由市场中需求量很多的品牌之一,下面就以Cisco路由为例,介绍一下关于Cisco路由器配置命令与交换机配置命令,从配置命令上看,分析出路由器和交换机之间的区别。
1. 交换机配置命令:交换机配置命令之基本状态:switch: ;ROM状态,路由器是rommon>hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机配置命令之口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令switch(config)#enable password xxa ;设置特权非密口令switch(config)#line console 0 ;进入控制台口switch(config-line)#line vty 0 4 ;进入虚拟终端switch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xxswitch#exit ;返回命令交换机配置命令之VLAN设置:switch#vlan database ;进入VLAN设置switch(vlan)#vlan 2 ;建VLAN 2switch(vlan)#no vlan 2 ;删vlan 2switch(config)#int f0/1 ;进入端口1switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlanswitch(config-if)#switchport trunk encap dot1q ;设置vlan 中继switch(config)#vtp domain ;设置发vtp域名switch(config)#vtp password ;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;2. Cisco路由器配置命令:Cisco路由器配置命令之显示命令:router#show run ;显示配置信息router#show interface ;显示接口信息router#show ip route ;显示路由信息router#show cdp nei ;显示邻居信息router#reload ;重新起动Cisco路由器配置命令之口令设置:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname ;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令router(config)#enable password xxb ;设置特权非密口令router(config)#line console 0 ;进入控制台口router(config-line)#line vty 0 4 ;进入虚拟终端router(config-line)#login ;要求口令验证router(config-line)#password xx ;设置登录口令xx router(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令Cisco路由器配置命令:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟。
CISCO交换机配置命令大全1.在基于IOS的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于CLI的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-addressswitch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看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 neighbors[module/port] [vlan|duplex|capabilities|detail]5.基于IOS的交换机的端口描述:switch(config-if)# description description-string基于CLI的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS的交换机上设置端口速度:switch(config-if)# speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable) set port speed moudle/number {10|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 databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS的交换机上配置VLAN中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl|dotlq}switch(config-if)# switchport trunk allowed vlan remove vlan-listswitch(config-if)# switchport trunk allowed vlan add vlan-list在基于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 databaseswitch(vlan)# vtp domain domain-name在基于CLI的交换机上配置VTP管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(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. 在基于IOS的交换机上配置VTP版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI的交换机上配置VTP版本:switch(enable) set vtp v2 enable13. 在基于IOS的交换机上启动VTP剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP剪裁:switch(enable) set vtp pruning enable14.在基于IOS的交换机上配置以太信道:switch(config-if)# port group group-number [distribution {source|destination}]在基于CLI的交换机上配置以太信道:switch(enable) set port channel moudle/port-range mode{on|off|desirable|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [cost cost][vlan-list]16.在基于IOS的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority在基于CLI的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS的交换机上修改STP时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(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 interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable|disable}19. 在基于IOS的交换机端口上启用或禁用UplinkFast 特征:switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second]在基于CLI的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令: switch(config)# cluster enable cluster-name21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP参数.23. 用show vtp statistics显示管理域的VTP参数.24. 在Catalyst交换机上定义TrBRF的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridge bridge-num[stp {ieee|ibm}]25. 在Catalyst交换机上定义TrCRF的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num|decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree显示一个交换机端口的STP状态.28. 配置一个ELAN的LES和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-address les1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-address les2-nsap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC配置到一个不同的ATM子接口上.命令如下:ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用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 terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# ip address ip-addr subnet-maskrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行: router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mls rp management-interface47. 要检验MLS-RP的配置情况:router# show mls rp48. 检验特定接口上的MLS配置:router# show mls rp interface interface number49. 为了在MLS-SE上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination|destination-source|full]50. 为使MLS和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP和MLS-SE参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS高速缓存记录:switch(enable) show mls entry56. 用命令show in arp显示ARP高速缓存区的内容。
Cisco路由器配置命令大全本文档旨在提供一份最新最全的Cisco路由器配置命令范本,旨在帮助用户快速配置和管理Cisco路由器。
以下是具体的章节内容:⒈设置基本参数⑴主机名设置命令⑵控制台设置命令⑶用户密码设置命令⑷物理接口配置命令⒉配置IP网络⑴设置IP地质和子网掩码⑵配置静态路由⑶配置动态路由协议(如OSPF或EIGRP)⑷ ICMP设置命令⒊网络管理和监控⑴远程管理设置命令⑵ SNMP配置命令⑶日志记录命令⑷监控和排错命令⒋安全配置⑴访问控制列表(ACL)配置命令⑵ VPN配置命令⑶防火墙配置命令⑷加密和身份验证命令⒌功能扩展⑴ NAT配置命令⑵ QoS配置命令⑶ VLAN配置命令⑷ DHCP配置命令附件:本文档涉及附件,请参阅附件文件以获取更详细的配置示例和说明。
注释:⒈Cisco路由器:Cisco公司生产的用于网络互联的路由器设备。
⒉配置命令:指通过命令行界面输入的一系列指令,用于配置和管理Cisco路由器。
⒊IP地质:Internet协议地质,用于在网络中标识设备的唯一地质。
⒋子网掩码:用于确定IP地质中网络地质和主机地质的部分。
⒌静态路由:通过手动配置的路由信息,用于指定数据包的下一跳路径。
⒍动态路由协议:通过协议自动交换路由信息,动态更新路由表。
⒎OSPF:开放最短路径优先(Open Shortest Path First)协议,用于计算路径的最佳选择。
⒏EIGRP:增强型内部网关路由协议(Enhanced Interior Gateway Routing Protocol),Cisco公司开发的路由协议。
⒐ICMP:Internet控制报文协议,用于在IP网络中发送错误和控制消息。
⒑SNMP:简单网络管理协议,用于管理和监控网络设备。
1⒈ACL:访问控制列表,用于控制流经路由器的数据包的访问权限。
1⒉VPN:虚拟专用网络,通过加密和认证技术实现安全的远程连接。
1⒊防火墙:用于保护网络免受未经授权的访问和攻击的安全设备。
思科路由器|交换机配置命令第一章 实验拓扑、终端服务器配置命令作用R1>enable从用户模式进入特权模式R1#configure terminal进入配置模式R1(config)#interface g0/0进入千兆位以太网接口模式R1(config-if)#ip add 172.16.0.1 255.255.255.0配置接口的IP地址R1(config-if)#no shutdown打开接口R1(config)#line vty 0 4进入虚拟终端vty 0~vty 4R1(config-line)#password cisco配置虚拟终端密码为ciscoR1(config-line)#login用户要进入路由器,需要先进行登录Exit退回到上一级模式R1(config)#enable password cisco配置进入特权模式的密码为cisco,密码不加密End (Ctrl+Z)直接回到特权模式R1#show int g0/0显示g0/0接口信息R1(config)#hostname Terminal-Server配置路由器的主机名为Terminal-ServerR1(config)#enable secret cisco配置进入特权模式的密码为cisco,密码加密R1(config)#no ip domain-lookup路由器不使用DNS服务器解析主机的IP地址R1(config-line)#logging synchonous对路由器上的提示信息进行同步,防止信息干扰我们输入命令R1(config)#no ip routing关闭路由器的路由功能R1(config)#ip default-gateway 10.1.14.254配置路由器访问其他网段时所需的网关R1#show line显示各线路的状态R1(config)#line33 48进入33~38线路模式R1(config-line)#transport input all允许所有协议进入线路R1(config)#int loopback0进入Loopback0环回接口R1(config)#ip host R1 1.1.1.1为1.1.1.1主机起一个主机名R1R1(config)#alias exec crl clear line 33为命令起一个别名R1(config)#privilege exec level 0 clear line把命令clear line 的等级改为0,在用户模式下也可以执行它R1(config)#banner motd设置用户登录路由器时的提示信息第二章 路由器基本配置命令汇总命令作用R1#clock set hh:mm:ss month day year设置路由器的时间R1#show clock显示路由器的时间R1#show history显示历史命令R1#terminal no editing关闭CLI的编辑功能R1#terminal editing打开CLI的编辑功能R1#terminal histroy size 50修改历史命令缓冲区的大小R1#copy running-config startup-config把内存中的配置文件保存到NVRAM中R1(config-if)#clock rate 128000配置串口上的时钟(DCE端)R1#show version显示路由器的IOS版本等信息R1#show running-config显示内存中的配置文件R1#show startup-config显示NVRAM中的配置文件R1#show interface s0/0/0显示接口的信息R1#show flash显示FLASH的有关信息R1#show controllers s0/0/0显示s0/0/0的控制器信息R1#show ip arp显示路由器中的arp表R1#copy running-config tftp把内存中的配置文件复制到TFTP服务器上R1#copy tftp running-config把TFTP服务器上的配置文件复制到内存中R1#copy flash tftp把FLASH中的IOS保存到TFTP服务器上rommon 1>confreg 0x2142在rommon模式下修改配置寄存器的值rommon 1>i (boot)在rommon模式下重启路由器R1#copy startup-config running-config把NVRAM中的配置文件复制到内存中R1(config)#config-register 0x2102修改配置寄存器值为0x2102R1#reload重启路由器R1#delete flash删除FLASH中的IOSR1#copy tftp flash从TFTP服务器上复制IOS到FLASH中rommon 1>tftpdnld在rommon模式下,从TFTP服务器下载IOS R1#show cdp显示CDP运行信息R1#show cdp interface显示CDP在各接口的运行情况R1#show cdp neighbors显示CDP邻居信息R1#show cdp entry R2显示CDP邻居R2的详细信息R1#clear cdp table清除CDP邻居表R1(config-if)#no cdp enable接口下关闭CDPR1(config)#no cdp run / cdp run关闭/打开整个路由器的CDPR1(config)#cdp timer 30CDP每30 s发送一次R1(config)#cdp holdtime 120让邻居为本设备发送的CDP消息保持120 s第三章 静态路由命令汇总命令作用R1(config)#ip route 1.1.1.0 255.255.255.0 s0/1配置静态路由R1#show ip route查看路由表R1(config)#ip classless / no ip classless打开/关闭有类路由功能R1#ping 2.2.2.2 source loopback 0指定源端口进行ping 测试第四章 RIP命令汇总命令作用R1#show ip route查看路由表R1#show ip protocols查看IP路由协议配置和统计信息R1#show ip rip database查看RIP数据库R1#debug ip rip动态查看RIP的更新过程R1#clear ip route *清除路由表R1(config)#router rip启动RIP进程R1(config-router)#network 1.0.0.0通告网络R1(config-router)#version 2定义RIP的版本R1(config-router)#no auto-summary关闭自动汇总R1(config-if)#ip rip send version配置RIP发送的版本R1(config-if)#ip rip receive version配置RIP接收的版本R1(config-router)#passive-interface s0/1配置被动接口R1(config-router)#neighbor A.B.C.D配置单播更新的目标R1(config-if)#ip summary-address rip ip mask配置RIP手工汇总R1(config)#key chain lgm定义钥匙链R1(config-keychain)#key <0-2147483647>配置Key IDR1(config-keychain-key)#key-string cisco配置Key ID的密匙R1(config-if)#ip rip triggered配置触发更新R1(config-if)#ip rip authentication mode md5/text配置认证模式R1(config-if)#ip rip authention key-chain lgm配置认证使用的钥匙链R1(config-router)#timers basic配置更新的计时器R1(config-router)#maximum-paths配置等价路径的最大值R1(config)#ip default-network向网络中注入默认路由第五章 EIGR命令汇总命令作用R1#show ip eigrp neighbors查看EIGRP邻居表R1#show ip eigrp topology查看EIGRP拓扑结构数据库R1#show ip eigrp interface查看运行EIGRP路由协议的接口的状况R1#show ip eigrp traffic查看EIGRP发送和接收到的数据包的统计情况R1#debug eigrp neighbors查看EIGRP动态建立邻居关系的情况R1#debug eigrp packets显示发和接收的EIGRP数据包R1(config-if)#ip hello-interval eigrp配置EIGRP的HELLO发送周期R1(config-if)#ip hold-time eigrp配置EIGRP的HELLO hold时间R1(config)#router eigrp number启动EIGRP路由进程R1(config)#no auto-summary关闭自动汇总R1(config-if)#ip authentication mode eigrp配置EIGRP的认证模式R1(config-if)#ip authentication key-chain eigrp在接口上调用钥匙链R1(config-router)#variance配置非等价负载均衡R1(config-if)#delay <1-16777215>配置接口下的延迟R1(config-if)#bandwidth 100配置接口下的带宽R1(config-if)#ip summary-address eigrp手工路由汇总第六章 OSPF命令汇总命令作用R1#show ip route查看路由表R1#show ip ospf neighbor查看OSPF邻居的基本信息R1#show ip ospf database查看OSPF拓扑结构数据库R1#show ip ospf interface查看OSPF 路由器接口的信息R1#show ip ospf查看OSPF进程及其细节R1#debug ip ospf adj查看OSPF邻接关系创建或中断的过程R1#debug ip ospf events显示OSPF发生的事件R1#debug ip ospf packet显示路由器收到的所有的OSPF数据包R1(config)#router ospf process ID启动OSPF路由进程R1(config-router)#router-id 1.1.1.1配置路由器IDR1(config-router)#network 192.168.1.0 0.0.0.255 area ared id通告网络及网络所在的区域R1(config-if)#ip ospf network broadcast / point-to-point配置接口网络类型R1(config-if)#ip ospf cost <1-65535>配置接口Cost值R1(config-if)#ip ospf hello-interval <1-65535>s配置Hello间隔R1(config-if)#ip ospf dead-interval <1-65535>s配置OSPF邻居的死亡时间R1(config-if)#ip ospf priority <0-255>配置接口优先级R1(config-router)#auto-cost reference-bandwidth <1-4294967>配置参考带宽R1#clear ip ospf process清除OSPF进程R1(config-router)#area area-id authentication启动区域简单口令认证R1(config-if)#ip ospf authentication-key cisco配置认证密码R1(config-router)#area area-id authentication message-digest启动区域MD5认证R1(config-if)#ip ospf message-digest-key <1-255> md5 cisco配置key ID及密匙R1(config-if)#ip ospf authentication启用链路简单口令认证R1(config-if)#ip ospf authentication message-digest启用链路MD5认证R1(config-router)#default-information originate向OSPF区域注入默认路由第七章 HDLC、PPP命令汇总命令作用R1(config-if)#encapsulation hdlc把接口的封装改为HDLCR1(config-if)#encapsulation PPP把接口的封装改为PPPR1(config-if)#ppp pap sent-username R1 password 123PAP认证时,向对方发送用户名R1和密码123 R1(config-if)#ppp authentication pap PPP的认证方式为PAPR1(config-if)#user R1 password 123为对方创建用户R1,密码为123R1#debug ppp authentication打开PPP的认证调试过程R1(config-if)#ppp authentication chap PPP的认证方式为CHAP第八章 帧中继命令汇总命令作用R1(config)#frame-relay switching把路由器当成帧中继交换机R1(config-if)#encapsulation frame-relay接口封装成帧中继R1(config-if)#frame-relay lmi-type cisco配置LMI的类型R1(config-if)#frame-relay intf-type dce配置接口是帧中继的DCE还是DTER1(config-if)#frame-relay route dlci interface s0/0 dlci配置帧中继交换表R1#show frame-relay route显示帧中继交换表R1#show frame pvc显示帧中继PVC状态R1#show frame lmi显示帧中继LMI信息R1#show frame-relay map查看帧中继映射R1(config-if)#no frame-relay inverse-arp关闭帧中继自动映射R1(config-if)#ip split-horizon打开水平分割R1(config)#int s0/0/0.1 multipoint创建点到多点子接口R1(config)#int s0/0/0.3 point-to-point创建点到点子接口R1(config-subif)#frame-relay interface-dlci 104在点到点子接口上配置DLCI第九章 ACL命令汇总命令作用R1#show ip access-lists查看所定义的IP访问控制列表R1#clear access-list counters将访问控制列表计数器清零R1(config)#access-list <1-199> permit / deny定义ACLR1(config-if)#ip access-group在接口下应用ACLR1(config-line)#access-class <1-199> in / out在vty下应用ACLR1(config)#ip access-list standard / extended定义命名的ACLR1(config)#time-range time定义时间范围R1(config)#username username password password建立本地数据库R1(config-line)#autocommand定义自动执行的命令第十章 DHCP命令汇总命令作用R1#show ip dhcp pool查看DHCP地址池的信息R1#show ip dhcp binding查看DHCP的地址绑定情况R1#show ip dhcp database查看DHCP数据库R1#show ip interface查看接口信息R1#debug ip dhcp server events动态查看DHCP服务器的事件R1(config)#service dhcp开启DHCP服务R1(config)#no ip dhcp conflict logging关闭DHCP冲突日志R1(config)#ip dhcp pool配置DHCP分配的地址池R1(dhcp-config)#network DHCP服务器要分配的网络的掩码R1(dhcp-config)#default-router默认网关R1(dhcp-config)#domain-name域名R1(dhcp-config)#netbios-name-server WINS服务器R1(dhcp-config)#dns-server域名服务器R1(dhcp-config)#option 150 ip FTP服务器R1(dhcp-config)#lease配置租期R1(dhcp-config)#ip dhcp excluded-address排除地址段R1(config-if)#ip helper-address配置DHCP中继的地址第十一章 NAT命令汇总命令作用R1#clear ip nat translation *清除动态NAT表R1#show ip nat translation查看NAT表R1#show ip nat statistics查看NAT转换的统计信息R1#debug ip nat动态查看NAT转换过程R1(config)#ip nat inside source static配置静态NATR1(config-if)#ip nat inside配置NAT内部接口R1(config-if)#ip nat outside配置NAT外部接口R1(config)#ip nat pool配置动态NAT地址池R1(config)#ip nat inside source list access-list-number pool name配置动态NATR1(config)#ip nat inside source list access-list-numbe r pool name overload配置PAT第十二章 交换机基本配置命令汇总命令作用S1(config-if)#duples {full|half|auto}配置以太口的双工属性S1(config-if)#speed {10|100|1000|auto}配置以太口的速率S1(config)#ip default-gateway 172.16.0.254配置默认网关S1(config-if)#switch mode access把端口以为访问模式S1(config-if)#switch port-security打开交换机的端口安全功能S1(config-if)#switch port-security maximum 1该端口下的MAC条目最大数量为1S1(config-if)#switch port-security violation配置交换机端口安全S1(config-if)#switch port-security mac-address MAC地址允许指定MAC地址的设备接入本接口S1#show mac-address-table显示MAC地址表S1(config-if)#mac-address XXXX.XXXX.XXXX改变接口的MAC地址rename flash;config.text flash;config.old将FLASH中的文件改名copy xmodem; flash;c2950-i6q412-mz.121-22.EA5a.bin通过Xmodem模式把文件复制到FLASH中boot重启交换机第十三章 VLAN、Trunk和VTP命令汇总命令作用S1#vlan database进入到VLAN Database配置模式S1(vlan)#vlan 2 name VLAN2创建VLAN 2S1(config-if)#switch access vlan 2把端口划分到VLAN 2中S1(config)#interface range f0/2 - 3批量配置接口的属性S1#show vlan查看VLAN的信息S1(config-if)#switchport trunk encanpsulation配置Trunk链路的封装类型S1(config-if)#switch mode trunk把接口配置为TrunkS1#show interface f0/13 trunk查看交换机端口的Trunk状态S1(config-if)#switchport nonegotiate Trunk链路上不发送Trunk协商包S1(config)#vtp mode server配置交换机为VTP serverS1(config)#vtp domain NAME配置VTP域名S1(config)#vtp password cisco配置VTP的密码S1(config)#vtp mode client配置交换机为VTP clientS3(vlan)#vtp transparent配置交换机为VTP transparentS1#show vtp status显示VTP的状态S1(config)#vtp pruning启用VTP修剪S1(config)#vtp version 2VTP版本为 2S1(config)#interface port-channel 1创建以太通道S1(config-if)#channel-group 1 mode on把接口加入到以太通道中,并指明以太通道模式S1(config)#port-channel load-balance dst-mac配置EtherChannel的负载平衡方式S1#show etherchannel summary查看EtherChannel的简单信息第十四章 STP命令汇总命令作用S1#show spanning-tree查看STP树信息S1(config)#spanning-tree vlan 1 priority 4096配置VLAN1的桥优先级S1(config)#spanning-tree portfast配置为Portfast,当有设备接入时立即进入转发状态S1(config)#spanning-tree uplinkfast配置Uplinkfast特性S1(config)#spanning-tree backbonefast配置Backbonefast特性S1(config)#spanning-tree mode rapid-pvst把STP的运行模式设为RSTP+PVSTS1(config-if)#spanning-tree link-type point-to-point把接口的链路类型改为点对点S1(config)#spanning-tree mode mst把生成树的模式改为MSTS1(config)#spanning-tree mst configuration进入MST的配置模式S1(config-mst)#name TEST-MST命名MST的名字S1(config-mst)#revision 1配置MST的revision号S1(config-mst)#instance 1 vlan 1-2把VLAN 1和VLAN 2的生成树映射到实例1S1(config-if)##spanning-tree guard root在接口下配置Root Guard特性S1(config-if)#spanning-tree bpduguard enable在接口上配置Bpduguard特性第十五章 VLAN间路由命令汇总命令作用S1(config)#int g0/0.1创建子接口S1(config-subif)#encap dot1q 1 native子接口承载哪个VLAN的流量以及封装类型S1(config)#ip routing打开路由功能S1(config-if)#no switchport接口不作为交换机接口S1(config)#ip cef开启CEF功能。
思科网络设备常用配置命令一、VLAN配置1、添加VLANvlan database //VLAN数据库模式vlan <vlan-id> name <name>真实设备还可以采用全局模式添加VLAN:config terminalvlan <vlan-id>name <name>2、分配接口interface range f0/m – nswitchport mode accessswitchport access vlan <vlan-id>3、查看配置show vlan briefshow vlan id <vlan-id>二、中继配置1、配置Trunkinterface f0/mswitchport mode trunkswitchport trunk encapsulation { isl | dot1q | negotiate } //配封装方式,可不配2、查看接口模式show interface f0/m switchport三、VTP配置vtp domain <域名> //创建VTP域vtp mode { server | client | transparent } //配VTP模式vtp password <密码> //配VTP口令show vtp status //查看配置四、以太网通道配置interface range f0/m – nchannel-protocol {pagp | lacp} //可以不配channel-group <number> mode on五、STP配置spanning-tree vlan <vlan-id> root { primary | secondary } //配为主或次根网桥spanning-tree vlan <vlan-id> priority <0~655535> //配优先级,越小越优先show spanning-tree //查看STP六、三层交换机配置,实现VLAN互通ip routing //启动路由interface vlan <vlan-id> //配置VLAN的IP地址ip address <ip> <netmask>no shutdowninterface f0/m //配f0/m为路由接口no switchport七、静态路由与默认路由配置ip route <network> <netmask> <下一跳地址> //静态路由ip route 0.0.0.0 0.0.0.0 <下一跳地址> //默认路由八、单臂路由配置int f0/xno shutdown (模拟设备小凡用no switchport)int f0/x.1encapsulation dot1q <vlan-id>ip address <ip> <netmask>九、RIP协议配置router ripversion {1 | 2} //选择版本,默认为版本1no auto-summary //关闭路由汇总network <网络地址> //宣告网段redistribute ospf <ospf进程号> //重分发OSPF路由协议十、OSPF协议配置router ospf <进程号>network <网络地址> <反向掩码> area <区域号>redistribute rip //路由重分发十一、HSRP配置interface f0/mstandby <HSRP组号> ip <虚拟IP> //配为HSRP成员standby <HSRP组号> priority <0~255> //配优先级,高的为活跃路由器standby <HSRP组号> preempt //配占先权十二、访问控制列表1、标准ACLaccess-list <1~99> permit | deny <源地址> <反向掩码>interface f0/mip access-group <表号> {in | out }2、扩展ACLaccess-list <100~199> {permit | deny} <协议> <源地址> <反向掩码> <目的地址> <反向掩码> eq 端口3、命名ACLip access-list {standard| extend } <ACL表名>permit | deny <源地址> <反向掩码>{permit | deny} <协议> <源地址> <反向掩码> <目的地址> <反向掩码> eq 端口4、定时ACLtime-range <时间范围名称>periodic <星期X英文> hh:mm to <星期X英文> hh:mm //定义一个时间周期absolute [start hh:mm 日月年] [ end hh:mm 日月年] //定义绝对时间access-list <100~199> {permit | deny} <协议> <源地址> <反向掩码> <目的地址> <反向掩码> eq 端口time-range <时间范围名称> //配ACL时引入时间范围十三、网络地址转换1、静态NATip nat inside soure static <私有IP> <公有IP>interface f0/m //内部端口启用NATip nat insideinterface s1/n //外部端口启用NATip nat outside2、动态NATaccess-list <1~99> permit | deny <源地址> <反向掩码>ip nat pool <地址池名> <开始公有IP> <结束公有IP> netmask <掩码>ip nat inside soure list <ACL表号> pool <地址池名> [overload] //配地址复用加overload 十四、PPP认证1、PAP认证interface serial 0/0encapsulation pppip address <IP地址> <掩码>主认证方:username user_name password 0 pass_wordppp authentication pap被认证方:配置认证用户名和密码Router(config-if)# ppp pap sent-username user_name password 0 pass_word2、CHAP认证主认证方:配置认证用户名和密码Router(config)# username user_name password 0 pass_word启用CHAP认证Router(config-if)# ppp authentication chap配置认证用的用户名Router(config-if)# ppp chap hostname user_name被认证方:配置认证用户名和密码Router(config)# username user_name password 0 pass_word配置认证用的密码Router(config-if)# ppp chap password 0 pass_word优先使用username设置的密码;没有再用ppp chap设置的。
这是学习CUSCO必学的配置使能密码enable secret ciscolab 以cicsolab 为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolab设置虚拟局域网vlan 1 interface vlan 1switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip 和子网掩码aptech2950(conf-if)#no shut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址进入交换机某一端口interface fastehernet 0/17 以17 端口为例switch> enableswitch#c onfigure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface fastehernet 0/17aptech2950(conf-if)#8:查看命令showswitch> enableswitch# show version 察看系统中的所有版本信息show interface vlan 1 查看交换机有关ip 协议的配置信息show running-configure 查看交换机当前起作用的配置信息show interface fastethernet 0/1 察看交换机1 接口具体配置和统计信息show mac-address-table 查看mac 地址表show mac-address-table aging-time 查看mac 地址表自动老化时间9:交换机恢复出厂默认恢复命令switch> enableswitch# erase startup-configureswitch# reload10:双工模式设置switch> enableswitch#c onfigure terminalswitch2950(conf)#hostname aptch-2950aptech2950(conf)# interface fastehernet 0/17 以17 端口为例aptech2950(conf-if)#duplex full/half/auto 有full , half, auto 三个可选项11:cdp 相关命令switch> enableswitch# show cdp 查看设备的cdp 全局配置信息show cdp interface fastethernet 0/17 查看17 端口的cdp 配置信息show cdp traffic 查看有关cdp 包的统计信息show cdp nerghbors 列出与设备相连的cisco 设备12:csico2950 的密码恢复拔下交换机电源线。
用手按着交换机的MODE 键,插上电源线在switch:后执行flash_ini 命令:switch: flash_ini查看flash 中的文件:switch: dir flash:把“config.text”文件改名为“config.old”:switch: rename flash: config.text flash: config.old执行boot:switch: boot交换机进入是否进入配置的对话,执行no :进入特权模式察看flash 里的文件:show flash :把“config.old”文件改名为“config.text”:switch: rename flash: config.old flash: config.text把“config.text ”拷入系统的“running-configure ”:copy flash: config.text system :running-configure把配置模式重新设置密码存盘,密码恢复成功。
13:交换机telnet 远程登录设置:switch>enswitch#c onfigure terminalswitch(conf)#hostname aptech-2950aptech2950(conf)#enable password cisco 以cisco 为特权模式密码aptech2950(conf)#interface fastethernet 0/1 以17 端口为telnet 远程登录端口aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0aptech2950(conf-if)#no shutaptech2950(conf-if)#exitaptech2950(conf)line vty 0 4 设置0-4 个用户可以telnet 远程登陆aptech2950(conf-line)#loginaptech2950(conf-line)#password edge 以edge 为远程登录的用户密码主机设置:ip 192.168.1.2 主机的ip 必须和交换机端口的地址在同一网络段netmask 255.255.255.0gate-way 192.168.1.1 网关地址是交换机端口地址运行:telnet 192.168.1.1进入telnet 远程登录界面password : edgeaptech2950>enpassword: ciscoaptech#14:交换机配置的重新载入和保存设置完成交换机的配置后:aptech2950(conf)#reload是否保存(y/n)y: 保存设置信息n:不保存设置信息1.在基于IOS 的交换机上设置主机名/系统名:switch(config)# hostname hostname在基于CLI 的交换机上设置主机名/系统名:switch(enable) set system name name-string2.在基于IOS 的交换机上设置登录口令:switch(config)# enable password level 1 password在基于CLI 的交换机上设置登录口令:switch(enable) set passwordswitch(enable) set enalbepass3.在基于IOS 的交换机上设置远程访问:switch(config)# interface vlan 1switch(config-if)# ip address ip-address netmaskswitch(config-if)# ip default-gateway ip-address在基于CLI 的交换机上设置远程访问:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.在基于IOS 的交换机上启用和浏览CDP 信息:switch(config-if)# cdp enableswitch(config-if)# no cdp enable为了查看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 neighbors[module/port][vlan|duplex|capabilities|detail]5.基于IOS 的交换机的端口描述:switch(config-if)# description description-string基于CLI 的交换机的端口描述:switch(enable)set port name module/number description-string6.在基于IOS 的交换机上设置端口速度:switch(config-if)# speed{10|100|auto}在基于CLI 的交换机上设置端口速度:switch(enable) set port speed moudle/number {10|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 databaseswitch(vlan)# vlan vlan-num name vlaswitch(vlan)# exitswitch# configure teriminalswitch(config)# interface interface module/numberswitch(config-if)# switchport mode accessswitch(config-if)# switchport access vlan vlan-numswitch(config-if)# end在基于CLI 的交换机上配置静态VLAN:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list9. 在基于IOS 的交换机上配置VLAN 中继线:switch(config)# interface interface mod/portswitch(config-if)# switchport mode trunkswitch(config-if)# switchport trunk encapsulation {isl|dotlq} switch(config-if)# switchport trunk allowed vlan remove vlan-listswitch(config-if)# switchport trunk allowed vlan add vlan-list在基于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 databaseswitch(vlan)# vtp domain domain-name在基于CLI 的交换机上配置VTP 管理域:switch(enable) set vtp [domain domain-name]11.在基于IOS 的交换机上配置VTP 模式:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password password在基于CLI 的交换机上配置VTP 模式:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][passwordpassword]12. 在基于IOS 的交换机上配置VTP 版本:switch# vlan databaseswitch(vlan)# vtp v2-mode在基于CLI 的交换机上配置VTP 版本:switch(enable) set vtp v2 enable13. 在基于IOS 的交换机上启动VTP 剪裁:switch# vlan databaseswitch(vlan)# vtp pruning在基于CL I 的交换机上启动VTP 剪裁:switch(enable) set vtp pruning enable14.在基于IOS 的交换机上配置以太信道:switch(config-if)# port group group-number [distribution{source|destination}]在基于CLI 的交换机上配置以太信道:switch(enable) set port channel moudle/port-rangemode{on|off|desirable|auto}15.在基于IOS 的交换机上调整根路径成本:switch(config-if)# spanning-tree [vlan vlan-list] cost cost在基于CLI 的交换机上调整根路径成本:switch(enable) set spantree portcost moudle/port costswitch(enable) set spantree portvlancost moudle/port [cost cost][vlan-list] 16.在基于IOS 的交换机上调整端口ID:switch(config-if)# spanning-tree[vlan vlan-list]port-priority port-priority 在基于CLI 的交换机上调整端口ID:switch(enable) set spantree portpri {mldule/port}priorityswitch(enable) set spantree portvlanpri {module/port}priority [vlans]17. 在基于IOS 的交换机上修改STP 时钟:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(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 interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]18. 在基于IOS 的交换机端口上启用或禁用Port Fast 特征:switch(config-if)#spanning-tree portfast在基于CLI 的交换机端口上启用或禁用Port Fast 特征:switch(enable) set spantree portfast {module/port}{enable|disable}19. 在基于IOS 的交换机端口上启用或禁用UplinkFast 特征: switch(config)# spanning-tree uplinkfast [max-update-rate pkts-per-second] 在基于CLI 的交换机端口上启用或禁用UplinkFast 特征:switch(enable) set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocols off|on]20. 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP 地址,然后使用下列命令: switch(config)# cluster enable cluster-name21. 为了从一条中继链路上删除VLAN,可使用下列命令:switch(enable) clear trunk module/port vlan-range22. 用show vtp domain 显示管理域的VTP 参数.23. 用show vtp statistics 显示管理域的VTP 参数.24. 在Catalyst 交换机上定义TrBRF 的命令如下:switch(enable) set vlan vlan-name [name name] type trbrf bridgebridge-num[stp {ieee|ibm}]25. 在Catalyst 交换机上定义TrCRF 的命令如下:switch (enable) set vlan vlan-num [name name] type trcrf{ring hex-ring-num|decring decimal-ring-num} parent vlan-num26. 在创建好TrBRF VLAN 之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN 分配端口:switch(enable) set vlan vlan-num mod-num/port-num27. 命令show spantree 显示一个交换机端口的STP 状态.28. 配置一个ELAN 的LES 和BUS,可以使用下列命令:ATM (config)# interface atm number.subint multiointATM(config-subif)# lane serber-bus ethernet elan-name29. 配置LECS:ATM(config)# lane database database-nameATM(lane-config-databade)# name elan1-name server-atm-addressles1-nsap-addressATM(lane-config-databade)# name elan2-name server-atm-addressles2-nsap-addressATM(lane-config-databade)# name …30. 创建完数据库后,必须在主接口上启动LECS.命令如下: ATM(config)# interface atm numberATM(config-if)# lane config database database-nameATM(config-if)# lane config auto-config-atm-address31. 将每个LEC 配置到一个不同的ATM 子接口上.命令如下: ATM(config)# interface atm number.subint multipointATM(config)# lane client ethernet vlan-num elan-num32. 用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 terminalrouter(config)# interface media module/portrouter(config-if)# description description-stringrouter(config-if)# ip address ip-addr subnet-maskrouter(config-if)# no shutdown38. 用中继链路来建立与VLAN 的连接:router(config)# interface module/port.subinterfacerouter(config-ig)# encapsulation[isl|dotlq] vlan-numberrouter(config-if)# ip address ip-address subnet-mask39. 用LANE 来建立与VLAN 的连接:router(config)# interface atm module/portrouter(config-if)# no ip addressrouter(config-if)# atm pvc 1 0 5 qsaalrouter(config-if)# atm pvc 2 0 16 ilnirouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipoint router(config-if)# ip address ip-address subnet-namerouter(config-if)# lane client ethernet elan-namerouter(config-if)# …40. 为了在路由处理器上进行动态路由配置,可以用下列IOS 命令来进行:router(config)# ip routingrouter(config)# router ip-routing-protocolrouter(config-router)# network ip-network-numberrouter(config-router)# network ip-network-number41. 配置默认路由:switch(enable) set ip route default gateway42. 为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)# interface interface numberrouter(config-if)# mls rp vlan-id vlan-id-num43. 在路由处理器启用MLSP:router(config)# mls rp ip44. 为了把一个外置的路由处理器接口和交换机安置在同一个VTP 域中:router(config)# interface interface numberrouter(config-if)# mls rp vtp-domain domain-name45. 查看指定的VTP 域的信息:router# show mls rp vtp-domain vtp domain name46. 要确定RSM 或路由器上的管理接口,可以在接口模式下输入下列命令:router(config-if)#mls rp management-interface47. 要检验MLS-RP 的配置情况:router# show mls rp48. 检验特定接口上的MLS 配置:router# show mls rp interface interface number49. 为了在MLS-SE 上设置流掩码而又不想在任一个路由处理器接口上设置访问列表:set mls flow [destination|destination-source|full]50. 为使MLS 和输入访问列表可以兼容,可以在全局模式下使用下列命令:router(config)# mls rp ip input-acl51. 当某个交换机的第3 层交换失效时,可在交换机的特权模式下输入下列命令:switch(enable) set mls enable52. 若想改变老化时间的值,可在特权模式下输入以下命令:switch(enable) set mls agingtime agingtime53. 设置快速老化:switch(enable) set mls agingtime fast fastagingtime pkt_threshold54. 确定那些MLS-RP 和MLS-SE 参与了MLS,可先显示交换机引用列表中的内容再确定:switch(enable) show mls include55. 显示MLS 高速缓存记录:switch(enable) show mls entry56. 用命令show in arp 显示ARP 高速缓存区的内容。