1、交换机五大基本工作模式及命令
第一次配置网络设备需要使用console线
在pc需要使用“超级终端”或其他软件
(1)用户模式:switch>
可以查看交换机的基本简单信息,且不能做任何修改配置。
(2)特权模式:switch> enable ==> switch#
缩写:en
可以查看所有配置,且不能修改配置,但可以做测试、保存、初始化等操作。
(3)全局配置模式:switch#configure terminal ==> switch(config)#
缩写:conf
默认不能查看配置,可以修改配置,且全局生效。
(4)接口配置模式:switch(config)# interface f0/1 ==> switch(config-if)#
缩写:int f0/1
默认不能查看配置,可以丢该设置,且对该端口生效。
exit;退出一级
end:直接退到特权模式
(5)console口/线/控制台模式:switch(config)# line console 0 ==> switch(config-line)#
2、配置主机名
cong t
hostname 设备名
3、设置用户密码
line co 0
password 密码
login(开启登录验证)
exit
4、快捷键
Ctrl+u:快速删除光标所有字符
Ctrl +a:快速定位光标到行首
Ctrl+e;快速定位光标到行尾
5、保存配置
en
copy running-config startup-config
或
write
6、交换机开机动作
先去硬盘中查找startup-config是否存在,如果不存在则创建新的running-config文件,若存在则复制文件到内存中,并更名为running-config。
7、查看running-config配置
en
show running-config
8、重启设备
en
reload
9、配置特权密码
cong t
enable password 密码(明文)
enable secret 密码(密文)
10、恢复出厂值
erase startup-config
11、查看MAC地址表
show mac-address-table
12、查看接口状态列表
show ip int brief
sh ip int b
13、手工关闭接口
int f0/x
shutdown
exit
14、手工开启接口
int f0/x
no shutdown
exit
15、do的用法
其他模式加do空格可以强制使用特权模式的命令
16、删除配置
(1)在哪配置的在哪删除
(2)命令前加空格
(3)原命令中有参数,并且参数具有唯一性,则删除是不需要加参数。
如:
conf t
hostname sw1
conf t
no hostname
17、开启远程控制
conf t
line vty 0 4
transport input Telnet/ssh/none/all
password 密码
login
exit
conf t
hostname r1
ip domain-name r1.qf.com
crypto key generate rsa (生成密钥对)
line vty 0 4
transport input Telnet/ssh/none/all
login local
exit
username xx password 123.com
18、为交换机配置管理IP
conf t
int vlan 1
ip add 10.1.1.253 255.255.255.0
19、为交换机配置默认网关
目的:可跨网段管理
conf t
ip default-gateway 10.1.1.254
20、关闭自动解析功能
conf t
no ip domain-lookup
本文详细介绍了交换机的五大工作模式及其命令,包括用户模式、特权模式、全局配置模式、接口配置模式和console控制台模式。内容涵盖配置主机名、设置用户密码、保存配置、查看MAC地址表、接口状态管理以及远程控制和管理IP的配置等关键操作,是网络管理员必备的交换机操作指南。
3319

被折叠的 条评论
为什么被折叠?



