五种模式
模式 | ||
---|---|---|
用户模式 | switch > | 可以查看交换机的基本简单信息,且不能做任何修改配置! |
特权模式 | switch > enable switch# | 可以查看所有配置,且不能修改配置 但可以做测试、保存、初始化等操作 |
全局配置 | switch# configure terminal switch(config)# | 默认不能查看配置! 可以修改配置,且全局生效 |
接口配置 | switch(config)# interface f0/1 switch(config-if)# | 默认不能查看配置! 可以修改配置,且对该端口生效! |
console | switch(config)# line console 0 switch(config-line)# | 默认不能查看配置! 可以修改配置,且对console口生效! |
基本命令
操作 | 命令 |
---|---|
设置设备名/主机名 | conf t hostname 主机名 |
敲错 | ctrl + shift +6 |
关闭自动解析功能 | conf t no ip domain-lookup |
快捷键 | ctrl+u :快速删除光标全所有字符 ctrl+a :快速定位光标到行首 ctrl+e :快速定位光标到行尾 |
在内存中存在一个文件 | running-config 第一次开机,系统会在内存中自动 创建一个新的干净的running-config |
交换机开机动作 | 先去硬盘中查找startup-config是否存在, 如果不存在,在内存中创建新的run 若果存在,则复制到内存中并改名为running-config |
查看所有配置–查看running-config配置文件 | show running-config sh run |
查看startup-config配置 | show startup-config |
设置用户密码 | line co 0 password 密码 login exit |
设置特权密码 | conf t enable password 密码 # 明文特权密码 enable secret 密码 # 密文特权密码 密文与明文同时配置,明文失效! |
开启加密所有密码的服务 | conf t service password-encryption |
保存配置 | en copy running-config startup-config 或 write |
重启设备 | en reload |
清空/擦除/初始化配置 | en erase startup-config |
do的用法 | 其他模式加do空格可以强制使用特权模式的命令do sh run do sh ip int b |
删除配置 | 1)在哪配置的,就在哪删! 2)命令前加no空格 3)原命令中有参数,并且参数具有唯一性,则<br/删除时不需要加参数 去掉密码no enable password |
.查看接口状态列表 | en show ip int brief sh ip int b |
手工关闭接口 | int f0/x shutdown exit |
手工开启接口 | int f0/x no shutdown exit |
查看MAC地址表 | show mac-address-table |
操作
IP
为3层端口配置IP
int f0/0
ip add 10.1.1.254 255.255.255.0
no shut
exit
远程控制
conf
line vty 0 4
transport input telent/ssh/none/all
password 密码
login
exit
或使用本地用户数据库进行身份验证
conf t
line vty 0 4
transport input telnet/ssh/none/all
login local
exit
username xxx password 123.com 使用用户验证身份
开启SSH
以上这个实验,只能使用telnet,ssh暂时不可以使用!因为ssh除了要开启以外,还需要生成一对RSA密钥!
conf t
hostname r1
ip domain-name r1.qf.com
crypto key generate rsa ##生成密钥对!
line vty 0 4
transport input ssh
login local
exit
username aaa password 123.com
username bbb password 123.com
待更新