2024年10月思科交换机常用命令(思科交换机关闭端口命令)

 更新时间:2024-10-12

  ⑴思科交换机常用命令(思科交换机关闭端口命令

  ⑵思科交换机关闭端口命令

  ⑶思科交换机关闭端口命令是shutdown。

  ⑷思科shutdown是关闭接口,接口状态会变为DOWN,noshutdown是激活接口,状态变为UP。

  ⑸多数Cisco交换机默认具有处于非连接状态的端口。这表示端口当前没有连接到任何设备,但如果将其连接到其他正常运行的设备,它将可以建立连接。

  ⑹Cisco的工作模式

  ⑺Cisco设备有常用模式为:用户模式、特权模式、全局模式、端口模式。它们之间呈现出递进关系:用户模式-》特权模式-》全局模式-》端口模式。

  ⑻交换机启动完成后按下Enter键,首先进入的就是用户模式,在些用户模式下用户将受到极大的限制,只能用来查看一些统计信息。

  ⑼在用户模式下输入enable(可简写为en(命令就可以进入特权模式,用户在该模式下可以查看并修改Cisco设备的配置。

  ⑽全局配置模式在特权模式下输入configterminal(可简写conft命令即可,用户在该模式下可修改交换机的全局配置。如修改主机名。

  ⑾Switch#conft

  ⑿Switch(config)#

  ⒀在全局配置模式下输入interfacefastether/(可简写intf/就可以进入到接口模式,在这个模式下所做的配置都是针对f/这个接口所设定的。如设定IP等

  ⒁Switch(config)#intf/

  ⒂Switch(config-if)#

  ⒃退回到上一模式用exit命令

  ⒄思科交换机常用命令汇总-以太网和vlan

  ⒅以太网.接口MTU和ipMTUSwitch(config-if)#mtuSwitch(config-if)#ipmtuSwitch#shints/Switch#shipints/.管理MAC表位,点分十六进制表示Switch#showmacaddress-tableSwitch#clearmacaddress-tableSwitch(config)#macaddress-tablestaticaaaa.bbbb.vlaninterfacee/.二层交换.ProtectedportSwitch(config-if)#switchportprotected.NativeVlanSwitch(config-if)#switchporttrunknativevlanSwitch(config)#vlandotqtagnative配置对nativevlan也打标签Vlan范围:(dotq.Trunk配置ISL:支持-个vlan编号DOTQ:支持-个vlan编号Switch(config-if)#switchportmodeaess将接口设置为aess模式Switch(config-if)#switchporttrunkencapsulation{dotq|ISL|negotiate}Switch(config-if)#switchportmode{auto|desirable|trunk}Switch#showinterfacef/switchport将接口设置为DTP动态协商,可auto或desirableSwitch(config-if)#switchportnonegotiate将接口设置为nonegotiate,不发送DTP帧,如果配置为非协商,那么必须手工配置接口模式为aess或trunkSwitch(config-if)#switchportmodedynamic配置接口为协商模式Switch#showinterfacetrunk查看trunk状态Switch#showinterfacesfa/switchport查看接口二层trunk信息Switch(config-if)#switchporttrunkallowedvlan{WORD|add|all|except|none|remove}Switch(config-if)#switchporttrunkallowedvlan?WORDVLANIDsoftheallowedVLANswhenthisportisintrunkingmodeaddaddVLANstothecurrentlistallallVLANsexceptallVLANsexceptthefollowingnonenoVLANsremoveremoveVLANsfromthecurrentlistSwitch(config-if)#switchporttrunkallowedvlanremoveSwitch#showinterfacef/switchport查看接口trunk/vlan/private-vlan信息.VTP.VTP配置Switch(config)#vtpdomainciscoSwitch(config)#vtpmode{server|client|transparent}Switch(config)#vtppasswordSwitch#shvtppassword.VTPpruningSwitch#shvtpstatus.查看trunk及allowedvlan状态Switch#shinttrunk.VTPpruningSwitch(config)#vtppruning开启VTP修剪Switch#shvtpstatus查看VTP状态.私有VLAN(PVLAN.创建主VLAN:VlanPrivate-vlanprimary.创建辅助VLANVlanPrivate-vlanmunityVlanPrivate-vlanioslate.配置主VLAN,将二层辅助VLAN关联到主VLANVlanPrivate-vlanassociation,.将辅助VLAN映射到主VLAN的SVI接口,从而允许PVLAN入口流量的三层交换。InterfacevlanPrivate-vlanmappingadd,.配置接口Interfacef/Switchportmodeprivate-vlanhostSwitchportprivate-vlanhost-association//关联主VLAN和辅助VLAN到接口Interfacef/Switchportmodeprivate-vlanhostSwitchportmodeprivate-vlanhost-association主机接口配置Interfacef/Switchportmodeprivate-vlanpromiscuousSwitchportprivate-vlanmappingadd//将端口映射到PLAN混杂端口配置.查看及验证ShowpvlanmappingPLAN配置示例Sw(config)#vtptransparentSw(config)#vlanSw(config-vlan)#private-vlanisolatedSw(config)#vlanSw(config-vlan)#private-vlanmunitySw(config)#vlanSw(config-vlan)#private-vlanprimarySw(config-vlan)#private-vlanassociation,!Sw(config)#interfacefa/Sw(config-if)#switchportmodeprivate-vlanpromiscuousSw(config-if)#switchportmodeprivate-vlanmapping,Sw(config)#interfacerangefa/-Sw(config-if)#switchportmodeprivate-vlanhostSw(config-if)#switchportprivate-vlanhost-associationSw(config)#interfacerangefa/-Sw(config-if)#switchportmodeprivate-vlanhostSw(config-if)#switchportprivate-vlanhost-association

  ⒆cisco交换机常用命令有哪些

  ⒇在基于IOS的交换机上设置主机名/系统名:switch(config)#hostnamehostname在基于CLI的交换机上设置主机名/系统名:switch(enable)setsystemnamename-string.在基于IOS的交换机上设置登录口令:switch(config)#enablepasswordlevelpassword在基于CLI的交换机上设置登录口令:switch(enable)setpasswordswitch(enable)setenalbepass.在基于IOS的交换机上设置远程访问:switch(config)#interfacevlanswitch(config-if)#ipaddressip-addressmaskswitch(config-if)#ipdefault-gatewayip-address在基于CLI的交换机上设置远程访问:switch(enable)setinterfacescip-addressmaskbroadcast-addressswitch(enable)setinterfacescvlanswitch(enable)setiproutedefaultgateway.在基于IOS的交换机上启用和浏览CDP信息:switch(config-if)#cdpenableswitch(config-if)#nocdpenable为了查看Cisco邻接设备的CDP通告信息:switch#showcdpinterfaceswitch#showcdpneighbors在基于CLI的交换机上启用和浏览CDP信息:switch(enable)setcdp{enable|disable}module/port为了查看Cisco邻接设备的CDP通告信息:switch(enable)showcdpneighbors.基于IOS的交换机的端口描述:switch(config-if)#descriptiondescription-string基于CLI的交换机的端口描述:switch(enable)setportnamemodule/numberdescription-string.在基于IOS的交换机上设置端口速度:switch(config-if)#speed{||auto}在基于CLI的交换机上设置端口速度:switch(enable)setportspeedmoudle/number{||auto}switch(enable)setportspeedmoudle/number{||auto}.在基于IOS的交换机上设置以太网的链路模式:switch(config-if)#duplex{auto|full|half}在基于CLI的交换机上设置以太网的链路模式:switch(enable)setportduplexmodule/number{full|half}.在基于IOS的交换机上配置静态VLAN:switch#vlandatabaseswitch(vlan)#vlanvlan-numnamevlaswitch(vlan)#exitswitch#configureteriminalswitch(config)#interfaceinterfacemodule/numberswitch(config-if)#switchportmodeaessswitch(config-if)#switchportaessvlanvlan-numswitch(config-if)#end在基于CLI的交换机上配置静态VLAN:switch(enable)setvlanvlan-numswitch(enable)setvlanvlan-nummod-num/port-list.在基于IOS的交换机上配置VLAN中继线:switch(config)#interfaceinterfacemod/portswitch(config-if)#switchportmodetrunkswitch(config-if)#switchporttrunkencapsulation{isl|dotlq}switch(config-if)#switchporttrunkallowedvlanremovevlan-listswitch(config-if)#switchporttrunkallowedvlanaddvlan-list在基于CLI的交换机上配置VLAN中继线:switch(enable)settrunkmodule/portVlan-range.在基于IOS的交换机上配置VTP管理域:switch#vlandatabaseswitch(vlan)#vtpdomaindomain-name在基于CLI的交换机上配置VTP管理域:switch(enable)setvtp.在基于IOS的交换机上配置VTP模式:switch#vlandatabaseswitch(vlan)#vtpdomaindomain-nameswitch(vlan)#vtp{sever|cilent|transparent}switch(vlan)#vtppasswordpassword在基于CLI的交换机上配置VTP模式:switch(enable)setvtp.在基于IOS的交换机上配置VTP版本:switch#vlandatabaseswitch(vlan)#vtpv-mode在基于CLI的交换机上配置VTP版本:switch(enable)setvtpvenable.在基于IOS的交换机上启动VTP剪裁:switch#vlandatabaseswitch(vlan)#vtppruning在基于CLI的交换机上启动VTP剪裁:switch(enable)setvtppruningenable.在基于IOS的交换机上配置以太信道:switch(config-if)#portgroupgroup-number在基于CLI的交换机上配置以太信道:switch(enable)setportchannelmoudle/port-rangemode{on|off|desirable|auto}.在基于IOS的交换机上调整根路径成本:switch(config-if)#spanning-treecostcost在基于CLI的交换机上调整根路径成本:switch(enable)setspantreeportcostmoudle/portcostswitch(enable)setspantreeportvlancostmoudle/port.在基于IOS的交换机上调整端口ID:switch(config-if)#spanning-treeport-priorityport-priority在基于CLI的交换机上调整端口ID:switch(enable)setspantreeportpri{mldule/port}priorityswitch(enable)setspantreeportvlanpri{module/port}priority.在基于IOS的交换机上修改STP时钟:switch(config)#spanning-treehello-timesecondsswitch(config)#spanning-treeforward-timesecondsswitch(config)#spanning-treemax-ageseconds在基于CLI的交换机上修改STP时钟:switch(enable)setspantreehellointervalswitch(enable)setspantreefwddelaydelayswitch(enable)setspantreemaxageagingtiame.在基于IOS的交换机端口上启用或禁用PortFast特征:switch(config-if)#spanning-treeportfast在基于CLI的交换机端口上启用或禁用PortFast特征:switch(enable)setspantreeportfast{module/port}{enable|disable}.在基于IOS的交换机端口上启用或禁用UplinkFast特征:switch(config)#spanning-treeuplinkfast在基于CLI的交换机端口上启用或禁用UplinkFast特征:switch(enable)setspantreeuplinkfast{enable|disable}.为了将交换机配置成一个集群的命令交换机,首先要给管理接口分配一个IP地址,然后使用下列命令:switch(config)#clusterenablecluster-namecv

  ⒈求:思科交换机查看vlan命令和配置命令和配置以太网接口命令.

  ⒉Switch#showvlan#查看vlan数据库,vlan信息和所属接口

  ⒊配置VLAN命令(交换机配置VLAN,并给将端口加入到该VLAN为例:

  ⒋cisco-sw(config)#vlan

  ⒌cisco-sw(config-vlan)#nametest

  ⒍cisco-sw(config-vlan)#exit

  ⒎cisco-sw(config)#interface?fastEther/

  ⒏cisco-sw(config-if)#switchportmodeaess

  ⒐cisco-sw(config-if)#switchportaessvlan

  ⒑接口配置命令(进入交换机某一端口

  ⒒switch》enable

  ⒓switch#configureterminal

  ⒔switch(conf)#interfacefasteher/

  ⒕switch(conf-if)#

  ⒖思科交换机其他查看和配置命令:

  ⒗Switch#showrunning-config#查看运行配置,可以通过回车键逐行显示,也可通过空格键逐页显示

  ⒘Switch#showversion#查看设备软件版本信息

  ⒙Switch#showclock#查看系统时钟也可用于查看log日志后对应时钟分析异常log的发起时间

  ⒚Switch#showlog#查看日志,如接口异常关闭,链路的通断,主备机切换

  ⒛Switch#showinterface#查看接口详细状态,如IP地址、MAC地址、带宽负载及输入输出速率等

  Switch#showinterfacedescription#快速查看接口连接状态与描述

  Switch#showinterfacestatus#快速查看接口状态及所属vlan及速率双工

  Switch#showcdpneighbor#查看CDP邻居,CDP协议属于思科私有协议,只能用于查看思科设备,可以查看设备的物理链路状态和连接接口管理地址

  Switch#showmac-addess-table#查看交换机的MAC地址,括号里面是可选项

  CISCO交换机巡检命令

  CISCO交换机巡检命令、showinterfacestats?;查看交换机所有接口当前接口流量、showrunning-config;查看当前设备配置、showversion;查看IOS版本信息及设备正常运行时间、showclock;查看设备时钟信息、showvtpstatus;查看交换机vtp配置模式、showvtppassword;查看交换机vtp配置口令、showenvall;查看设备温度,电源和风扇运转参数及是否报警、showinventory;调取设备内部板卡出厂模块型号及序列号、showspanning-treeroot;查看交换机生成树根位置、showcdpneighbors;查看邻接cisco设备基本信息、showcdpneighborsdetail;查看邻接cisco设备详细信息、showinterfacestatus;查看交换机接口状态是否存在errordisable接口disable接口、showinterfacesummary;查看交换机所有接口当前接口流量、showinterface|ierrors|FastEther|GigabitEther;查看接口是否存在大量input或outputerrors包错误、showprocessescpu;查看设备cpu负载、showprocessesmem;查看设备mem负载、showaess-list;查看访问控制列表配置及匹配数据包数量、showlogging;查看本机内部日志记录情况、showiproute;查看路由表、showfirewall?????????;检查防火墙的工作模式、showconncount????????;检查防火墙并发数、showxlatecount????????;检查防火墙nat工作状态

  Cisco常用的路由器交换机配置命令

  cisco制造的路由器设备、交换机和其他设备承载了全世界%的互联网通信,成为硅谷中新经济的传奇,那么你了解Cisco常用的路由器交换机配置命令吗?下面是我整理的一些关于Cisco常用的路由器交换机配置命令的相关资料,供你参考。

  Cisco常用的路由器支持的命令:

  router#showrun;显示配置信息

  router#showinterface;显示接口信息

  router#showiproute;显示路由信息

  router#showcdpnei;显示邻居信息

  router#reload;重新起动

  router》enable;进入特权模式

  router#configterminal;进入全局配置模式

  router(config)#hostname;设置交换机的主机名

  router(config)#enablesecretxxx;设置特权加密口令

  router(config)#enablepasswordxxb;设置特权非密口令

  router(config)#lineconsole;进入控制台口

  router(config-line)#linevty;进入虚拟终端

  router(config-line)#login;要求口令验证

  router(config-line)#passwordxx;设置登录口令xx

  router(config)#(Ctrl+z);返回特权模式

  router#exit;返回命令

  router(config)#ints/;进入Serail接口

  router(config-if)#noshutdown;激活当前接口

  router(config-if)#clockrate;设置同步时钟

  router(config-if)#ipaddress;设置IP地址

  router(config-if)#ipaddresssecond;设置第二个IP

  router(config-if)#intf/.;进入子接口

  router(config-subif.)#ipaddress;设置子接口IP

  router(config-subif.)#encapsulationdotq;绑定vlan中继协议

  router(config)#config-registerx;跳过配置文件

  router(config)#config-registerx;正常使用配置文件

  router#reload;重新引导

  router#copyrunning-configstartup-config;保存配置

  router#copyrunning-configtftp;保存配置到tftp

  router#copystartup-configtftp;开机配置存到tftp

  router#copytftpflash:;下传文件到flash

  router#copytftpstartup-config;下载配置文件

  Ctrl+Break;进入ROM监控状态

  rommon》confregx;跳过配置文件

  rommon》confregx;恢复配置文件

  rommon》reset;重新引导

  rommon》copyxmodem:flash:;从console传输文件

  rommon》IP_ADDRESS=...;设置路由器IP

  rommon》IP_SUB_MASK=...;设置路由器掩码

  rommon》TFTP_SERVER=...;指定TFTP服务器IP

  rommon》TFTP_FILE=c.bin;指定下载的文件

  rommon》tftpdnld;从tftp下载

  rommon》dirflash:;查看闪存内容

  rommon》boot;引导IOS

  iproute;命令格式

  router(config)#iproute.........;静态路由举例

  router(config)#iproute.........;默认路由举例

  router(config)#iprouting;启动路由转发

  router(config)#routerrip;启动RIP路由协议。

  router(config-router)#work;设置发布路由

  router(config-router)#negihbor;点对点帧中继用。

  router(config)#frame-relayswitching;使能帧中继交换

  router(config-s)#encapsulationframe-relay;使能帧中继

  router(config-s)#fram-relaylmi-typecisco;设置管理类型

  router(config-s)#frame-relayintf-typeDCE;设置为DCE

  router(config-s)#frame-relaydlci;

  router(config-s)#frame-relaylocal-dlci;设置虚电路号

  router(config-s)#frame-relayinterface-dlci;

  router(config)#log-adjacency-changes;记录邻接变化

  router(config)#ints/.point-to-point;设置子接口点对点

  router#showframepvc;显示永久虚电路

  router#showframemap;显示映射

  router(config)#aess-listpermit|deny

  router(config)#interface;default:denyany

  router(config-if)#ipaess-groupin|out;defaultut

  router(config)#aess-listpermit...

  router(config)#aess-listdeny......

  router(config)#aess-listpermit......

  router(config)#aess-listdeny......

  router(config)#aess-listpermitany

  router(config)#intf/

  router(config-if)#ipaess-groupin

  aess-listpermit|denyicmp

  aess-listpermit|denytcp

  router(config)#aess-listdenyicmpany......echo

  router(config)#aess-listpermitipanyany

  router(config)#ints/

  router(config-if)#ipaess-groupin

  router(config)#aess-listdenytcpany......eq

  router(config)#aess-listpermitipanyany

  router(config)#interfaces/

  router(config-if)#ipaess-groupout

  router(config)#noaess-list

  router(config-if)#noipaess-groupin

  Router(config-if)#ipnatinside;当前接口指定为内部接口

  Router(config-if)#ipnatoutside;当前接口指定为外部接口

  Router(config)#ipnatinsidesourcestatic

  Router(config)#ipnatinsidesourcestatic......

  Router(config)#ipnatinsidesourcestatictcp......

  Router(config)#ipnatpoolp.........

  Router(config)#ipnatinsidesourcelistpoolp

  Router(config)#ipnatinsidedestinationlistpoolp

  Router(config)#ipnatinsidesourcelistinterfaces/overload

  Router(config)#ipnatpoolp.........typerotary

  Router#showipnattranslation

  rotary参数是轮流的意思,地址池中的IP轮流与NAT分配的地址匹配。

  overload参数用于PAT将内部IP映射到一个公网IP不同的端口上。

  routerA(config)#routerbgp

  routerA(config-router)#work...

  routerA(config-router)#neighbor...remote-as

  RouterA(config)#usernamepassword

  RouterA(config)#ints

  RouterA(config-if)#pppauthentication{chap|pap}

  Pix(config)#nameifetheroutsidesecurity;命名接口和级别

  Pix(config)#interfaceetherauto;设置接口方式

  Pix(config)#interfaceetherfull;设置接口方式

  Pix(config)#interfaceetherfullshutdown

  Pix(config)#ipaddressinside......

  Pix(config)#ipaddressoutside......

  Pix(config)#global(if_name)natidip-ip;定义公网IP区间

  Pix(config)#global(outside)...-...;例句

  Pix(config)#global(outside)...;例句

  Pix(config)#noglobal(outside)...;去掉设置

  Pix(config)#nat(if_name)nat_idlocal_ip

  Pix(config)#nat(inside)

  内网所有主机(代表...)可以访问global指定的外网。

  Pix(config)#nat(inside)......

  内网.../网段的主机可以访问global指定的外网。

  Pix(config)#routeif_namegateway_ip;命令格式

  Pix(config)#routeoutside...;例句

  Pix(config)#routeinside.........;例句

  Pix(config)#static(inside,outside)......

  表示内部ip地址...,访问外部时被翻译成...全局地址。

  Pix(config)#static(dmz,outside)......

  中间区域ip地址...,访问外部时被翻译成...全局地址。

  Cisco常用的交换机支持的命令:

  switch:;ROM状态,路由器是rommon》

  hostname》;用户模式

  hostname#;特权模式

  hostname(config)#;全局配置模式

  hostname(config-if)#;接口状态

  switch》enable;进入特权模式

  switch#configterminal;进入全局配置模式

  switch(config)#hostname;设置交换机的主机名

  switch(config)#enablesecretxxx;设置特权加密口令

  switch(config)#enablepasswordxxa;设置特权非密口令

  switch(config)#lineconsole;进入控制台口

  switch(config-line)#linevty;进入虚拟终端

  switch(config-line)#login;允许登录

  switch(config-line)#passwordxx;设置登录口令xx

  switch#exit;返回命令

  交换机VLAN设置:

  switch#vlandatabase;进入VLAN设置

  switch(vlan)#vlan;建VLAN

  switch(vlan)#novlan;删vlan

  switch(config)#intf/;进入端口

  switch(config-if)#switchportaessvlan;当前端口加入vlan

  switch(config-if)#switchportmodetrunk;设置为干线

  switch(config-if)#switchporttrunkallowedvlan,;设置允许的vlan

  switch(config-if)#switchporttrunkencapdotq;设置vlan中继

  switch(config)#vtpdomain;设置发vtp域名

  switch(config)#vtppassword;设置发vtp密码

  switch(config)#vtpmodeserver;设置发vtp模式

  switch(config)#vtpmodeclient;设置发vtp模式

  交换机设置IP地址:

  switch(config)#interfacevlan;进入vlan

  switch(config-if)#ipaddress;设置IP地址

  switch(config)#ipdefault-gateway;设置默认网关

  switch#dirflash:;查看闪存

  switch#write;保存配置信息

  switch#showvtp;查看vtp配置信息

  switch#showrun;查看当前配置信息

  switch#showvlan;查看vlan配置信息

  switch#showinterface;查看端口信息

  switch#showintf/;查看指定端口信息

  思科交换机配置命令都有哪些

  思科交换机配置命令如下:

  aess:主要用来接入终端设备,如PC机、服务器、打印服务器等。

  trunk:主要用在连接其它交换机,以便在线路上承载多个vlan。

  multi:在一个线路中承载多个vlan,但不像trunk,它不对承载的数据打标签。主要用于接入支持多vlan的服务器或者一些网络分析设备。现在基本不使用此类接口,在cisco的网络设备中,也基本不支持此类接口了。

  switch》enable;进入特权模式、switch#configterminal;进入全局配置模式、switch(config)#hostname;设置交换机的主机名。

  switch(config)#enablesecretxxx;设置特权加密口令、switch(config)#enablepasswordxxa;设置特权非密口令。

  switch(config)#lineconsole;进入控制台口、switch(config-line)#linevty;进入虚拟终端。

  switch(config-line)#login;允许登录、switch(config-line)#passwordxx;设置登录口令xx、switch#exit;返回命令。

您可能感兴趣的文章:

相关文章