思科常用命令大全
- 格式:doc
- 大小:76.00 KB
- 文档页数:14
1 / 502/ 50FRSW(config-if)#frame-relay intf-type dce FRSW(config-if)#clock rate # FRSW(config-if)#frame-relay route INPUT_DLCI#interfaceOUTPUT_INTERFACEOUTPUT_DLCI# R#show frame-relay route知识点LMI :本地管理接口:1、ANSI :附件D ;2、ITU-T :Q933A ,附件A ;3、CISCO ;知识点DLCI :数据链路链接标识,10字节,0~1023,其中DLCI16~1007→客户端,DLCI0→LMI Q933A 、LMI ANSI ,DLCI1023→CISCO LMI ;FRSW(config-if)#ip split-horizon //开启水平分割,一般交换机是默认自动开启的,但是帧中继交换机是默认关闭的,这样进入这个接口的路由信息,不会再次流出这个接口知识点:FRSW(config-if)#frame-relay lmi-type [cisco | ansi | q933a ] //思科设备默认为cisco ,当帧中继交换机接口选择一种lmi 类型后,则客户端接口会自动配置跟随这种lmi 类型知识点:一、在动态映射的帧中继上,实施 OSPF R(config-if)#encapsulation frame-relay R(config-if)#frame-relay inverse-arp R(config-if)#ip address x.x.x.x m.m.m.m R(config-if)#ip ospf network [broadcast | point-to-point | point-to-multipoint]二、在静态映射(非广播)的帧中继上,实施 OSPF R(config-if)#encapsulation frame-relay R(config-if)#no frame-relay inverse-arp R(config-if)#ip address x.x.x.x m.m.m.mR(config-if)#frame-relay map ip y.y.y.y DLCI # //y.y.y.y 为对端ip 地址R(config-if)#ip ospf network point-to-multipoint non-broadcastR(config)#router ospf ProID# R(config-router)#neighbor y.y.y.y三、点对点子接口的帧中继上,实施 OSPF R(config-if)#encapsulation frame-relay R(config-if)#no frame-relay inverse-arp R(config-if)#interface serial X/X.X point-to-point R(config-if)#ip address x.x.x.x m.m.m.m R(config-if)#frame-relay interface-dlci DLCI#配置帧中继客户端静态映射R(config-if)#no frame-relay inverse-arp //关闭端口的反向ARP 功能R(config-if)#frame-relay map ip 对端1x.x.x.x 本地dlci#1 [broadcast]R(config-if)#frame-relay map ip 对端2x.x.x.x 本地dlci#2 [broadcast] //如果此设备对着多台设备 …. …. …. …. …. ….R(config-if)#frame-relay map ip 对端nx.x.x.x 本地dlci#n [broadcast]配置帧中继客户端的point-to-point 子接口静态映射 R(config)#interface serial #/#R(config-if)#encapsulation frame-relay R(config-if)#no frame-relay inverse-arp R(config-if)#no shutdownR(config-if)#interface serial #/#.# point-to-pointR(config-subif)#ip address x.x.x.x n.n.n.n R(config-subif)#frame-relay interface-dlci 本地dlci# //对于点对点类型接口,不需要说明对端的地址,因为对端只有一台设备,因此不用静态映射,只要给出此接口DLCI 号配置帧中继客户端的multipoint 子接口静态映射 R(config)#interface serial #/#R(config-if)#encapsulation frame-relay R(config-if)#no frame-relay inverse-arp R(config-if)#no shutdownR(config-if)#interface serial #/#.# multipointR(config-subif)#ip address x.x.x.x n.n.n.n R(config-subif)#frame-relay map ip 对端1x.x.x.x 本地dlci#1 [broadcast] R(config-subif)#frame-relay map ip 对端2x.x.x.x 本地dlci#2 [broadcast] …. …. …. …. …. ….R(config-subif)#frame-relay map ip 对端nx.x.x.x本地dlci#n [broadcast]R#show frame-relay pvc知识点HDLC:高级数据链路控制,是设备串行接口的默认数据封装模式,2层协议,具有Address与Protocol,没有2层地址,具有压缩功能,链路之间使用keepalive为此链接,keepavlie默认为10秒,死亡时间为30秒;1、ISO HDLC,基于IBM;2、CISCO HDLC;R(config-if)#encapsulation hdlc //开启HDLCR(config-if)#keepavlie# //设置keepavlie时间,两个接口之间的keepavlie要一样R(config-if)#compress stac //开启压缩,对端也必须开启知识点PPP:Point to Point Protocol,支持压缩、认证(PAP与CHAP),一般用于远程接入,要向ISP申请租用或Dialer,比如电信拨号上网使用PPPoE(这里o为over,E为Ethernet);1、LCP:Link Control Protocol,用于建立PPP;2、NCP:Network Control Protocol,PPP建立好后,NCP告知对端自己的端口地址;R(config-if)#encapsulation ppp //开启PPP封装R(config-if)#no peer neighbor-route //在PPP 封装中,会将对端接口的地址作为一个32位主机地址存放在自己的路由表中,比如本设备接口地址10.10.10.1/24,对端接口地址10.10.10.2/24,启用ppp封装后,设备路由表会显示10.10.10.0/24网段路由,同时也显示对端接口的地址作为一个32位主机地址10.10.10.2/32配置PPP服务器端的PAP认证开启R(config)#username user001 password yangbang R(config-if)#ppp authentication pap //pap为明文的配置PPP客户端的的PAP验证R(config-if)#ppp pap sent-username user001 password yangbang一、chap单向认证:服务器端R1配置:R1(config)#username aaa password yangbangR1(config)#interface s#/#R1(config-if)#encapsulation pppR1(config-if)#ppp authentication chap客户端R2配置:R2(config)#interface s#/#R2(config-if)#encapsulation pppR2(config-if)#ppp chap hostname aaaR2(config-if)#ppp chap password yangbang二、chap双向认证1:服务器端R1配置:R1(config)#username aaa password yangbang1R1(config)#interface s#/#R1(config-if)#encapsulation pppR1(config-if)#ppp authentication chapR1(config-if)#ppp chap hostname bbbR1(config-if)#ppp chap password yangbang2客户端R2配置:R2(config)#username bbb password yangbang2R2(config)#interface s#/#R2(config-if)#encapsulation pppR2(config-if)#ppp authentication chapR2(config-if)#ppp chap hostname aaaR2(config-if)#ppp chap password yangbang1三、chap双向认证2:(在CHAP认证中,也可以在双方设置认证的用户名为对方设备的hostname,并设置相同的密码。
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.思科路由器怎么进入思科路由器怎么设置。
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-addressswitch(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-string CLI:switch(enable)set port name module/number description-string 7.设置端口速度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-listCLI: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-priorityCLI: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 secondsCLI: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-protocols off|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 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清除配置使用:erase startup-config(删除NVRAM中的内容),然后重启路由器reload;华为清除配置使用:reset saved-configuration,重启路由器reboot;ctrl+b(backward) 光标左移一个字符ctrl+f(foreward) 光标右移一个字符ctrl+a(a是) 光标移到命令开头ctrl+e(end) 光标移到命令末端esc+b (backward) 光标左移一个词esc+f (foreward) 光标右移一个词ctrl+z一次性退出特权模式Router#关于模式:用户模式(user execution mode),特权模式(privilege execution mode),全局配置模式(global configuration mode),以及在全局配置模式下的具体配置模式(如路由接口配置模式,路由子接口配置模式,路由协议配置模式,line配置模式等)模式的转换:连接路由后首先进入的是用户模式,特征是有符号">",用户模式只能查找路由的配置和状态,不能配置路由,需要配置路由必须进入特权模式,进入特权模式的命令是:enable 若有密码,需要正确密码才能进入,进入特权模式,其特征是有符号"#".从特权模式进入路由全局配置模式命令是:configure terminal从全局配置模式进入各个具体配置模式的命令如下:特权模式--->路由接口配置模式interface serial??(串口)interface ethernet??(以太网口)特权模式--->路由子接口配置模式subinterface特权模式--->路由协议配置模式route rip特权模式--->line配置模式line vty ? ?以下是各个模式下的命令以及用法:用户模式:Router>show ping telnet connect的用法和特权模式一样特权模式:Router#show users 查看连接到路由器的所有用户show hosts 查看ip和名字的映射表show arp 查看ip地址解释show protocol 查看路由器的协议show version 查看ISO的版本,内存show flash 查看flash使用状况show clock 查看路由器的时间show history 查看最近输入的十个命令show ip interface brief 查看接口的ip设置和状态show interfaces 查看路由器所有端口的状态show interfaces 具体端口查看路由器特定端口的状态show running-config 查看在RAM中的配置文件show startup-config 查看在NVRAM中的配置文件show cdp 查看cdp的信息show cdp entry ??(router) 查看特定的邻近连接的路由器show cdp neighbors 查看所有邻近连接的路由器show cdp neighbors detail 查看所有邻近连接的路由器详细信息show cdp traffic 查看cdp数据包的信息show cdp ??(端口号) 查看特定端口的cdp信息show session 远程登陆下查看原路由器的状态clear cdp counters 清除CDP计数器clear cdp table 清除CDP信息copy running-config startup-config 把在RAM中的配置文件复制到NVRAM中copy startup-config running-config 把在NVRAM中的配置文件复制到RAM中copy tftp running-config 把tftp服务器的配置文件传到RAM中copy running-config tftp 把RAM中的配置文件传到tftp服务器ping ??(名字或ip) 检查路由器与远端路由器的连通性telnet ??(名字或ip) 远程登陆路由器(需要登陆密码)connect ??(名字或ip) 和telnet一样traceroute ??(名字或ip) 查看经过的路由全局配置模式:Router(config)#hostname (名字) 更改路由名字enable password ?? 修改进入特权模式的password密码enable secret ?? 修改进入特权模式的secret密码clock set hour:miniute:second day month year 修改路由器的时间ip host ??(名字) ??(ip地址) 添加ip与名字的映射service password-encryption 将各种密码加密(secret已经加密)cdp run 打开所有接口的cdpcdp timer 设置cdp的timecdp holdtime 设置cdp的holdtimeend 从全局配置模式退出到用户模式exit 一步一步的退出,即逐层地推出,输入一个exit则推出一层接口配置模式:Router(config-if)#ip address ??(ip地址) 修改接口的ip地址no shutdown 打开接口shutdowm 关闭端口clock rate ?? 设置DCE的同步时间(DTE不需要)cdp enable 打开端口的cdpline配置模式:Router(config-line)#line vty 0 4password ??login 设置最大用户登陆数并且设置登陆密码收录最常用的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中的配置信息,即查看启动配置文件show running-config 查看现行配置文件copy running-config startup-config 将现行配置好的信息保存到启动配置文件里,这样下次路由器启动的时候就是这次配置的结果write 保存信息到NVRAM,即保存到启动配置文件里erase 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配置VLANconfigure terminal 进入配置状态vlan vlan-id 输入一个VLAN号, 然后进入vlan配态,可以输入一个新的VLAN号或旧的来进行修改。
、更改远程TELNNET密码Switch#configure terminalSwitch(config#line vty 0 4Switch(config-line#password qycx123Switch(config-line#loginSwitch(config-line#exitb、更改进入全局配置模式时的密码Switch#configure terminalSwitch(config#enable secret qycx123思科交换机常用命令——创建并划分VLANa、创建VLANSwitch#vlan databaseSwitch(vlan#vlan 99 name office (创建vlan 99 并命名为officeb、将端口划分至vlanSwitch(config#interface fastEthernet 0/8Switch(config-if#switchport mode accessSwitch(config-if#switchport access vlan 99 (将8号快速以太口划分至vlan 99 思科交换机常用命令——调试命令a、显示所有配置命令:Switch#show runb、显示所有接口状态:Switch#show ip int briefc、显示所有VLAN的信息:Switch#show vlan briefcisco交换机还是比较常用的,于是我研究了一下Cisco交换机命令的大总结,在这里拿出来和大家分享一下,希望对大家有用。
我所针对的都是Cisco的设备而言的,华为的可以跟据手册来查,配置都是差不多的,这里华子就不多写华为的设备了,了解的也不是很多。
Cisco交换机命令之使用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 返回命令Cisco交换机命令之控制台口令switch(config#line console 0 进入控制台口switch(config-line#login 允许登录switch(config-line#password xx 设置登录口令switch#exit 返回命令Cisco交换机命令之基本接口配置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 保存当前配置nvramswitch#erase startup-config 清除配置文件Cisco交换机命令之交换机VLAN设置:switch#vlan database 进入VLAN设置switch(vlan#vlan 2 建VLAN 2switch(vlan#name 名字建VLAN 2的名称switch(vlan#no vlan 2 删vlan 2注:删除vlan时原属于此vlan的端口处于非激活状态,直到重新分配为止。
干货!思科网络设备配置命令大全础配置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. 计算机命令:PCA login: root ;使用root用户password: linux ;口令是linux# shutdown -h now ;同init 0 关机# logout# login# ifconfig ;显示IP地址# ifconfig eth0 <ip address> netmask <netmask> ;设置IP 地址# ifconfig eht0 <ip address> netmask <netmask> down ;删除IP地址# route add 0.0.0.0 gw <ip># route del 0.0.0.0 gw <ip># route add default gw <ip> ;设置网关# route del default gw <ip> ;删除网关# route ;显示网关# ping <ip># telnet <ip>2. 交换机支持的命令:交换机基本状态:switch: ;交换机的ROM状态rommon> ;路由器的ROM状态hostname> ;用户模式hostname# ;特权模式hostname(config)# ;全局配置模式hostname(config-if)# ;接口状态交换机口令设置:switch>enable ;进入特权模式switch#config terminal ;进入全局配置模式switch(config)#hostname <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 <name> ;设置发vtp域名switch(config)#vtp password <word> ;设置发vtp密码switch(config)#vtp mode server ;设置发vtp模式switch(config)#vtp mode client ;设置发vtp模式交换机设置IP地址:switch(config)#interface vlan 1 ;进入vlan 1switch(config-if)#ip address <IP> <mask> ;设置IP地址switch(config)#ip default-gateway <IP> ;设置默认网关switch#dir flash: ;查看闪存交换机显示命令:switch#write ;保存配置信息switch#show vtp ;查看vtp配置信息switch#show run ;查看当前配置信息switch#show vlan ;查看vlan配置信息switch#show interface ;查看端口信息switch#show int f0/0 ;查看指定端口信息3. 路由器支持的命令:路由器显示命令: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 ;设置特权加密口令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 ;设置登录口令xxrouter(config)#(Ctrl+z) ;返回特权模式router#exit ;返回命令路由器配置:router(config)#int s0/0 ;进入Serail接口router(config-if)#no shutdown ;激活当前接口router(config-if)#clock rate 64000 ;设置同步时钟router(config-if)#ip address <ip> <netmask> ;设置IP地址router(config-if)#ip address <ip> <netmask> second ;设置第二个IProuter(config-if)#int f0/0.1 ;进入子接口router(config-subif.1)#ip address <ip> <netmask> ;设置子接口IProuter(config-subif.1)#encapsulation dot1q <n> ;绑定vlan 中继协议router(config)#config-register 0x2142 ;跳过配置文件router(config)#config-register 0x2102 ;正常使用配置文件router#reload ;重新引导路由器文件操作:router#copy running-config startup-config ;保存配置router#copy running-config tftp ;保存配置到tftprouter#copy startup-config tftp ;开机配置存到tftprouter#copy tftp flash: ;下传文件到flashrouter#copy tftp startup-config ;下载配置文件ROM状态:Ctrl+Break ;进入ROM监控状态rommon>confreg 0x2142 ;跳过配置文件rommon>confreg 0x2102 ;恢复配置文件rommon>reset ;重新引导rommon>copy xmodem:<sname> flash:<dname> ;从console传输文件rommon>IP_ADDRESS=10.65.1.2 ;设置路由器IPrommon>IP_SUBNET_MASK=255.255.0.0 ;设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 ;指定TFTP服务器IPrommon>TFTP_FILE=c2600.bin ;指定下载的文件rommon>tftpdnld ;从tftp下载rommon>dir flash: ;查看闪存内容rommon>boot ;引导IOS静态路由:ip route <ip-address> <subnet-mask> <gateway> ;命令格式router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 ;静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 ;默认路由举例动态路由:router(config)#ip routing ;启动路由转发router(config)#router rip ;启动RIP路由协议。
思科CiscoBGP常⽤show命令⼩结本⽂总结了思科Cisco BGP常⽤show命令。
分享给⼤家供⼤家参考,具体如下:1.常⽤的show 命令查看BGP路由表XRV8#show ip bgp allFor address family: IPv4 UnicastBGP table version is 217, local router ID is 10.255.255.8Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,x best-external, a additional-path, c RIB-compressed,Origin codes: i - IGP, e - EGP, ? - incompleteRPKI validation codes: V valid, I invalid, N Not foundNetwork Next Hop Metric LocPrf Weight Path*> 10.33.0.0/19 0.0.0.0 32768 i*> 10.33.1.0/24 0.0.0.0 0 32768 i*> 10.33.2.0/24 0.0.0.0 0 32768 i*> 10.33.3.0/24 0.0.0.0 0 32768 i查看BGP邻居表XRV8#show ip bgp summaryBGP router identifier 10.255.255.8, local AS number 65002BGP table version is 217, main routing table version 21772 network entries using 10368 bytes of memory76 path entries using 6080 bytes of memory3/3 BGP path/bestpath attribute entries using 456 bytes of memory1 BGP AS-PATH entries using 24 bytes of memory0 BGP route-map cache entries using 0 bytes of memory0 BGP filter-list cache entries using 0 bytes of memoryBGP using 16928 total bytes of memoryBGP activity 140/68 prefixes, 220/144 paths, scan interval 60 secsNeighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd10.201.1.1 4 65000 95 89 217 0 0 01:08:02 410.201.2.1 4 65000 86 90 217 0 0 01:01:00 4查看路由表中的BGP路由XRV8#show ip route bgpCodes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2ia - IS-IS inter area, * - candidate default, U - per-user static routeo - ODR, P - periodic downloaded static route, H - NHRP, l - LISPa - application route+ - replicated route, % - next hop overrideGateway of last resort is not set10.0.0.0/8 is variably subnetted, 141 subnets, 4 masksB 10.33.0.0/19 [200/0], 01:07:50, Null0B 10.63.0.0/19 [20/0] via 10.201.2.1, 00:14:30B 10.79.0.0/19 [20/0] via 10.201.2.1, 00:14:30B 10.118.0.0/19 [200/0], 01:07:50, Null0B 10.123.0.0/19 [200/0], 01:07:50, Null0B 10.133.0.0/19 [20/0] via 10.201.2.1, 00:14:30B 10.149.0.0/19 [200/0], 01:07:50, Null0B 10.158.0.0/19 [20/0] via 10.201.2.1, 00:14:30查看BGP路由含有某些特定路由的信息XRV8#show ip route bgp | include 10.133.0.0B 10.133.0.0/19 [20/0] via 10.201.2.1, 00:19:04查看含有某些前缀的BGP路由信息XRV8#show ip bgp 10.133.0.0BGP routing table entry for 10.133.0.0/19, version 216Paths: (2 available, best #2, table default)Not advertised to any peerRefresh Epoch 465000 65001, (aggregated by 65001 10.255.255.7)10.201.1.1 from 10.201.1.1 (10.255.255.5)Origin IGP, localpref 100, valid, external, atomic-aggregaterx pathid: 0, tx pathid: 0Refresh Epoch 465000 65001, (aggregated by 65001 10.255.255.7)10.201.2.1 from 10.201.2.1 (10.255.255.6)Origin IGP, localpref 100, valid, external, atomic-aggregate, bestrx pathid: 0, tx pathid: 0x0查看某个特定的掩码区间的路由XRV8#show ip bgp 10.133.0.0/16 longer-prefixesBGP table version is 217, local router ID is 10.255.255.8Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,x best-external, a additional-path, c RIB-compressed,Origin codes: i - IGP, e - EGP, ? - incompleteRPKI validation codes: V valid, I invalid, N Not foundNetwork Next Hop Metric LocPrf Weight Path* 10.133.0.0/19 10.201.1.1 0 65000 65001 i*> 10.201.2.1 0 65000 65001 i查看起源于某个特定AS的路由XRV8#show ip bgp regexp 65001$BGP table version is 217, local router ID is 10.255.255.8Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,x best-external, a additional-path, c RIB-compressed,Origin codes: i - IGP, e - EGP, ? - incompleteRPKI validation codes: V valid, I invalid, N Not foundNetwork Next Hop Metric LocPrf Weight Path* 10.63.0.0/19 10.201.1.1 0 65000 65001 i*> 10.201.2.1 0 65000 65001 i* 10.79.0.0/19 10.201.1.1 0 65000 65001 i*> 10.201.2.1 0 65000 65001 i* 10.133.0.0/19 10.201.1.1 0 65000 65001 i*> 10.201.2.1 0 65000 65001 i* 10.158.0.0/19 10.201.1.1 0 65000 65001 i*> 10.201.2.1 0 65000 65001 i。
【基础配置】Showrun查看所有配置Switch>enable 进入特权模式Switch #config terminal 进入全局配置模式Switch(config)#hostname router 设置交换机的主机名为router Switch(config)#enable secret yangxu 设置特权加密口令为yangxu Switch(config)#enable password yangxu 设置特权非密口令为yangxu Switch(config)#line console 0 进入控制台口Switch(config-line)#line vty 0 4 进入虚拟终端Switch(config-line)#login 要求口令验证Switch(config-line)#password xx 设置登录口令xxSwitch(config)#exit 返回特权模式Switch#exit返回命令Switch(config)#no XXX 删除某项命令。
【交换机配置】Switch(config)#vlan 10 创建vlan10Switch(config)#int vlan 10 进入vlan10接口Switch(config)#ip address 192.168.10.1 255.255.255.0配置IP地址Switch(config)#int gi0/1 进入接口0/1Switch(config)# Switchport trunk encapsulation dot1qSwitch(config)#Switchport mode trunk 开启trunkSwitch(config)# Switchport trunk allowed vlan all放通所有vlan通过。
Switch(config)#no shutdown开启接口Switch(config)#int gi0/1 进入接口0/1Switch(config)#Switchport mode access 开启accessSwitch(config)#Switchport access vlan 10把接口划入到vlan10Switch(config)#int gi0/1 进入接口0/1Switch(config)#no Switchport 关闭二层交换功能,开启三层功能Switch(config)#ipadderss 192.168.10.1 255.255.255.252配置ip地址Switch(config)#no shutdown开启接口【DHCP配置】(模拟器默认开启)Switch(config)#Ipdhcp pool yangxu创建DHCP地址池名字为yangxuSwitch(config)#Network 192.168.10.0 255.255.255.0 分配的IP地址网段Switch(config)#default-router 192.168.10.254 分配地址的网关Switch(config)#dns-server 202.102.192.168 DNS服务地址Switch(config)#exit【VRRP功能】(思科使用的HSRP私有协议)Switch(config)#interface f0/0Switch(config-if)#standby 11 ip 192.168.13.254启用HSRP功能,并配置虚拟IP网关地址,11为standby的组号。
思科常用命令大全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号或旧的来进行修改。