泰国签证担保信:cisco交換機配置清除、啟動及基本配置

来源:百度文库 编辑:中财网 时间:2024/04/24 14:00:02
cisco交換機配置清除、啟動及基本配置 2009年07月14日 星期二 上午 11:59

CISCO交换机基本配置

     switch>ena       進入特權模式
     switch#erase nvram     全部清除交换机的所有配置
     switch#reload         重新启动交换机(初始提示符为switch> )
------------------------------------------------------------------------------------
CISCO交换机基本配置:Console端口连接
用户模式hostname> ;
特权模式hostname(config)# ;
全局配置模式hostname(config-if)# ;

交换机口令设置:
switch>enable ;进入特权模式
switch#config;进入全局配置模式
switch(config)#hostname csico ;设置交换机的主机名
switch(config)#enable secret csico1 ;设置特权加密口令
switch(config)#enable password csico8 ;设置特权非密口令
switch(config)#line console 0 ;进入控制台口
switch(config-line)#line vty 0 4 ;进入虚拟终端
switch(config-line)#login ;虚拟终端允许登录
switch(config-line)#password csico6 ;设置虚拟终端登录口令csico6
switch#write   保存配置設置
switch#copy running-config startup-config     保存配置設置,與write一樣
switch#exit ;返回命令
配置终端过一会时间就会由全局配置模式自动改为用户模式,将超时设置为永不超时
switch#conf t
switch(config)#line con 0
switch(config-line)#exec-timeout 0
---------------------------------------------------------------------------------
交换机显示命令:
switch#write ;保存配置信息
switch#show vtp ;查看vtp配置信息
switch#show run ;查看当前配置信息
switch#show vlan ;查看vlan配置信息
switch#show vlan name vlan2
switch#show interface ;查看端口信息
switch#show int f0/0 ;查看指定端口信息
switch#show int f0/0 status;查看指定端口状态
switch#show interface status
switch#dir flash: ;查看闪存
switch#show running-config
switch(config)#do show running-config 显示存储在内存中的当前正确配置文件。
show startup-configuration:显示存储在非易失性存储器(NVRAM)的配置文件。
show users:显示所有连接到路由器的用户。
show hosts:显示主机名和地址信息。
switch(config)#do show interface
switch(config-if)#do show int f0/21
switch#show arp
switch#show mac-address-table
------------------------------------------------------------------------------
   2960交换机上配置,配置IP及網關
     switch#conf t
     switch(config)#interface vlan1     进入vlan 1特殊接口配置模式
     switch(config-if)#ip address 192.168.1.1 255.255.255.0     设置交换机的管理IP地址
     switch(config)#ip default-gateway 192.168.1.1     设置交换机的网关地址
     switch(config)#ip domain-name pctc.com.cn     设置交换机所连域的域名
     switch(config)#no ip domain-name     
     switch#ip name-server 218.87.18.230     设置交换机所连域的域名服务器IP
     switch#show int vlan 1     查看交换机的VLAN 1特殊接口配置信息
     switch#show run     查看交换机的当前运行配置等全部信息
--------------------------------------------------------------------------------
交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:
switch(config)#vlan 2
switch#vlan database ;进入VLAN设置
switch(vlan)#vlan 2 ;建VLAN 2
switch(vlan)#vlan 3 name vlan3 ;建VLAN 3并命名为vlan3
switch(vlan)#no vlan 2 ;删vlan 2
switch(config)#int f0/1 ;进入端口1
switch(config)#speed ?   查看speed命令的子命令
switch(config)#speed 100   设置该端口速率为100mb/s (10/auto)
switch(config-if)#do show int f0/21 顯示21口配置信息
switch(config-if)#shut ;shutdown 關閉當前端口
switch(config-if)#no shut ;no shutdown 開啟當前端口
switch(config)#duplex ?    查看duplex的子命令
switch(config)#duplex full 设置该端口为全双工(auto/half)
switch(config)#description TO_PC1 这是该端口描述为TO_PC1
switch(config)#interface f0/21
switch(config-if)#switchport access vlan 2 ;当前端口加入vlan 2
switch(config-if)#switchport mode trunk ;设置为trunk模式(access模式)
switch(config-if)#switchport trunk allowed vlan 1,2 ;设置允许的vlan
switch(config-if)#switchport trunk encap dot1q ;设置vlan 中继
switch(config)#vtp domain vtpserver   ;设置vtp域名相同
switch(config)#vtp password   ;设置发vtp密码
switch(config)#vtp server ;设置vtp服务器模式
switch(config)#vtp client ;设置vtp客户机模式
---------------------------------------------------------------------------------------
交换机设置IP地址,默认网关,域名,域名服务器,配置和查看MAC地址表:
switch(config)#interface vlan 1 ;进入vlan 1
switch(config-if)#ip address 192.168.1.1 255.255.255.0   ;设置IP地址
switch(config)#ip default-gateway 192.168.1.6 ;设置默认网关
switch(config)#ip domain-name cisco.com 设置域名
switch(config)#ip name-server 192.168.1.18 设置域名服务器
switch(config)#mac-address-table?   查看mac-address-table的子命令
switch(config)#mac-address-table aging-time 100    设置超时时间为100ms
switch(config)#mac-address-table permanent 0000.0c01.bbcc f0/3   加入永久地址在f0/3端口
switch(config)#mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 加入静态地址目标端口f0/6源端口f0/7
switch(config)#end
switch#show mac-address-table 查看整个MAC地址表
switch#clear mac-address-table restricted static 清除限制性静态地址
-----------------------------------------------------------------------------------
交换机端口加入vlan
将多个端口加入到VLAN2
switch(config)#interface range fa 0/17-24
switch(config-if-range)#switchport access vlan 2
单个端口加入VLAN
switch(config)#interface f0/1
switch(config-if-range)#switchport access vlan 2
--------------------------------------------------------------------------------
交换机的端口和MAC地址表的设置
    2960交换机配置端口属性
     switch#conf t
     switch#interface ethernet 0/1
     进入第1个端口
     switch#description switch-e0/1-pc1
     给端口写入注释信息
     switch#duplex auto/full/full-flow-control/half
     设置端口的工作模式
     switch#port secure
     启用端口安全性
     switch#port secure max-mac-count 1
     设置该端口允许对应的MAC地址数(默认132个)
     switch#sh mac-address-table security
     查看端口安全性

    2912交换机配置端口属性

     switch#conf t
     进入全局配置模式
     switch#interface fastethernet 0/1
     进入第1个端口
     switch#description switch-f0/1-pc1
     给端口写入注释信息
     switch#duplex auto/full/half
     设置端口的工作模式
     switch#port security
     启用端口安全性
     switch#port security max-mac-count 1
     设置该端口允许对应的MAC地址数(默认132个)
     switch#end
     返回特权模式
     switch#sh port security
     查看端口安全性

    配置和查看MAC地址表
    1924交换机配置MAC地址表

     switch#mac-address-table aging-time 600
     设置动态地址超时时间
     switch#mac-address-table permanent 0000.0cdd.5a4d e0/3
     定义永久MAC地址(绑定MAC地址)
     switch#mac-address-table restricted static 0000.0cdd.aaed e0/6 e0/7
     定义受限MAC地址
     switch#address-violation disable/ignore/suspend
     定义地址安全违规
     switch#show mac-address-table
     查看上述配置
     switch#clear mac-addr restric static
     清除受限MAC地址表项

    2912交换机配置MAC地址表

     switch#mac-address-table aging-time 700
     设置动态地址超时时间
     switch#mac-address-table static 0000.0cdd.5a4d e0/3
     定义永久MAC地址(绑定MAC地址)
     switch#mac-address-table secure 00d0.f80d.3333 f0/3 vlan 1
     定义受限MAC地址
     switch#port security action shutdown/trap
     定义地址安全违规
     switch#show port security
     查看上述配置

   配置VTP、VLAN、VLAN Trunk和STP
    配置VTP

     switch#conf t
     switch#vtp server
     定义VTP的工作模式
     switch#vtp domain cisco
     定义VTP的域名
     switch#trunk on
     启用干道
     switch#vtp domain cisco
     加入VTP域
     switch#vtp client
     定义VTP的工作模式
     switch#trunk on
     启用干道
     switch#show trunk b
     switch#show trunk b allowed-vlans
     查看干道信息

    配置VLAN

     switch#vlan 10 dept1
     switch#vlan 20 dept2
     switch#vlan 30 dept3
     switch#vlan 40 dept4
     定义所需VLAN
     switch#show vlan
     查看VLAN信息
     switch#show vlan
     switch#show vtp
     查看VTP的信息
     switch#int e0/1
     switch#vlan-membership static 10
     switch#int e0/2
     switch#vlan-membership static 20
     switch#int e0/3
     switch#vlan-membership static 30
     switch#int e0/4
     switch#vlan-membership static 40
     把接口划入各自VLAN

    配置spanning tree

     switch#spantree 1
     启用生成树协议
     switch#sh spantree 1
     查看生成树信息
     switch#no spantree 1
     关闭生成树协议
     switch#sh spantree 1
     查看生成树信息

交换机上屏蔽个别MAC地址方法

configure terminal
interface gigabitEthernet 0/20
switchport
sw mode acc
sw port-sec
sw port-sec mac-add [macaddress]
sw port-sec max 1
sw port-sec violation restrict

部分命令缩写 要看详细安tab