交换机的基本原理配置(一)

1、配置主机名
在全局模式下输入hostname 名字 然后回车即可立马生效(在生产环境交换机必须有自己唯一的名字)
 Switch(config)#hostname jsh-sw1
 jsh-sw1(config)#
2、显示系统OS名称及版本信息
特权模式下,输入命令 show version
 Switch#show version
 Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)
 Copyright (c) 1986-2005 by Cisco Systems, Inc.
 Compiled Wed 12-Oct-05 22:05 by pt_team

 ROM: C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4)

 System returned to ROM by power-on

 Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.
 24 FastEthernet/IEEE 802.3 interface(s)      ——说明有24个百兆接口
 2 Gigabit Ethernet/IEEE 802.3 interface(s)   ——说明有 2个千兆接口

 63488K bytes of flash-simulated non-volatile configuration memory.
 <u>Base ethernet MAC Address    : 0040.0BE5.7EEE</u>    (MAC地址)
 Motherboard assembly number     : 73-9832-06
 Power supply part number        : 341-0097-02
 <u>Motherboard serial number    : FOC103248MJ</u>       (主板S/N序列号,用于辨别交换机)
 Power supply serial number      : DCA102133JA
 Model revision number           : B0
 Motherboard revision number     : C0
 Model number                    : WS-C2960-24TT
 System serial number            : FOC1033Z1EY
 --More--
3、查看交换机的MAC地址表
特权模式下输入命令 show mac-address-table 显示静态MAC地址(手工方式添加,无老化时间,会一直存在)
特权模式下输入命令 show mac-address-table dynamic 显示动态MAC地址(通过arp学习到的,有老化时间)

image

 Switch3#show mac-address-table 
      Mac Address Table
 -------------------------------------------

 Vlan    Mac Address       Type        Ports
 ----    -----------       --------    -----

 1    0000.0c0c.7a5a    DYNAMIC     Fa0/24 (其中0000.0c0c.7a5a是MAC地址;类型DYNAMIC表示是动态学习到的;Fa0/24表示该MAC地址对应交换机的端口号)
 1    0001.9734.c756    DYNAMIC     Fa0/24
 1    0001.c981.6818    DYNAMIC     Fa0/24
 1    0004.9a65.ed19    DYNAMIC     Fa0/1
 1    00e0.f99e.4637    DYNAMIC     Fa0/2
4、指定接口的双工模式
在接口模式下,输入命令duplex full 则设置为:全双工
在接口模式下,输入命令duplex half 则设置为:办双工
在接口模式下,输入命令duplex auto 则设置为:自动(默认为此模式)
5、指定接口的速率
在接口模式下,输入命令 speed 10 则设置为10M
在接口模式下,输入命令 speed 100 则设置为100M
在接口模式下,输入命令 speed 1000 则设置为1000M
在接口模式下,输入命令 speed auto 则设置为自动(默认为此速度)
 Switch(config-if)#speed ?
   10    Force 10 Mbps operation
   100   Force 100 Mbps operation
   auto  Enable AUTO speed configuration
 Switch(config-if)#speed auto 
 Switch(config-if)#
6、查看接口的双工模式和速率
在特权模式,使用命令 show interface 端口
Switch#show interfaces fa 0/24
FastEthernet 0/24 is up, line protocol is up (connected)
Hardware is Lance, address is 0005.5eb1.7918 (bia 0005.5eb1.7918)
BW 100000 Kbit, DLY 1000 usec, reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)  
Full-duplex, 100Mb/s     ——双工模式及速率
7、设备配置的辅助命令
7.1 命令行界面空闲一段时间,重回初始界面的问题
在全局模式下,输入命令 line con 0 然后回车换行,输入命令exec-timeout 0 0 即可设置为永不超时
jingshihai-01>
jingshihai-01>en
jingshihai-01#config ter
jingshihai-01#config terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
jingshihai-01(config)#line con 0
jingshihai-01(config-line)#exec-t
jingshihai-01(config-line)#exec-timeout 0 0
jingshihai-01(config-line)#
7.2 控制台消息打算输入的处理
当执行完一个命令,需要输入另一个命令时,为了保持光标不被返回的消息打扰,可以配置如下命令:在全局模式下,输入命令 line con 0 然后回车换行,输入命令logging synchronous(简写 logg syn)
jingshihai-01(config)#line con 0
jingshihai-01(config-line)#logging synchronous
7.3 禁用DNS查询
jingshihai-01#asdadffffffffffffffffffff
Translating "asdadffffffffffffffffffff"...domain server (255.255.255.255)
当遇到如上提示时,一般需要等待很久,此时就要要禁用DNS查询。
在全局模式下,输入命令 no ip domain-lookup(简写no ip domain-lo)
jingshihai-01#asdadffffffffffffffffffff
Translating "asdadffffffffffffffffffff"...domain server (255.255.255.255)
% Unknown command or computer name, or unable to find computer address   (等待很久才会显示该信息)

jingshihai-01#config terminal
Enter configuration commands, one per line.  End with CNTL/Z.
jingshihai-01(config)#no ip domain-lookup
jingshihai-01(config)#asdadffffffffffffffffffff
% Invalid input detected at '^' marker.    (直接显示该信息)

jingshihai-01(config)#
8、查看交换机的配置
在特权模式下输入命令 show running-config(可以用来检查配置)
jingshihai-01#
jingshihai-01#show running-config 
Building configuration...

Current configuration : 1157 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname jingshihai-01  (历史输入的命令,可以用来检查输入的是否正确)
!
!
!
jingshihai-01#
9、设置进入特权模式的密码(明文)
在全局模式下输入命令 enable password 密码
jingshihai-01#config terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
jingshihai-01(config)#enable password 123456
jingshihai-01(config)#end
jingshihai-01#
jingshihai-01#show running-config 
Building configuration...

Current configuration : 1157 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname jingshihai-01
!
enable password 123456
!
!
jingshihai-01#exit
jingshihai-01>enable
Password: 
jingshihai-01#
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值