目录
一、环境
思科安装:
https://blog.csdn.net/Stupid__Angel/article/details/126239733
二、交换机配置
用户模式:
switch>
可以查看交换机的基本简单信息,且不能做任何配置
特权模式:
switch> enable
switch#
可以查看所有配置,且不能修改配置
但可以做测试、保存、初始化等操作
全局配置模式:
switch# configure terminal
switch(config)#
默认不能查看配置!
可以修改配置,且全局生效!
接口配置模式:
switch(config)# interface f0/1
switch(config-if)#
默认不能查看配置!
可以修改配置,且对该端口生效!
console口模式:
默认不能查看配置!
可以修改配置,且对console口生效!
Line
Line con
Line console 0
exit退出一级
end直接退到特权模式
配置主机名:
conf t
hostname 设备名
设置用户密码:
line co 0
password 密码
login
exit
在内存中存在一个文件:
running-config
第一次开机,系统会在内存中自动
创建一个新的干净的running-config
保存配置:
en
copy running-config startup-config
或
write
查看running-config配置
en
show running-config
sh run
查看startup-config配置
show startup-config
重启设备:
en
reload
配置特权密码:
en
conf t
enable password 密码 (明文)
enable secret 密码 (密文)
查看MAC地址表:
show mac-address-table
查看接口状态列表:
show ip int brief
sh ip int b
手工关闭接口
int f0/x
shutdown
exit
手工开启接口
int f0/x
no shutdown
exit
do的用法
其他模式加do空格可以强制使用特权模式的命令
do sh run
删除配置
conf t
hostname sw1
conf t
no hostname
清空/擦除/初始化配置
en
erase startup-config
关闭自动解析功能:
conf t
no ip domain-lookup
添加vlan
en
conf t
vlan 10
查看vlan表
show vlan
给接口配置vlan
en
conf t
int fx/x
switchport access vlan 1
给接口配置trunk
en
conf t
int fx/x
switchport mode trunk
No ip domain-lookup