Cisco交换机命令清单

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 num

2950(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 ip

2950#show interface vlan n

设置以太网的链路模式

1900(config)#interface type-module/port

1900(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-table

switch #clear  mac-address-table

配置端口安全性

 

1900(config-if)# port secure

1900(config-if)# port secure max-mac-count count

1900(config-if)# port security  violation protect/restrict/shutdown

1900(config-if)# port security mac-address mac-address

2950 (config-if)# switchport  mode  access

2950 (config-if)# switchport  port-security

2950 (config-if)# switchport port-security  [max-mac-count count]

定义该端口在MAC地址表中对应MAC地址的最多条数, 可以定义1 到132, 缺省为132

查看Catalyst 1900/2950端口安全性

1900#show mac-address-table security

2950#show mac-address-table secure

清除NVRAM

1900#delete nvram

2950#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 database

2950(vlan)#vtp [ server | client | transparent ]

2950(vlan)#vtp domain domain-name

2950(vlan)#vtp password password

2950(vlan)#vtp pruning<默认启用enable>

2950(vlan)#snmp-server enable traps vtp

2950(vlan)#exit

确认Catalyst 2950/1900的VTP配置

 

1900#show vtp

2950#show vtp status

确认生成树

 

1900#show spantree [vlan#]

2950#show spanning-tree vlan [vlan#]

关掉生成树协议

1900(config)#no spantree number      注:每个VLAN都有自己独立的生成树.

创建并将端口加入一个VLAN

1900(config)# vlan vlan#  [name vlan-name]

1900(config)#interface type-module/port

1900(config-if)#vlan-membership {static {vlan#} | dynamic}

2950# vlan database
2950 (vlan)# vlan vlan-num name name
2950 (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-membership

2950#show vlan brief

2950#show interfaces interface switchport

删除vlan

1900(config)#no vlan   vlan-id

2950(vlan)# no vlan   vlan-id

当删除一个VLAN时,原来属于此VLAN的端口将处于非激活的状态,直到将其分配给某一VLAN。所以建议先删除vlan下的端口再删除vlan.

相同类别端口组配置

所有在同一组的端口必须是相同类别的。interface range 命令只能配置已经存在的interface vlan

Switch# configure terminal

Switch(config)# interface range type-mode/port

Switch(config-if-range)# no shutdown

将端口12—15加入到VLAN 3中

switch(config)#interface range fa0/12  —15

switch(config-if-range)#switchport mode access

switch(config-if-range)#switchport access VLAN 3

 

使用逗号来配置不同类型端口的组:

Switch# configure terminal

Switch(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-address

Switch#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 2

switch(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-list

2621(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
 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值