正文

Cisco交换机命令清单2006-10-23 23:09:00

【评论】 【打印】 【字体: 】 本文链接:http://blog.pfan.cn/sovf/19658.html

分享到:

Cisco交换机命令清单2006.3.5设置主机名: switch(config)# hostname  hostname设置登录口令 switch(config)# enable  password/secret  password配置交换机IP地址1900(config)#ip address {ip_address} {mask} 2950(config)#interface vlan num2950(config-if)#ip address {ip_address} {mask}配置交换机缺省网关1900(config)# ip default-gateway {ip address}2950(config)# ip default-gateway {ip address}设置端口速度: switch(config-if)# speed  {10|100|auto}端口描述switch(config-if)# description description-string显示交换机IP地址1900#show ip2950#show interface vlan n设置以太网的链路模式1900(config)#interface type-module/port1900(config-if)#duplex {auto|full|full-flow-control|half}2950(config)#interface  type-module/port 2950(config-if)#duplex {auto | full | half}设置永久MAC地址1900 (config)#mac-address-table permanent {mac-address  type   module/port}2950(config)#mac-address-table static  mac_addr {vlan vlan_id} [interface int1 [int2 ... int15]]Catalyst1900设置受限的静态MAC地址1900(config)#mac-address-table restricted static               {mac-address    type module/port     src-if-list} Catalyst 2950设置受限的静态MAC地址2950(config)#mac-address-table secure mac-addr interface [vlan vlan-id] 管理MAC地址表switch #show mac-address-tableswitch #clear  mac-address-table配置端口安全性 1900(config-if)# port secure 1900(config-if)# port secure max-mac-count count1900(config-if)# port security  violation protect/restrict/shutdown1900(config-if)# port security mac-address mac-address2950 (config-if)# switchport  mode  access 2950 (config-if)# switchport  port-security2950 (config-if)# switchport port-security  [max-mac-count count]定义该端口在MAC地址表中对应MAC地址的最多条数, 可以定义1 到132, 缺省为132查看Catalyst 1900/2950端口安全性1900#show mac-address-table security2950#show mac-address-table secure清除NVRAM1900#delete nvram2950#erase nvram 删除flash中全部vlan信息          switch#delete flash: vlan.dat创建VTP域1900(config)#vtp [server | transparent | client] [domain domain-name] [trap {enable | disable}] [password password] [pruning {enable | disable}] 2950#vlan database2950(vlan)#vtp [ server | client | transparent ]2950(vlan)#vtp domain domain-name 2950(vlan)#vtp password password2950(vlan)#vtp pruning<默认启用enable>2950(vlan)#snmp-server enable traps vtp2950(vlan)#exit确认Catalyst 2950/1900的VTP配置 1900#show vtp2950#show vtp status确认生成树 1900#show spantree [vlan#]2950#show spanning-tree vlan [vlan#]关掉生成树协议1900(config)#no spantree number      注:每个VLAN都有自己独立的生成树.创建并将端口加入一个VLAN1900(config)# vlan vlan#  [name vlan-name]1900(config)#interface type-module/port1900(config-if)#vlan-membership {static {vlan#} | dynamic}2950# vlan database 2950 (vlan)# vlan vlan-num name name2950 (vlan)# exit 2950# configure teriminal 2950 (config)# interface type module/number 2950 (config-if)# switchport mode access 2950 (config-if)# switchport access vlan vlan-num 2950 (config-if)# end 确认一个VLAN 1900#show vlan [vlan#]2950#show vlan [vlan id #]修改一个VLAN的名称switch(config)#vlan vlan# name vlan-name查看VLAN中的成员1900#show vlan-membership2950#show vlan brief2950#show interfaces interface switchport删除vlan1900(config)#no vlan   vlan-id2950(vlan)# no vlan   vlan-id当删除一个VLAN时,原来属于此VLAN的端口将处于非激活的状态,直到将其分配给某一VLAN。所以建议先删除vlan下的端口再删除vlan.相同类别端口组配置所有在同一组的端口必须是相同类别的。interface range 命令只能配置已经存在的interface vlanSwitch# configure terminalSwitch(config)# interface range type-mode/port Switch(config-if-range)# no shutdown将端口12—15加入到VLAN 3中switch(config)#interface range fa0/12  —15switch(config-if-range)#switchport mode accessswitch(config-if-range)#switchport access VLAN 3 使用逗号来配置不同类型端口的组:Switch# configure terminalSwitch(config)# interface range fa0/1 - 3, gig0/1 - 2 Switch(config-if-range)# no shutdown 设置端口汇聚将端口26—27配置成干道端口,并且绑定为一个以太网通道。1900 (config)#interface port—channel 1 (1—6) (创建通道)1900 (config-if)#interface range fa0/26 —27     (加入端口)1900 (config-if-range)#channel—range 1 mode on  (应用通道)查看通道    switch#show interface port—channel number(1—6)对交换机设置域名.Switch(config)#ip domain-name  domain_name指向名称服务器Switch(config)#ip name-server dns-server-ip-addressSwitch#show ip name server        (查看名称服务器)设置老化时间,也就相当于租期Switch(config)#Mac-address-table aging-time  给FLASH文件重命扩展名Switch(config)#rename flash:config.old flash:config.text  查看VTP中继流量Switch#show vtp counters(计数器)排除VLAN2通过此中继Switch(config)#no trunk-vlan 2switch(config-if)# switchport trunk allowed vlan remove vlan-list 查看端口状态Switch#show interface fa0/24(trunk) switchprot设置vlan中继链路switch(config)# interface interface mod/port switch(config-if)# switchport mode trunk switch(config-if)# switchport trunk allowed vlan remove vlan-list switch(config-if)# switchport trunk allowed vlan add vlan-list2621(route)用中继链路来建立与VLAN的连接: route (config)# interface module/port.subinterface route (config-sub)# encapsulation[isl|dotlq] vlan-number route (config-sub)# ip address ip-address subnet-mask

阅读(3568) | 评论(1)


版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!

评论

loading...
您需要登录后才能评论,请 登录 或者 注册