Cisco命令整理Word文档下载推荐.docx
- 文档编号:7280139
- 上传时间:2023-05-08
- 格式:DOCX
- 页数:61
- 大小:418.70KB
Cisco命令整理Word文档下载推荐.docx
《Cisco命令整理Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《Cisco命令整理Word文档下载推荐.docx(61页珍藏版)》请在冰点文库上搜索。
SW#deleteflash:
vlan.dat//交换机有这条
SW#reload//清空交换机配置的3步命令
•Frame-relay•
帧中继交换机配置步骤
RouterX(config)#frame-relayswitching
RouterX(config-if)#encapsulationframe-relay
RouterX(config-if)#frame-relaylmi-type(cisco,ansi,q933a)
RouterX(config-if)#frame-relayintf-typedce
RouterX(config-if)#clockrate128000
RouterX(config-if)#frameroutexxxints0/0xxx
RouterX(config-if)#noshutdown
帧中继查看命令
#showinterfaces0/0查看接口
#showframe-relaylmi查看lmi类型
#showframe-relaypvc查看pvc链路
#showframe-relaymap查看帧中继映射表(在客户端路由器上作,动态和静态都可以看到)
#showframe-relayroute查看帧中继映射表(帧中继交换机上作)
查看线缆类型DCE/DTE
FR#showcontrollerss0/0帧中继的DTE、DCE端和线缆无关,是一个二层概念,线缆的DTE、DCE是一层概念
清空ARP表项
#clearframe-relayinarp
关闭逆向ARP
Router(config-if)#noframe-relayinverse-arp
•Vlan•
SW1(config)#vlan20
SW1(config-vlan)#namexx//全局创建
SW1#vlandatabase
SW1(vlan)#vlan10namexx
SW1(vlan)#applyorexit(常用exit,退出并保存的意思)//database模式(低端交换机及连接了交换板卡的路由器上创建vlan信息)
SW1(config)#macronamexxx(vlan名称)
vlan30
vlan40
exit
@
SW1(config)#macroglobalapplyxxx//宏模式创建(非常少用,不推荐)
SW1(config-if)#switchportvoicevlan20//将某一端口划分到语音vlan
Sw1(config-if)#switchporthost//将端口配置为主机设备所使用,配置后默认对端口启用portfast和禁用ehterchannel特性
Sw1(config-if)#switchportmodeaccess(指定为接入端口)
Sw1(config-if)#switchportaccessvlan2(将接口划入VLAN2常用命令)。
Sw1(config)#macaddress-tableaging-time600(vlan2)//默认每个VLAN中的MAC地址表老化时间是300S,设置为0代表永不超时
Showvlanbrief//查看vlan信息(真机)
Showvlan-switchbriefGNS3
•VlanTrunk•
Sw(config-if)#switchporttrunkencapsulationdot1q/isl/nonegotiate//设置接口封装类型
Sw1(config-if)#switchportmodeaccess/trunk/dynamicdesirable/dynamicauto//设置接口协商模式
SW1(config-if)#switchportnonegotiate禁止协商(强制关闭DTP)nonegotiate只能和trunk
Sw(config-if)#switchporttrunknativevlan2//修改本证vlan
Sw(config)#vlandot1qtagnative//给本征vlan加标(需要链路两端同时启用)
Sw(config-if)switchporttrunkallowedvlanx//允许某一VLAN信息通过
Sw(config-if)switchporttrunkallowedvlanall//允许所有VLAN
双TAG实验
客户端配置:
Sw3(config-if)#switchportmodetrunk
Sw3(config-if)#switchporttrunkencapsulationdot1q//客户端必须封装为dot1q
服务提供商配置:
Sw1(confit-if)#switchportaccessvlan30//划入ISP的VLAN(区分企业)
Sw1(confit-if)#switchportmodedotlq-tunnel//Q-in-Q
在做802.1Qtunnel的时候一定要修改MTU,防止数据包分片
SW1(config)#systemmtu1504(配置完成不会生效,要保存配置)
SW1(config)#wr
SW1(config)#reload
SW#showinterfacef0/0switchport查看接口配置信息
SW(config)#defaultinterfacef0/0还原接口配置信息
Sw#Showinterfacef0/24switchport查看二层端口的配置
•VTP•
Sw(config)#vtpmodeserver/client/transparent//设置vtp模式
Sw(config)#vtpdomaindomain-name
Sw(config)#vtppasswordpassword
Sw(cngfig)#vtppruning//在server端开启
Sw#showvtppassword//查看vtp认证密码
•STP•
Sw#showspanning-tree
Sw#showspanning-treebrief(低版本用)2900以下的交换机用这一命令
RouterX(config)#spanning-treevlanXrootprimary/secondary//将某一交换机作为某一Vlan的根桥/备份根桥
RouterX(config)#spanning-treevlanXpriorityxxx(0-61400)//设置接口优先级,必须为4096的倍数
RouterX(config-if)#spanning-treecostxx//修改默认端口cost值
RouterX(config-if)#spanning-treeport-priorityxx(0-240)//修改端口默认优先级,默认是128,必须是16的倍数
Sw#showspanning-tree(vlanid)//查看所有/某一vlan信息
Sw#showspanning-tree(vlanid)detail//查看所有/某一vlanvtp详细信息
Sw#showspanning-treesummarytotals//查看关于接口开启了哪些STP命令
STP高级特性
Portfast
Sw(config-if)#spanning-treeportfast//接口下单独启用
Sw(config)#spanning-treeportfastdefault//全局启用
Uplinkfast
Sw(config)#spanning-treeuplinkfast
用于非根桥交换机上,当直连的网络发生改变,允blocking的接口立即进入forwarding状态
Backbonefast
Sw(config)#spanning-treebackbonefast
建议所有交换机上都配置该命令,就是uplinkfast增强版
STP优化
BPDU防护——接口关闭
Sw(config)#spanning-treeportfastbpduguarddefault//交换机上所有使用portfast的接口都开启
Sw(config-if)#spanning-treebpduguardenable//接口开启
Errdisable接口恢复先shutdown,再noshutdown
Showerrdisablerecovery//显示可导致接口errdisable的选项
Sw(config)#errdisablerecoverycausebpduguard//设置300S(默认)后自动修复bpduguard所导致的errdisable
Sw(config)#errdisablerecoveryinterval30//修改默认的修复时间
BPDU过滤——不收也不发
Sw(config)#spanning-treeportfastbpdufilterdefault//在所有启用portfast接口开启filter功能
Sw(config-if)#spanning-treebpdufilterenable//接口开启
接口级别的BPDUfilter优先级最高,接口级别的BPDUGuard,全局级别的BPDUGuard,全局级别的BPDUfilter
Sw#showspanning-treesummary(totals)查看命令
根防护
Sw(config-if)#spanning-treeguardroot
环路保护
Sw(config)#spanning-treeloopguarddefault(全局)
Sw(config-if)#spanning-treeguardloop(接口)
UDLD单向链路失效检测
SW(config-if)#udldport[aggressive]//接口下开启,不加参数为常规模式,加参数为激进模式
Sw(config)#udldenable/aggressive//在交换机所有接口开启常规/激进模式的UDLD
SW(config)#udldmessagetime<
1-90>
//修改默认间隔时间(交换机两端都要修改)
Sw1#showudld
RSTP(RapidSTP) 快速生成树协议802.1w当前主流技术
Sw(config)#spanning-treemoderapid-pvst理论一大把,命令就一条
SW(confg-if)#spanning-treeportfast//边缘端口配置命令(同portfast)
MSTP(MultipleSpanningTreeProtocol)多生成树协议 802.1s
Sw1(config)#spanning-treemodemst//启用MST
Sw1(config)#spanning-treemstconfiguration//进入MST配置
Sw1(config-mst)#nameWOLF//命名
Sw1(config-mst)#revision10//设置版本
Sw1(config-mst)#instance1vlan1-5//设置实例
Sw1(config-mst)#instance2vlan6-10
Sw1(config-if)#spanning-treelink-type{point-to-point|shared}
//配置端口链路类型
SW1(config)#spanning-treemstinstance_numberrootprimary|secondary//将某一交换机作为vlan组的根
Sw1(config)#spanning-treemst1priority4096//修改本交换机在这一大堆VLAN中的优先级
Sw1(config-if)#spanning-treemst1cost19//修改本接口在这一组中的开销<
1-200000>
SW1(config-if)#spanning-treemst1port-priority//修改端口优先级<
1-128>
Sw1#showspanning-treemst
Sw1#showspanning-treemstconfigurationOrSw1#showpending
Sw1(config)#clearspanning-treedetected-protocols[interfaceinterface-id]//对所有/某一端口进行强制版本检查
•EtherChannel•
On:
强行起etherchannel
Sw1(config)#intrangef0/8,f0/9
Sw1(config-if-range)#channel-group1modeon//将这两个接口绑定为一组并指定on模式
Sw1(config)#interfaceport-channel1//将接口划入port-channle1
Sw1(config-if)#switchportencapsulationdot1q
Sw1(config-if)#switchportmodetrunk//指定接口模式为trunk,如不指定,会自动继承物理接口的模式
PortAggregationProtocol(PAgP)端口汇聚协议(Cisco私有)
Sw1(config-if-range)#channel-group1modedesirable/auto//两种协商模式desraible会收发,auto只收不发
Sw1(config)#interfaceport-channel1
Sw1(config-if)#switchportmodetrunk
LinkAggregationControlProtocol(LACP)链路聚合控制协议(业界标准)
Sw1(config-if-range)#channel-group1modeactive/passive//active=desirable,passive=auto
配置三层channel
3550(config)#interfacerangegigabitethernet0/1,gigabitethernet0/2//将3550两个千兆口设置为channel
3550(config-if)#noswitchport//将交换机2层接口改为3层接口
3550(config-if)#channel-group1modedesirable//设置绑定协商模式
3550(config-if)#exit
3550(config)#interfaceport-channel1
3550(config-if)#ipaddress100.1.1.1255.255.255.0
配置etherchannel负载均衡
port-channelload-balance[src-mac|dst-mac|src-ip|dst-ip|src-dst-mac|src-dst-ip]六种负载均衡模式
showetherchannelload-balance//查看以太信道负载分担
showetherchannelsummary//查看接口属于什么以太信道
Showinterfaceetherchannel
速度和双工
Sw1(config-if)#speed10/100/auto//速率不匹配接口会down
Sw1(config-if)#deplexfull/half/auto//双工不匹配接口可以起来
•Pvlan•——至少要在3560型号以上的交换机才能部署
1将VTP定义为透明模式
SW1(config)#vtpmodetransparent
2定义主vlan
SW1(config)#vlan200
SW1(config-vlan)#private-vlanprimary
3定义二级vlan
SW1(config)#vlan201
SW1(config-vlan)#private-vlanisolated//设置为隔离VLAN
SW1(config)#vlan202
SW1(config-vlan)#private-vlancommunity//设置为联盟VLAN
4将子VLAN划入主VLAN中,建立一个联系
SW1(config-vlan)#private-vlanassociation201-202
SW1(config-vlan)#private-vlanassociationadd/remove203加入/删除一个子VLAN(可选)
5将端口设定一个模式,并划入相应的VLAN中
SW1(config-if)#switchportmodeprivate-vlanhost
设置端口的模式为主机端口{根据子VLAN的类型成为相应的端口(隔离/联盟端口的配置命令相同,只是根据划入的子vlan不同而不同)}
SW1(config-if)#switchportprivate-vlanhost-association200201//将端口划入VLAN200中的子VLAN201
Sw1(config-if)#switchportmodeprivate-vlanpromiscuous//设置端口模式为混杂端口
Sw1(config-if)switchportprivate-vlanmapping200201-202设定混杂端口所能管理的子VLAN
Sw1(config-if)switchportprivate-vlanmapping200add/remove203增加或移除一个可管理的子VLAN(可选)
#showinterfacef0/0switchport
6将辅助VLAN映射到主VLAN的第3层SVI接口,从而允许PVALN入口流量的第3层交换
Sw1(config)#intvlan200
Sw1(config-if)#private-vlanmapping201-202//允许这几个子VLAN下的端口访问外部的网段
Sw1#showvlanprivate-vlan能看到端口
Sw1#showvlanprivate-vlantype能看到VLAN类型,但看不到端口
showinterfacesprivate-vlanmapping
showvlanprivate-vlantype查看vlan模式类型
showinterfaceinterfaceswitchport查看所有接口的switchport信息
在3550等以下型号的设备上使用switchportprotected实现类似功能,3650以上也支持
Sw1(config-if)#(no)switchportprotected端口开启
注:
如果流量通过一个被保护的接口发出,则这个流量无法通过另一个被保护的接口进入,两个受保护的端口之间只能通过三层设备通讯
•MLS•
CEF
SW1(config)#iprouting要开启CEF,首先要开启路由功能
SW1(config)#ipcef[distributed]交换机开启CEF要加参数(基于分布式的快速转发)
SW1(config-if)#noiprouter-cachecef在接口下关闭CEF
sw1(config-if)#ipload-sharingper-packet打开基于包的负载均衡,默认情况下cef是基于流的
showipcef查看摘要
showipcefdetail查看详细
showcefinterfaces0
showadjacency[detail]
NTP(NetworkTimeProtocol)
Sw1(config)#clocktimezoneGMT+8 (设置时区)
Sw1#clockset14:
16:
3810Nov2013
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Cisco 命令 整理