交换机的基本命令
要检查交换机的各种连线是否连接正确,特别是有些不支持热插拔的接口
交换机在启动时,表示各种状态的指示灯会频繁地闪烁,这表明交换机在进行开机自检。
当自检完成后,交换机的各接口指示灯会依据接口是否被使用而或亮或灭。
指示灯是绿色的表示该接口或模块正常工作,如果各部分工作正常,交换机的系统灯会成为绿色。
这时,整个交换机可以正常工作。如果有接口或者模块的硬件有问题,则该处指示灯会是橘黄色。
当发生严重的故障时指示灯会成为红色,同时系统灯也是红色的。
交换机启动完成后,我们可以进入用户模式,在用户模式中输入enable命令可以进入特权模式。
如果我们在交换机中配置了密码,那么在进入特权模式时要进行密码验证。
在特权模式中,输入disable命令可以退出特权模式
show version命令
通过该命令可以看到交换机的型号、软件版本、设备到目前为止的持续工作时间、交换机的MAC地址,以及设备的接口类型和数量等信息
Switch>show version
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba
Image text-base: 0x80010000, data-base: 0x80562000
ROM: Bootstrap program is is C2950 boot loader
Switch uptime is 21 seconds
System returned to ROM by power-on
show running-config命令
可以看到我们在交换机上所做的所有配置
show interface命令
可以观察交换机的接口的状态
hostname命令
Switch#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#
Switch(config)#
Switch(config)#hostname host1
host1(config)#
host1(config)#
host1(config)#exit
对交换机的接口进行配置,必须从全局模式进入到接口模式中
host1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
host1(config)#inter
host1(config)#interface e0/1
host1(config)#
host1(config)#
交换机查看ip
ip interface brief
交换机基本配置
Switch> enable Switch# configure terminal Switch(config)# hostname S1 S1(config)# enable secret class S1(config)# line console 0 S1(config-line)# password cisco S1(config-line)# login S1(config-line)# line vty 0 15 S1(config-line)# password cisco S1(config-line)# login S1(config-line)# exit S1(config)# service password-encryption S1(config)# banner motd S1(config)# interface vlan1 为一个特殊的虚拟接口 vlan1 配置ip地址 可以远程访问这个虚拟接口的ip地址实现远程登录管理交换机的目的 S1(config)# ip default-gateway 192.168.1.254 在全局模式下为交换机配置默认网关,使交换机在被远程登录的时候可以把信息传递到位于远程的终端上 S1(config-if)# ip address 192.168.10.50 255.255.255.0 配置ip S1(config-if)# no shutdown 激活 这一步很重要 S1(config-if)# end 退出状态 S1# copy running-config startup-config
exit与end命令的区别在于:exit命令是一级一级地退出,end命令则是直接退到特权模式
配置路由器接口
R1# conf t R1(config) # interface gigabitethernet 0/0 R1(config-if) # ip address 192.168.10.1 255.255.255.0 R1(config-if) # no shutdown R1(config-if) # exit R1#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK]
S1配置下默认网关
interface vlan1
ip 192.168.10.2 255.255.2555.0
ip default-gateway 192.168.10.1
no shutdown
end
copy running-config statup-config