最新思科常用命令大全
思科路由器命令大全(完整版)

思科路由器命令大全(完整版)思科路由器命令大全(完整版)本文档旨在提供思科路由器命令的详细说明和使用指南,包括路由器配置、网络管理、安全性设置等内容。
每个章节都详细介绍了不同的命令和参数,以帮助用户更好地理解和使用思科路由器。
1:路由器基本配置1.1 主机名设置1.2 用户名和密码设置1.3 IP 地址和子网掩码配置1.4 默认网关配置2:接口配置2.1 以太网接口配置2.2 串行接口配置2.3 子接口配置2.4 虚拟局域网 (VLAN) 配置3:路由协议配置3.1 静态路由配置3.2 动态路由配置3.2.1 RIP 配置3.2.2 OSPF 配置3.2.3 BGP 配置4:网络管理4.1 SNMP 配置4.2 NetFlow 配置4.3 Syslog 配置4.4 路由器时间设置5:安全性配置5.1 访问控制列表 (ACL) 配置5.2 VPN 配置5.3 防火墙配置5.4 AAA 配置附件:本文档附带的附件包括示例配置文件、命令输出示例等,以帮助读者更好地理解和应用文档中的内容。
法律名词及注释:本文档所涉及的法律名词及其注释如下:1:主机名:指路由器的主机标识名称,用于在网络中识别路由器。
2:用户名和密码:用于登录和管理路由器的凭证信息。
3: IP 地址:网络协议中用于唯一标识设备的数字地址。
4:子网掩码:用于标识 IP 地址中网络部分和主机部分的分界线。
5:默认网关:用于转发网络流量的下一跳路由器。
6:以太网接口:用于连接局域网设备的物理接口。
7:串行接口:用于连接广域网设备的物理接口。
8:子接口:在一个物理接口上创建多个逻辑接口,用于实现VLAN 分隔等功能。
9:虚拟局域网 (VLAN):用于将局域网划分成多个逻辑网络的技术。
10:静态路由:手动配置的路由表项,用于指定数据包传输的路径。
11:动态路由:根据路由协议动态学习和更新的路由表项,用于自动路由选择。
12: RIP:路由信息协议,一种距离向量路由协议。
思科常用命令大全

VLAN 2
NAME 2
2。特权模式下
VLAN DATABASE
VLAN 2 NAME 2
查看VLAN
SHOW VLAN
删除VLAN
NO VLAN 2
验证:SHOW VLAN BRIEF
在VLAN中添加端口
INTERFACE F0/2 (单端口添加)
sw1(config)#int vlan 1
sw1(config-if)#ip address 172.16.0.1 255.255.0.0
sw1(config-if)#no shutdown
sw1(config)#ip default-gateway 172.16.0.254
//以上是vlan 1接口上配置了管理地址,接在vlan 1 上的计算机可以直接进行telnet 该地址,为了其他网段的计算机也可以telnet 交换机,
r1#show int g0/0 (查看g0/0接口的mac地址)
(2)步骤2:配置交换机端口安全
sw1(config)#int f0/1
sw1(config-if)#shutdown
sw1(config-if)#switch mode access
//以上命令是把端口改为访问模式,即用来接入计算机
sw1(config-if)#speed (10|100|1000|auto)
//speed命令用来配置交换机的接口速度 10-10mbps 100-100mbps 1000-1000mbps auto-自动监测接口速度
(4)配置管理地址
交换机允许被telnet ,这时需要在交换机上配置一个ip地址,这个地址是在vlan接口上配置的
最新整理cisco路由器常用命令大全

c i s c o路由器常用命令大全思科c i s c o制造的路由器设备、交换机和其他设备承载了全球80%的互联网通信,成为硅谷中新经济的传奇,那么你知道c i s c o常用命令有哪些吗?下面是学习啦小编整理的一些关于c i s c o常用命令的相关资料,供你参考。
c i s c o常用命令1、S w i t c h用户模式2、S w i t c h e n a b l e进入特权模式S w i t c h#3、S w i t c h#c o n f i g t e r m i n a l进入全局模式S w i t c h(c o n f i g)#4、S w i t c h(c o n f i g)#i n t e r f a c e f0/1进入接口模式 S w i t c h(c o n f i g-i f)#5、S w i t c h(c o n f i g)#l i n e c o n s o l e0进入l i n e模式S w i t c h(c o n f i g-l i n e)#e x i t退回上层e n d结束所有操作6、S w i t c h(c o n f i g)#h o s t n a m e a a a配置主机名7、s w i t c h#s h o w r u n n i n g-c o n f i g查看配置情况8、S w i t c h(c o n f i g)#e n a b l e p a s s w o r d111设置使能密码(明文)9、S w i t c h(c o n f i g)#e n a b l e s e c r e t111设置使能密码(密文)S w i t c h(c o n f i g)#l i n e c o n s o l e0设置c o n s o l e密码S w i t c h(c o n f i g-l i n e)#p a s s w o r d333S w i t c h(c o n f i g-l i n e)#l o g i n10、S w i t c h(c o n f i g)#i n t e r f a c e v l a n1S w i t c h(c o n f i g-i f)#i p a d d r e s s192.168.1.1 255.255.255.0设置I P地址S w i t c h(c o n f i g-i f)#n o s h u t d o w n11、S w i t c h(c o n f i g)#i p d e f a u l t-g a t e w a y192.168.1.10设置网关12、S w i t c h#s h o w m a c-a d d r e s s-t a b l e查看M A C地址表13、S w i t c h#s h o w c d p c d p全局配置信息14、S w i t c h#s h o w c d p i n t e r f a c e f0/1c d p接口配置信息15、S w i t c h#s h o w c d p t r a f f i c c d p包的配置信息16、S w i t c h#s h o w c d p n e i g h b o r s c d p邻居基本信息17、S w i t c h#s h o w c d p n e i g h b o r s d e t a i l c d p邻居详细信息S w i t c h#s h o w c d p n e i g h b o r s e n t r y18、S w i t c h#c o p y r u n n i n g-c o n f i g s t a r t u p-c o n f i g S w i t c h#w r i t e保存交换机配置信息19、S w i t c h#e r a s e s t a r t u p-c o n f i g恢复出厂信息 S w i t c h#r e l o a d重新加载20、交换机密码恢复*断开电源*按住M O D E键,加电(等待数秒)*s w i t c h:出现此符号*s w i t c h:f l a s h_i n i t初始化f l a s h*s w i t c h:d i r f l a s h:(查看文件,可省去)*s w i t c h:r e n a m e c o n f i g.t e x t c o n f i g.o l d改名*s w i t c h:b o o t重启*s w i t c h e n a b l e进入特权*s w i t c h#d i r f l a s h:(查看文件,可省去)*s w i t c h#r e n a m e c o n f i g.o l d c o n f i g.t e x t改名*s w i t c h#c o p y f l a s h:c o n f i g.t e x t r u n n i n g-c o n f i g 复制到系统内*s w i t c h#c o n f i t t e r m i n a l进入全局模式*s w i t c h(c o n f i g)#e n a b l e p a s s w o r d222设置新密码21、s w i t c h#s h o w v l a n-s w b r i e f查看v l a n22、s w i t c h#v l a n d a t a b a s e进入v l a n模式s w i t c h(v l a n)#v l a n20n a m e b b b创建v l a n并命名23、s w i t c h(v l a n)#n o v l a n20删除v l a n24、添加端口到v l a n(单个)s w i t c h(c o n f i g)#i n t e r f a c e f0/1进入接口模式s w i t c h(c o n f i g-i f)#s w i t c h p o r t a c c e s s v l a n 10添加至v l a n10s w i t c h(c o n f i g-i f)#e n d退出s w i t c h#s h o w v l a n b r i e f(i d)验证v l a ns w i t c h(c o n f i g)#s h o w r u n n i n g-c o n f i g i n t e r f a c e f0/1(查看某接口)25、添加端口到v l a n(批量)s w i t c h(c o n f i g)#i n t e r f a c e r a n g e f0/1-5s w i t c h(c o n f i g-i f-r a n g e)#s w i t c h p o r t a c c e s sv l a n1026、s w i t c h(c o n f i g)#i n t e r f a c e f0/1进入接口s w i t c h(c o n f i g-i f)#s w i t c h p o r t m o d e t r u n k设置为t r u n k(永久)s w i t c h(c o n f i g-i f)#s w i t c h p o r t m o d e d y n a m i cd e s i r a b l e/a u t o(其它t r u n k)s w i t c h(c o n f i g-i f)#s w i t c h p o r t t r u n k a l l o w e d v l a n r e m o v e10移除v l a n10)s w i t c h(c o n f i g-i f)#s w i t c h p o r t t r u n k a l l o w e d v l a n a d d20添加v l a n2027、s w i t c h#s h o w i n t e r f a c e f0/1s w i t c h p o r t查看接口模式s h o w i p i n t e r f a c e b r i e f看过文章c i s c o常用命令的人还看了:1.C I S C O路由器的配置与调试2.C i s c o路由器常用配置命令3.C i s c o路由器配置命令全攻略4.如何查看C i s c o路由器的配置信息5.思科C i s c o路由器的基础配置知识6.思科路由器怎么进入思科路由器怎么设置。
思科命令大全

CCNA交换机命令switch>enable 进入特权模式switch#config terminal 进入全局配置模式switch(config)#hostname 设置交换机的主机名switch(config)#enable secret xxx 设置特权加密口令switch(config)#enable password xxa 设置特权非密口令使用Telnet远程式管理switch(config)#interface vlan 1 进入vlan 1switch(config-if)#ip address 设置IP地址switch(config-if)#ip default-gateway 设置默认网关switch(config)#line vty 0 4 进入虚拟终端switch(config-line)#login 允许登录switch(config-line)#password xx 设置登录口令switch#exit 返回命令控制台口令switch(config)#line console 0 进入控制台口switch(config-line)#login 允许登录switch(config-line)#password xx 设置登录口令switch#exit 返回命令基本接口配置switch(config)#interface f0/1 进入f0/1接口switch(config-if)#duplex full 配置全双工模式switch(config-if)#speed 100 配置速率switch(config-if)#description to ***** 接口描述switch(config)#ip domain-name ***.com 设置或名服务器switch(config)#mac-address-table aging-time 设置mac表超时时间switch#write 保存配置信息switch#copy running-config startup-config 保存当前配置nvram switch#erase startup-config 清除配置文件交换机VLAN设置:switch#vlan database 进入VLAN设置switch(vlan)#vlan 2 建VLAN 2switch(vlan)#name 名字建VLAN 2的名称switch(vlan)#no vlan 2 删vlan 2注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止switch(config)#int f0/1 进入端口1switch(config-if)#switchport mode access 当前端口工作莫试switch(config-if)#switchport access vlan 2 当前端口加入vlan 2switch(config-if)#switchport mode trunk 设置为干线switch(config-if)#switchport trunk encapsulation dot1q 设置vlan 中继协议switch(config-if)#no switchport mode 或 ( switchport mode access) 禁用干线switch(config-if)#switchport trunk allowed vlan add 1,2 ; 从Trunk中添加vlans switch(config-if)#switchport trunk allowed vlan remove 1,2 ;从Trunk中删除vlansswitch(config-if)#switchport trunk pruning vlan remove 1,2 ;从Trunk中关闭局部修剪以太网通道配置switch(config)#interface range fasternet0/1 - 2 将fasternet0/1和0/2 口捆绑(成双不成单)switch(config-if)#channel-group 1 mode on 配置以太通道模式switch(config-if)#port-channel load-balance {dst-mac | src-mac}在链路间实现负载均衡switch#show etherchannel 1 summary 查看通道信息switch#show etherchannel load-balance 查看通道信息vtp配置switch(config)#vtp domain 设置vtp域名switch(config)#vtp password 设置vtp密码switch(config)#vtp mode server 设置vtp服务器模式switch(config)#vtp mode client 设置vtp客户机模式switch(config)#vtp mode transparent 设置vtp 透明模式switch(config)#vtp version 设置vtp版本switch(config)#vtp pruning 启用vtp修解switch(config)#no vtp pruning 关闭vtp修解注:要想从vtp中减少一台交换机只需将该交换机vtp 名更改生成树stp:switch(config)#spanning-tree vlan 启用stp生成树(基于vlan)switch(config)#spanning-tree vlan root primary 指定根交换机(基于vlan) switch(config)#spanning-tree vlan root secondary 指定备用根交换机(基于vlan) switch(config)#spanning-tree vlan priority 指定交换机优先级(基于vlan)switch(config)#no spanning-tree vlan priority 将交换机的优先级恢复默认值(基于vlan)switch(config-if)#spanning-tree vlan cost 指定端口成本(起用trunk的端口模式下)switch(config-if)#spanning-tree vlan port-prioty 指定交换机端口优先级(基于vlan)switch(config-if)#spanning-tree portfast 配置速端口(连接终端设备的端口状态)如pc机switch(config)#spanning-tree uplinkfast 配置上行速端口注:在配置上行速端口前要先将基于vlan上的网桥优先级,网桥成本恢复默认值。
思科命令大全

思科交换机命令大全1.设置主机名/系统名IOS:switch(config)# hostname "hostname"CLI:switch(enable) set system name name-string2.设置登录口令IOS:switch(config)# enable password level 1 passwordCLI: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-addressCLI:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.启用和浏览CDP信息IOS:switch(config-if)# cdp enableswitch(config-if)# no cdp enableCLI:switch(enable) set cdp {enable|disable} module/port5.查看Cisco邻接设备的CDP通告IOS:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]CLI:switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 6.端口描述 IOS:switch(config-if)#description escription-stringCLI:switch(enable)set port name module/number description-string7.设置端口速度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}8.设置以太网的链路模式IOS:switch(config-if)# duplex {auto|full|half}CLI:switch(enable) set port duplex module/number {full|half}9.配置静态VLANIOS: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)# endCLI:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list10.配置VLAN中继线IOS: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:switch(enable)set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate]11.配置VTP管理域IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameCLI:switch(enable) set vtp [domain domain-name]12.配置VTP 模式IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password passwordCLI:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][password password]13.配置VTP版本IOS:switch# vlan databaseswitch(vlan)# vtp v2-modeCLI:switch(enable) set vtp v2 enable14.启动VTP剪裁IOS:switch# vlan databaseswitch(vlan)# vtp pruningCLI:switch(enable) set vtp pruning enable15.配置以太信道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} 16.调整根路径成本IOS:switch(config-if)#spanning-tree [vlan vlan-list] cost costCLI:switch(enable)set spantree portcost moudle/port costswitch(enable)set spantree portvlancost moudle/port [cost cost][vlan-list] 17.调整端口IDIOS:switch(config-if)#spanning-tree[vlan vlan-list]port-priority port-priority CLI:switch(enable)set spantree portpri {mldule/port}priorityswitch(enable)set spantree portvlanpri {module/port}priority [vlans]18.修改STP时钟IOS:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(config)#spanning-tree [vlan vlan-list] forward-time secondsswitch(config)#spanning-tree [vlan vlan-list] max-age seconds CLI:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]19.启用或禁用Port Fast 特征IOS:switch(config-if)#spanning-tree portfastCLI:switch(enable)set spantree portfast {module/port}{enable|disable}20.启用或禁用UplinkFast 特征IOS:switch(config)#spanning-tree uplinkfast [max-update-rate pkts-per-second]CLI:switch(enable)set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocolsoff|on] 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个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 multipointrouter(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipointrouter(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高速缓存区的内容。
思科命令大全(完整版)

思科交换机命令大全1.设置主机名/系统名IOS:switch(config)# hostname "hostname"CLI:switch(enable) set system name name-string2.设置登录口令IOS:switch(config)# enable password level 1 passwordCLI: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-addressCLI:switch(enable) set interface sc0 ip-address netmask broadcast-address switch(enable) set interface sc0 vlanswitch(enable) set ip route default gateway4.启用和浏览CDP信息IOS:switch(config-if)# cdp enableswitch(config-if)# no cdp enableCLI:switch(enable) set cdp {enable|disable} module/port5.查看Cisco邻接设备的CDP通告IOS:switch# show cdp interface [type modle/port]switch# show cdp neighbors [type module/port] [detail]CLI:switch(enable) show cdp neighbors[module/port] [vlan|duplex|capabilities|detail] 6.端口描述 IOS:switch(config-if)#description escription-stringCLI:switch(enable)set port name module/number description-string7.设置端口速度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}8.设置以太网的链路模式IOS:switch(config-if)# duplex {auto|full|half}CLI:switch(enable) set port duplex module/number {full|half}9.配置静态VLANIOS: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)# endCLI:switch(enable) set vlan vlan-num [name name]switch(enable) set vlan vlan-num mod-num/port-list10.配置VLAN中继线IOS: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:switch(enable)set trunk module/port [on|off|desirable|auto|nonegotiate] Vlan-range [isl|dotlq|dotl0|lane|negotiate]11.配置VTP管理域IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameCLI:switch(enable) set vtp [domain domain-name]12.配置VTP 模式IOS:switch# vlan databaseswitch(vlan)# vtp domain domain-nameswitch(vlan)# vtp {sever|cilent|transparent}switch(vlan)# vtp password passwordCLI:switch(enable) set vtp [domain domain-name][mode{ sever|cilent|transparent }][password password]13.配置VTP版本IOS:switch# vlan databaseswitch(vlan)# vtp v2-modeCLI:switch(enable) set vtp v2 enable14.启动VTP剪裁IOS:switch# vlan databaseswitch(vlan)# vtp pruningCLI:switch(enable) set vtp pruning enable15.配置以太信道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} 16.调整根路径成本IOS:switch(config-if)#spanning-tree [vlan vlan-list] cost costCLI:switch(enable)set spantree portcost moudle/port costswitch(enable)set spantree portvlancost moudle/port [cost cost][vlan-list] 17.调整端口IDIOS:switch(config-if)#spanning-tree[vlan vlan-list]port-priority port-priority CLI:switch(enable)set spantree portpri {mldule/port}priorityswitch(enable)set spantree portvlanpri {module/port}priority [vlans]18.修改STP时钟IOS:switch(config)# spanning-tree [vlan vlan-list] hello-time secondsswitch(config)#spanning-tree [vlan vlan-list] forward-time secondsswitch(config)#spanning-tree [vlan vlan-list] max-age seconds CLI:switch(enable) set spantree hello interval[vlan]switch(enable) set spantree fwddelay delay [vlan]switch(enable) set spantree maxage agingtiame[vlan]19.启用或禁用Port Fast 特征IOS:switch(config-if)#spanning-tree portfastCLI:switch(enable)set spantree portfast {module/port}{enable|disable}20.启用或禁用UplinkFast 特征IOS:switch(config)#spanning-tree uplinkfast [max-update-rate pkts-per-second]CLI:switch(enable)set spantree uplinkfast {enable|disable}[rate update-rate] [all-protocolsoff|on] 为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个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 multipointrouter(config-if)# ip address ip-address subnet-maskrouter(config-if)# lane client ethernet elan-numrouter(config-if)# interface atm module/port.subinterface multipointrouter(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(恩科)命令大全switch配置命令(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"config t"全局配置模式----接口模式,使用命令"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} 进入组配置状态配置三层端口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(config)# interface gigabitethernet0/2Switch(config-if)# no switchportSwitch(config-if)# ip address 192.20.135.21 255.255.255.0Switch(config-if)# no shutdown配置VLAN(虚拟局域网)configure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改。
思科交换机路由器命令大全

思科交换机路由器命令大全思科交换机和路由器命令大全本文档为思科交换机和路由器命令的最新最全范本,供参考使用。
以下是详细的命令列表,包括每个命令的说明和用法。
一、接口配置命令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、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
思科常用命令大全1用户模式2:特权模式enableshow vlanshow versionshow interfaceshow mac-address-tableshow running-configcopy running-config startup-config 3:全局配置模式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的计算机之间的通信隔开。
使达到减少广播域范围的作用。
一、交换机基本配置(1)步骤1 :配置主机名switch>enableswitch#config tswitch(config)# hostname sw1(2) 步骤2 :配置密码sw1(config)#enable secret ciscosw1(config)#line vty 0 15sw1(config-line)#password ciscosw1(config-line)#login(3)步骤3 :接口基本配置sw1(config)#interface f0/1sw1(config-if)#duplex (full|half|auto)//duplex用来配置接口的双工模式:full-全双工half-半双工auto-自动监测双工的模式sw1(config-if)#speed (10|100|1000|auto)//speed命令用来配置交换机的接口速度10-10mbps 100-100mbps 1000-1000mbps auto-自动监测接口速度(4)配置管理地址交换机允许被telnet ,这时需要在交换机上配置一个ip地址,这个地址是在vlan接口上配置的sw1(config)#int vlan 1sw1(config-if)#ip address 172.16.0.1 255.255.0.0sw1(config-if)#no shutdownsw1(config)#ip default-gateway 172.16.0.254//以上是vlan 1接口上配置了管理地址,接在vlan 1 上的计算机可以直接进行telnet 该地址,为了其他网段的计算机也可以telnet 交换机,我们在交换机上配置了默认网关。
(5)保存配置sw1#copy running-config startup-config二、交换机端口安全(1)步骤1 :检查r1的g0/0接口的mac地址r1(config)#int g0/0r1(config-if)#no shutdownr1(config-if)#ip address 172.16.0.101 255.255.0.0r1#show int g0/0 (查看g0/0接口的mac地址)(2)步骤2:配置交换机端口安全sw1(config)#int f0/1sw1(config-if)#shutdownsw1(config-if)#switch mode access//以上命令是把端口改为访问模式,即用来接入计算机sw1(config-if)#switch port-security//以上命令是打开交换机的端口安全功能sw1(config-if)#switch port-security maximum 1//以上命令是只允许该端口下的mac条目最大数量为1,即只允许一个设备接入sw1(config-if)#switch port-security violation (protect|shutdown|restrict)//命令含义是:protect :当新的计算机接入时,如果该接口的mac条目超过最大数量,则这个新的计算机将无法接入,而原有的计算机不受影响。
shutdown :当新的计算机接入时,如果该接口的mac条目超过最大数量,则该接口将会被关闭,则这个新的计算机和原有的计算机都无法接入,需要管理员使用“no shutdown”命令重新打开。
restrict: 当新的计算机接入时,如果该接口的mac条目超过最大数量,则这个新的计算机可以接入,然而交换机将发送警告信息。
sw1(config-if)#switch port-security mac-address 0019.5535.b828(r1的mac)//允许r1路由器从f0/1接口接入。
sw1(config-if)#no shutdownsw1(config)#int vlan 1sw1(config-if)#no shutdownsw1(config-if)#ip address 172.16.0.1 255.255.0.0//以上是配置交换机的管理地址(3)步骤3:检查mac地址表sw1# show mac-address-table(4)步骤4 模拟非法接入r1# ping 172.16.0.1通!在r1上修改g0/0的mac地址为另个地址,模拟式另外一台设备接入,r1(config)#int g0/0r1(config-if)#mac-address 12.12.12过几秒后,则在sw1 上出现提示f0/1接口被关闭sw1#show int f0/1sw1#show port-secutity//以上命令是查看端口安全的设置情况三、交换机的密码恢复(1)拔掉交换机电源,按住交换机前面面板的mode键不放,接上电源,(2)输入flash_init命令。
(3)输入load helper 命令(4)输入dir flash://config.text 就是交换机的启动配置文件,和路由器的startup-config 类似。
(5) 输入rename flash:config.text flash:config.old命令//以上是将启动配置文件改名,这样交换机启动时就读不到config.text了,从而没有了密码。
(6)输入boot 命令引导系统,这时就不要在按住mode键了。
(7)当出现如下提示时,输入n:continue with the configuration dialog?:n(8) 用enable 命令,进入特权模式,并将文件config.old 该回config.text,命令如下。
sw1#rename flash:config.old flash:config.text(9) 将原配置装入内存,命令如下:sw1#copy flash:config.text system:running-config(10) 修改各个密码:sw1#config tsw1(config)#enable secret ciscosw1(config)#exit(11) 将配置写入nvramsw1#copy running-config start-config四、交换机的ios恢复(1)把计算机的串口和交换机的console口连接好,用超级终端软件连接上交换机,(2)交换机开机后,执行以下命令switch:flash_initswitch:load_helper(3) 输入复制指令:switch:copy xmodem: flash:c2950-i6q412-mz.121-22.ea5a.bin(4)传送完毕后执行以下命令:switch :boot启动系统cisco命令大全1.switch配置命令(1)模式转换命令用户模式----特权模式,使用命令"enable"特权模式----全局配置模式,使用命令"config t"全局配置模式----接口模式,使用命令"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 # +信息+ # 配置路由器或交换机的描素信息de script ion+信息配置接口听描素信息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 查看路由表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 进入组配置状态配置三层端口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(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号或旧的来进行修改。