(完整word版)思科交换机命令大全
思科交换机 路由器配置命令大全

思科Cisco交换机、路由器设置命令交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname <hostname> ;设置交换机的主机名switch(config)#enable secret xxx ;设置特权加密口令为 xxxswitch(config)#enable password xxx ;设置特权非密口令为 xxxswitch(config)#line console 0 ;进控制台口(Rs232)初始化switch(config-line)#line vty 0 4 ;进入虚拟终端virtual ttyswitch(config-line)#login ;允许登录switch(config-line)#password xx ;设置登录口令xx switch#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 ;当前端口1加入VLAN 2switch(config-if)#switchport mode trunk ;设置为干线switch(config-if)#switchport trunk allowed vlan 1,2;设置允许的vlan switch(config-if)#switchport trunk encap dot1q ;设置vlan中继switch(config)#vtp domain <name> ;设置发vtp域名switch(config)#vtp password <word>switch(config)#vtp mode serverswitch(config)#vtp mode client交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1 switch(config-if)#ip address <IP> <mask> ;添加远程登录IP switch(config)#ip default-gateway <IP> ;添加默认网关switch#dir flash: ;查看内存交换机显示命令:switch#write ;写入保存switch#show vtpswitch#show run ;查看当前配置信息switch#show vlan ;看VLANswitch#show interface ;显示所有端口信息switch#show int f0/0 ;显示端口0的信息 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^路由器显示命令:router#show run ;显示接口router#show interface ;显示接口router#show ip route ;显示路由router#show cdp nei ;看邻居router#reload ;重新起动设置口令:router>enable ;进入特权模式router#config terminal ;进入全局配置模式router(config)#hostname <hostname> ;设置交换机的主机名router(config)#enable secret xxx ;设置特权加密口令为 xxxrouter(config)#enable password xxx ;设置特权非密口令为 xxxrouter(config)#line console 0 ;进控制台口(Rs232)初始化router(config-line)#line vty 0 4 ;进入虚拟终端virtual ttyrouter(config-line)#login ;允许登录router(config-line)#password xx ;设置登录口令xx router(config)# (Ctrl+z) ;返回特权模式router#exit ;返回命令配置IP地址:router(config)#int s0/0 ;进行串Serail接口router(config-if)#no shutdown ;起动接口router(config-if)#clock rate 64000 ;设置时钟router(config-if)#ip address 10.1.1.1 255.255.0.0 ;设置IP地址和子网掩码router(config-if)#ip add 10.1.1.2 255.255.0.0 second;router(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address <ip><netmask> ;router(config-subif.1)#encapsulation dot1q <n> ;router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导复制操作:router#copy running-config startup-config ;存配置router#copy running-config tftp ;上载router#copy startup-config tftprouter#copy tftp flash: ;特权模式下升级IOSrouter#copy tftp startup-config ;下载配置文件到nvramROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置,26 36 45xxrommon>confreg 0x2102 ;使用配置,恢复工作状态rommon>reset ;重新引导,等效于重开机rommon>copy xmodem:<sname> flash:<dname> ;从console升级IOSrommon>IP_ADDRESS=10.65.1.2 ;设置路由器IP rommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IPrommon>TFTP_FILE=c2600.bin ;所要下载的文件rommon>tftpdnld ;ROM监控状态下升级IOSrommon>dir flash: ;查看闪存中的内容rommon>boot ;引导IOS静态路由:ip route <ip-address> <subnet-mask> <gateway> 例:router(config)#ip route 10.1.0.0 255.255.0.0 10.2.1.1router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2动态路由:router(config)#ip routing ;启动路由router(config)#router rip ;启动RIP路由协议。
(完整word版)思科交换机配置命令大全

(完整word版)思科交换机配置命令大全思科交换机配置命令大全switch> 用户模式1:进入特权模式enableswitch> enableswitch#2:进入全局配置模式configure terminalswitch> enableswitch#configure terminalswitch(conf)#3:交换机命名hostname aptech2950 以aptech2950为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令enable password cisco 以cisco为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码enable secret ciscolab 以cicsolab为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolab6:设置虚拟局域网vlan 1 interface vlan 1switch> enableswitch#configure 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 设置网关地址7:进入交换机某一端口interface fastehernet 0/17 以17端口为例switch> enableswitch#configure 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的密码恢复拔下交换机电源线。
思科交换机路由器命令大全

思科交换机路由器命令大全思科交换机和路由器命令大全本文档为思科交换机和路由器命令的最新最全范本,供参考使用。
以下是详细的命令列表,包括每个命令的说明和用法。
一、接口配置命令1、ip address:设置接口的IP地质示例:ip address 192.168.1.1 255.255.255:02、no shutdown:启用接口示例:no shutdown3、duplex:设置接口的双工模式示例:duplex auto4、speed:设置接口的速度示例:speed 1005、exit:退出接口配置模式示例:exit二、VLAN命令1、vlan database:进入VLAN数据库模式示例:vlan database2、vlan id name:创建VLAN并设置名称示例:vlan 10 name VLAN-103、vlan id:删除VLAN示例:no vlan 104、show vlan:显示VLAN信息示例:show vlan5、exit:退出VLAN数据库模式示例:exit三、路由命令1、ip route:设置静态路由示例:ip route 192.168.2:0 255.255.255:0 192.168.1.22、router rip:启用RIP路由协议示例:router rip3、network:将网络添加到RIP路由表中示例:network 10:0:0:04、redistribute:将静态路由或其他路由协议添加到RIP路由表中示例:redistribute static5、exit:退出路由配置模式示例:exit四、ACL命令1、access-list:创建标准或扩展ACL示例:access-list 10 permit 192.168.1:0 0:0:0.2552、ip access-group:应用ACL到接口示例:ip access-group 10 in3、show access-lists:显示ACL信息示例:show access-lists4、exit:退出ACL配置模式示例:exit五、SNMP命令1、snmp-server community:设置SNMP团体字符串示例:snmp-server community public RO2、snmp-server enable traps:启用SNMP陷阱示例:snmp-server enable traps3、snmp-server host:配置SNMP陷阱接收主机示例:snmp-server host 192.168.1.1004、exit:退出SNMP配置模式示例:exit六、SSH命令1、ip ssh version:设置SSH协议版本示例:ip ssh version 22、crypto key generate rsa:RSA密钥对示例:crypto key generate rsa3、username:创建新的本地用户示例:username admin privilege 15 password password1234、exit:退出SSH配置模式示例:exit七、其他命令1、show running-config:显示当前配置示例:show running-config2、copy running-config startup-config:将当前配置保存到启动配置中示例:copy running-config startup-config3、reload:重新启动设备示例:reload4、exit:退出CLI命令行模式示例:exit本文档涉及附件:1、无附件本文所涉及的法律名词及注释:1、ACL(Access Control List):访问控制列表,用于控制网络流量的进出。
思科交换机路由器命令大全

思科交换机路由器命令大全交换机命令:1:用户模式switch>进入特权模式switch> enableswitch#2:进入全局配置模式switch> enableswitch#configure terminalswitch(config)#3:交换机命名 hostname aptech2950 以aptech2950为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch-2950aptech2950(conf)#4:配置使能口令 enable password cisco 以cisco为例switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable password cisco5:配置使能密码 enable secret ciscolab以cicsolab为例--设置禁用IP地址解析特性,设置启用消息同步特性switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# enable secret ciscolabaptech2950(conf)#no ip domain-lookup -----设置禁用IP地址解析特性aptech2950(conf)#logging synchronous -----设置启用消息同步特性aptech2950(conf)#interface range fastethernet0/1-20aptech2950(conf-if-range)#spanning-tree portfast -----设置快速端口aptech2950(conf)#interface range fastethernet 0/23-24aptech2950(conf-if-range)#swichport mode trunk -----设置主干道端口aptech2950(conf)#spanning-tree uplingkfast ---设置阻塞启用迅速(只可以在访问层启用)6:设置虚拟局域网vlan 1 interface vlan 1switch> enableswitch#configure terminalswitch(conf)#hostname aptch2950aptech2950(conf)# interface vlan 1aptech2950(conf-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网掩码aptech2950(conf-if)#noshut 是配置处于运行中aptech2950(conf-if)#exitaptech2950(conf)#ip default-gateway 192.168.254 设置网关地址7:进入交换机某一端口 interface fastehernet 0/17 以17端口为例switch> enableswitch#configure 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的密码恢复拔下交换机电源线。
Cisco交换机命令大全

Cisco交换机命令大全Cisco:交换机配置命令Switch命令:一、模式命令:1. 用户模式:Switch>2. 特权模式:Switch>enableSwitch#3. 全局配置模式:Switch#config terminalSwitch(config)#4. 接口配置模式:Switch(config)#interface fastethernet0/1Switch(config-if)#5. Line模式:Switch(config)#line console 0Switch(config-line)#二、特权模式下的命令:1. 查看交换机MAC地址:Switch#show mac-address-table2. Cisco发现协议(CDP):Switch#show cdpSwitch#show cdp interface fastethernet0/1Switch#show cdp neighborsSwitch#show cdp neighbors detailSwitch#show cdp entry3. 保存交换机配置:Switch#copy running-config startup-config或者Switch#write4. 恢复交换机出厂值:Switch#erase startup-configSwitch#reload三、全局配置模式下的命令:1. 配置主机名:Switch(config)#hostname Sw1Sw1(config)#2、设置登陆台密码:Switch(config)#line console 0Switch(config-line)#password 密码Switch(config-line)#login3. 使能口令:Switch(config)#enable Password 密码4. 加密保存的使能口令:Switch(config)#enable secret 密码5. 配置IP地址:Switch(config)#interface vlan 1Switch(config-if)#ip address IP地址网关Switch(config-if)#no shutdown6. 配置交换机网关:Switch(config)#ip default-gateway 网关四、VLAN配置命令:1. 创建vlan命令:a) 全局配置模式下:Switch(config)#vlan 2Switch(config)#name v2Switch(config)#mtu 数值Switch(config)#endb) Vlan数据库下:Switch#vlan databaseSwitch#vlan 2 name v2Switch#vlan 2 mut 数值Switch#exit2. 删除vlan命令:a) 全局配置模式下:Switch(config)#no vlan 2Switch(config)#endb) Vlan数据库下:Switch#no vlan 2 name v2Switch#exit3. 在vlan中添加端口:Switch#config terminalSwitch(config)#interface f0/1(端口)Switch(config-if)#Switchport mode accessSwitch(config-if)#switchport access vlan 2Switch(config-if)#end一次将多个端口添加到vlan中:Switch#config terminalSwitch(config)#interface range f0/1 - 5(端口)Switch(config-if)#switchport access vlan 2Switch(config-if)#end注:switch#show vlan biref(查看vlan信息)4. 配置vlan trunk:1. 配置接口为trunk命令:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport mode trunk2. 配置接口为动态协商模式的命令:Switch(config)# interface f0/1(端口)Switch(config-if)#switchport mode dynamic desirable/auto 3. 从trunk中删除vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan remove 2 4. 在trunk中添加vlan:Switch(config)# interface f0/1(端口)Switch(config-if)#Switchport trunk allowed vlan add 2-----------------------------------------------------------Catalyst 2950交换机密码恢复(1)拔下交换机的电源。
(完整word版)思科交换机命令大全.doc

思科交换机常用命令大全1.1用户模式与特权模式用户模式:可以使用一些基本的查询命令特权模式:可以对交换机进行相关的配置进入特权模式命令:Switch>enable退出特权模式命令:Switch#exit启用命令查询:?时间设置:Switch#clock set时间(自选参数,参数必须符合交换机要求)显示信息命令: Switch#show 可选参数注意:可以用 TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数查看交换机配置 :Switch#show running-config保存交换机配置:Switch#copy running-config startup-configSwitch#wr查看端口信息: Switch#show interface查看 MAC地址表:Switch#show mac-address-table查看交换机 CPU的状态信息:Switch#show processes1.2全局配置模式进入全局配置模式:Switch#configure terminal主机名修改:Switch(config)#hostname 主机名(自选参数)特权模式进入密码:Switch(config)#enable secret 密码(自选参数)取消特权模式密码:Switch(config)#no enable secret取消主机名设置:Switch(config)#no hostname退出配置模式:Switch(config)#exit需要特别注意的是在配置模式中无法使用show命令,如果要使用的话show 前必须加do 和空格,例如:do show *指定根交换机命令:Switch(config)#spanning-tree vlan 自选参数( VLAN号)root primary例如:Switch(config)#spanning-tree vlan 1 root primary需要注意的是:设置根交换机是基于VLAN的关闭生成树协议命令:Switch(config)#no spanning-tree vlan 自选参数(VLAN 号)例如: Switch(config)#no spanning-tree vlan 11.3接口配置模式进入接口配置模式:Switch(config)#interface端口名称(可选参数)启用端口:Switch(config-if)#no shutdown停用端口:Switch(config-if)#shutdown进入同种类型多端口配置:Switch(config)# interface range fastethernet0/1-5进入不同类型多端口配置:Switch(config)#interface range fastethernet0/1-5 ,gigabitethernet 0/1-2退出接口配置模式:Switch(config-if)#exit1.4二层端口的配置端口速率: Switch(config-if)#speed可选参数双工模式: Switch(config-if)#duplex可选参数禁用链路协商: Switch(config-if)#no negotiation auto启用链路协商: Switch(config-if)#negotiation auto1.5 VLAN 的配置新建 VLAN:Switch(config)#vlan 自选参数(VLAN号)Switch(config-vlan)#name自选参数(VLAN名)例如: Switch(config)#vlan 1Switch(config-vlan)#name lab1Switch(config-vlan)#exit删除 VLAN: Switch#vlan databaseSwitch(vlan)#no vlan自选参数(vlan号)例如: Switch#vlan databaseSwitch(vlan)#no vlan 2将一个接口加入VLAN:Switch(config)#interface可选参数(接口号)Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 自选参数(VLAN号)Switch(config-if)#no shutdownSwitch(config-if)#exit例如: Switch(config)#interface f0/1 Switch(config-if)#switchport mode access Switch(config-if)#switchport access vlan 1 Switch(config-if)#no shutdown Switch(config-if)#exit将一个接口退出VLAN:Switch(config)#interface 可选参数(接口号)Switch(config-if)#no switchport access vlan 自选参数(VLAN号)例如: Switch(config)#interface f0/1Switch(config-if)#no switchport access vlan 2修改一个接口为端口汇聚模式Switch(config)#interface 可选参数(接口号)Switch(config-if)#switchport mode trunkVLAN的验证命令:Switch#show vlan 显示VLAN列表Switch#show interface switchport 查看具体接口的VLAN成员资格信息1.6 VTP 的配置VTP Domain Name( VTP域名)Switch#configure terminalSwitch(config)#vtp domain自选参数例如: Switch(config)#vtp domain Lab_NetworkVTP mode(VTP模式)Switch(config)#vtp mode可选参数(Server|Client| Transparent) 例如: Switch(config)#vtp mode ServerVTP Pruning (VTP修剪)Switch(config)#vtp pruning注意:有的交换机不支持VTP修剪命令查看 VTP的配置命令:Switch#show vtp status显示交换机运行的VTP模式,配置修订号和交换机所属的VTP域Switch#show vtp counters显示 VTP消息相关的统计数据1.7远程登录交换机设置配置管理 VLAN:Switch(conf)#interface vlan 1Switch(config-if)#ip address x.x.x.x 255.255.255.0Switch(config-if)#no shutdown注意: IP 地址必须与远程连接交换机的PC机地址在同一网段在交换机上指定默认网关:Switch(config)#ip default-gateway x.x.x.x注意:指定的默认网关仅当前交换机有效。
思科交换机配置命令大全

交换机配置1、基本配置:Switch >enable /进入特权模式Switch#conf t /进入全局配置模式Switch (conf-if)#duplex full/half/auto /有full , half, auto 三个可选switch# erase startup-configure / 恢复出场配置switch# reload / 重启交换机远程登录和con口还有接口配置和路由器配置命令一样,不再下面总结。
2配置VLAN和TRUNKSwitch(config)# vlan xxx /创建一个VLANSwitch(config-vlan)# name xxx /给VLAN命名或Switch# vlan database /进入保存VLAN配置的配置文件Switch(vlan)# vlan 20 name test20 /创建VLAN并给它命名Switch(config-if)# switchport mode access /配置端口模式是accessSwitch(config-if)# switchport access vlan xxx / 把接口划入一个VLAN Switch(config-if)#switchport trunk encapsulation {isl | dot1q | negotiate} /配置trunk封装ISL 或 802.1Q 或自动协商Switch(config-if)#switchport mode {dynamic {auto | desirable} | trunk} /配置二层trunk模式。
Switch(config-if)#switchport trunk allowed vlan {add | all | except | remove} vlan-list可选) / 配置trunk允许的VLAN3查看命令switch#show version /察看系统中的所有版本信息switch#show interface vlan xxx /查看交换机有关ip 协议的配置信息switch#show running-configure /查看交换机当前起作用的配置信息switch#show interface fastethernet xxx /察看交换机xxx接口具体配置和统计信息switch#show mac-address-table /查看mac 地址表switch#show mac-address-table aging-time / 查看mac 地址表自动老化时间4 cdp 相关命令switch#show cdp / 查看设备的cdp 全局配置信息switch#show cdp interface fastethernet xxx /查看xxx 端口的cdp 配置信息switch#show cdp traffic / 查看有关cdp 包的统计信息switch#show cdp nerghbors / 列出与设备相连的cisco 设备VTP配置switch# vlan databaseswitch(vlan)# vtp domain xxx / 配置VTP名字Switch(vlan)#vtp server / 配置VTP模式为serverSwitch(vlan)#vtp client / 配置VTP模式为clientSwitch(vlan)#vtp password xxx / 配置VTP密码switch(vlan)# vtp pruning / 开启VTP剪裁switch#show vtp domain /显示管理域的VTP 参数还有没总结的,我会抓紧时间完善。
思科交换机配置命令大全

思科交换机配置命令大全switch>用户模式1:进入特权模式enableswitch>enableswitch#2:进入全局配置模式configureterminalswitch>enableswitch#configureterminal3switch4switch5switch6switch7switch#configureterminalswitch(conf)#hostnameaptch2950aptech2950(conf)#interfacefastehernet0/17aptech2950(conf-if)#8:查看命令showswitch>enableswitch#showversion察看系统中的所有版本信息showinterfacevlan1查看交换机有关ip协议的配置信息showrunning-configure查看交换机当前起作用的配置信息showinterfacefastethernet0/1察看交换机1接口具体配置和统计信息showmac-address-table查看mac地址表showmac-address-tableaging-time查看mac地址表自动老化时间9:交换机恢复出厂默认恢复命令switch>enableswitch#erasestartup-configureswitch#reload10:双工模式设置switch>enableswitch#configureterminalswitch2950(conf)#hostnameaptch-2950aptech2950(conf)#interfacefastehernet0/17以17端口为例11:cdp12:在查看把“执行把“把“”:13switchaptech2950(conf)#interfacefastethernet0/1以17端口为telnet远程登录端口aptech2950(conf-if)#noshutaptech2950(conf-if)#exitaptech2950(conf)linevty04设置0-4个用户可以telnet远程登陆aptech2950(conf-line)#loginaptech2950(conf-line)#passwordedge以edge为远程登录的用户密码主机设置:运行:进入telnet远程登录界面password:edgeaptech2950>enpassword:ciscoaptech#14:交换机配置的重新载入和保存设置完成交换机的配置后:aptech2950(conf)#reload是否保存(y/n)y:保存设置信息n:不保存设置信息1.在基于IOS的交换机上设置主机名/系统名:switch(config)#hostnamehostname在基于CLI的交换机上设置主机名/系统名:switch(enable)setsystemnamename-string2.在基于3.在基于4.在基于5.基于基于CLI的交换机的端口描述:switch(enable)setportnamemodule/numberdescription-string 6.在基于IOS的交换机上设置端口速度:switch(config-if)#speed{10|100|auto}在基于CLI的交换机上设置端口速度:switch(enable)setportspeedmoudle/number{10|100|auto} switch(enable)setportspeedmoudle/number{4|16|auto}7.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)#duplex{auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable)setportduplexmodule/number{full|half} 8.在基于IOS的交换机上配置静态VLAN:switch#vlandatabaseswitch(vlan)#vlanvlan-numnamevlaswitch(vlan)#exitswitch#configureteriminalswitch(config)#interfaceinterfacemodule/number switch(config-if)#switchportmodeaccessswitch(config-if)#switchportaccessvlanvlan-num switch(config-if)#end在基于CLI的交换机上配置静态VLAN:9.在基于10.在基于11.在基于ord]12.switch#vlandatabaseswitch(vlan)#vtpv2-mode在基于CLI的交换机上配置VTP版本:switch(enable)setvtpv2enable13.在基于IOS的交换机上启动VTP剪裁:switch#vlandatabaseswitch(vlan)#vtppruning在基于CLI的交换机上启动VTP剪裁:switch(enable)setvtppruningenable14.在基于IOS的交换机上配置以太信道:switch(config-if)#portgroupgroup-number[distribution{source|destination}]在基于CLI的交换机上配置以太信道:switch(enable)setportchannelmoudle/port-rangemode{on|off|desirable|auto}15.在基于IOS的交换机上调整根路径成本:switch(config-if)#spanning-tree[vlanvlan-list]costcost在基于CLI的交换机上调整根路径成本:switch(enable)setspantreeportcostmoudle/portcostswitch(enable)setspantreeportvlancostmoudle/port[costcost][vlan-list]16.在基于IOS的交换机上调整端口ID:switch(config-if)#spanning-tree[vlanvlan-list]port-priorityport-priority在基于CLI的交换机上调整端口ID:17.在基于18.在基于19.在基于|on]20.列命令21.22.用23.用24.在Catalyst交换机上定义TrBRF的命令如下:switch(enable)setvlanvlan-name[namename]typetrbrfbridgebridge-num[stp{ieee|ibm}] 25.在Catalyst交换机上定义TrCRF的命令如下:switch(enable)setvlanvlan-num[namename]typetrcrf{ringhex-ring-num|decringdecimal-ring-num}parentvlan-num26.在创建好TrBRFVLAN之后,就可以给它分配交换机端口.对于以太网交换,可以采用如下命令给VLAN分配端口:switch(enable)setvlanvlan-nummod-num/port-num27.命令showspantree显示一个交换机端口的STP状态.28.配置一个ELAN的LES和BUS,可以使用下列命令:ATM(config)#interfaceatmnumber.subintmultiointATM(config-subif)#laneserber-busethernetelan-name29.配置LECS:ATM(config)#lanedatabasedatabase-nameATM(lane-config-databade)#nameelan1-nameserver-atm-addressles1-nsap-address ATM(lane-config-databade)#nameelan2-nameserver-atm-addressles2-nsap-address ATM(lane-config-databade)#name…30.创建完数据库后,必须在主接口上启动LECS.命令如下:ATM(config)#interfaceatmnumberATM(config-if)#laneconfigdatabasedatabase-nameATM(config-if)#laneconfigauto-config-atm-address31.32.用33.用34.用35.用36.用37.38.39.用router(config-if)#laneclientethernetelan-numrouter(config-if)#interfaceatmmodule/port.subinterfacemultipointrouter(config-if)#ipaddressip-addresssubnet-namerouter(config-if)#laneclientethernetelan-namerouter(config-if)#…40.为了在路由处理器上进行动态路由配置,可以用下列IOS命令来进行:router(config)#iproutingrouter(config)#routerip-routing-protocolrouter(config-router)#networkip-network-numberrouter(config-router)#networkip-network-number41.配置默认路由:switch(enable)setiproutedefaultgateway42.为一个路由处理器分配VLANID,可在接口模式下使用下列命令:router(config)#interfaceinterfacenumberrouter(config-if)#mlsrpvlan-idvlan-id-num43.在路由处理器启用MLSP:router(config)#mlsrpip44.为了把一个外置的路由处理器接口和交换机安置在同一个VTP域中:router(config)#interfaceinterfacenumberrouter(config-if)#mlsrpvtp-domaindomain-name45.查看指定的VTP域的信息:46.47.48.49.50.为使51.52.53.54.55.显示56.57.58.router(config-if)#standygroup-numberpreempt59.访问时间和保持时间参数是可配置的:router(config-if)#standygroup-numbertimershellotimeholdtime60.配置HSRP跟踪:router(config-if)#standygroup-numbertracktype-numberinterface-priority 61.要显示HSRP路由器的状态:router#showstandbytype-numbergroupbrief62.用命令showipigmp确定当选的查询器。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
思科交换机常用命令大全
1.1 用户模式与特权模式
用户模式:可以使用一些基本的查询命令
特权模式:可以对交换机进行相关的配置
进入特权模式命令:Switch>enable
退出特权模式命令:Switch#exit
启用命令查询:?
时间设置:Switch#clock set 时间(自选参数,参数必须符合交换机要求)
显示信息命令:Switch#show 可选参数
注意:可以用TAB键补齐命令,自选参数为用户自定义参数,可选参数为交换机设定参数
查看交换机配置: Switch#show running-config
保存交换机配置:Switch#copy running-config startup-config
Switch#wr
查看端口信息:Switch#show interface
查看MAC地址表:Switch#show mac-address-table
查看交换机CPU的状态信息:Switch#show processes
1.2 全局配置模式
进入全局配置模式:Switch#configure terminal
主机名修改:Switch(config)#hostname 主机名(自选参数)
特权模式进入密码: Switch(config)#enable secret 密码(自选参数)
取消特权模式密码:Switch(config)#no enable secret
取消主机名设置: Switch(config)#no hostname
退出配置模式: Switch(config)#exit
需要特别注意的是在配置模式中无法使用show命令,如果要使用
的话show前必须加do和空格,例如:do show *
指定根交换机命令:Switch(config)#spanning-tree vlan 自选参数(VLAN号)root primary
例如: Switch(config)#spanning-tree vlan 1 root primary
需要注意的是:设置根交换机是基于VLAN的
关闭生成树协议命令:Switch(config)#no spanning-tree vlan 自选参数(VLAN 号)
例如: Switch(config)#no spanning-tree vlan 1
1.3 接口配置模式
进入接口配置模式:Switch(config)#interface 端口名称(可选参数)
启用端口:Switch(config-if)#no shutdown
停用端口:Switch(config-if)#shutdown
进入同种类型多端口配置:Switch(config)# interface range fastethernet 0/1-5
进入不同类型多端口配置:Switch(config)#interface range fastethernet 0/1-5,gigabitethernet 0/1-2
退出接口配置模式:Switch(config-if)#exit
1.4 二层端口的配置
端口速率: Switch(config-if)#speed 可选参数
双工模式: Switch(config-if)#duplex 可选参数
禁用链路协商:Switch(config-if)#no negotiation auto 启用链路协商:Switch(config-if)#negotiation auto
1.5 VLAN的配置
新建VLAN:Switch(config)#vlan 自选参数(VLAN号)
Switch(config-vlan)#name自选参数(VLAN名)例如:Switch(config)#vlan 1
Switch(config-vlan)#name lab1
Switch(config-vlan)#exit
删除VLAN: Switch#vlan database
Switch(vlan)#no vlan 自选参数(vlan号)
例如:Switch#vlan database
Switch(vlan)#no vlan 2
将一个接口加入VLAN:
Switch(config)#interface 可选参数(接口号)
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 自选参数(VLAN号)Switch(config-if)#no shutdown
Switch(config-if)#exit
例如:Switch(config)#interface f0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 1
Switch(config-if)#no shutdown
Switch(config-if)#exit
将一个接口退出VLAN:
Switch(config)#interface 可选参数(接口号)
Switch(config-if)#no switchport access vlan 自选参数(VLAN号)例如:Switch(config)#interface f0/1
Switch(config-if)#no switchport access vlan 2
修改一个接口为端口汇聚模式
Switch(config)#interface 可选参数(接口号)
Switch(config-if)#switchport mode trunk
VLAN的验证命令:
Switch#show vlan 显示VLAN列表
Switch#show interface switchport 查看具体接口的VLAN成员资格信息
1.6 VTP的配置
VTP Domain Name(VTP域名)
Switch#configure terminal
Switch(config)#vtp domain 自选参数
例如: Switch(config)#vtp domain Lab_Network
VTP mode(VTP模式)
Switch(config)#vtp mode 可选参数(Server|Client| Transparent)例如: Switch(config)#vtp mode Server
VTP Pruning(VTP修剪)
Switch(config)#vtp pruning
注意:有的交换机不支持VTP修剪命令
查看VTP的配置命令:
Switch#show vtp status
显示交换机运行的VTP模式,配置修订号和交换机所属的VTP域Switch#show vtp counters
显示VTP消息相关的统计数据
1.7 远程登录交换机设置
配置管理VLAN:
Switch(conf)#interface vlan 1
Switch(config-if)#ip address x.x.x.x 255.255.255.0
Switch(config-if)#no shutdown
注意:IP地址必须与远程连接交换机的PC机地址在同一网段在交换机上指定默认网关:
Switch(config)#ip default-gateway x.x.x.x
注意:指定的默认网关仅当前交换机有效。
将交换机连接PC机的端口加入VLAN 1
Switch(config)#interface 端口号(可选参数)
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 1
Switch(config-if)#no shutdown
配置交换机的远程登录
Switch(config)#line vty 0 4
Switch(config-line)#password 自选参数
Switch(config-line)#login
Switch(config)#enable secret 自选参数。