1、思科设备命令行命令
- 设备支持命令行
- 去查看设备上的接口,是否由console
- 需要console线
- 需要console线
- 需要超级终端软件进行连接
- putty
- secret CRT
- xshell
2、命令行基础
- 思科设备上的命令行模式
- 用户模式:查看统计信息(一般情况下用的非常少)用“>”表示
- 用户模式切换到特权模式
- 用户模式:查看统计信息(一般情况下用的非常少)用“>”表示
enable
en
- 特权模式:查看并修改设备得配置(一般情况下都是去查看居多),用“#“表示
- 特权模式切换到全局模式
configure terminal
conf t #命令可以简写
- 全局模式:针对设备得整体配置参数
- 全局模式切换到接口模式
interface fasteternet 0/1
- 接口模式:针对设备得接口修改配置参数,用“(config)#”表示
- 进入对应模式,只能一级一级进入
- 返回对应模式,一级一级返回使用“exit”,如果想要直接返回特权模式,可以使用“end
- 当命令输入错误的时候会进入
switch>dfds
Translating "dfds"...domain server (255.255.255.255)
#快速中止按ctrl+shift+6
#永久不进行域名解析
Switch(config)#no ip domain-lookup #注意模式
3、常见配置
- 给交换机配置一个主机名
Switch#en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW1
SW1(config)# SW1#
- 交换机里面维护了一张MAC地址表,如何进行查看
SW1#conf t
SW1(config)#int f0/1
SW1(config-if)#duplex half
- 交换机的接口速率
SW1#conf t
SW1(config)#int f0/2
SW1(config-if)#speed 10
SW1#show int f0/2
- 配置console口密码
SW1#conf t
SW1(config)#line console 0
SW1(config-line)#password sanghe
SW1(config-line)#login
2、通过远程管理方式连接交换机(telent ssh)
1、telnet 是应用层协议 基于传输层TCP 默认端口号:23 采用的是明文密码方式,不是安全,一般用于内网管理
2、ssh 是应用层协议 基于传输层TCP 默认端口号:22 采用的是密文密码方式,相对比较安全,经常用于跨越互联网管理,也常用于远程管理Linux操作系统
3、思路
telnet
- 既然是通过网络的方式进行管理设备,设备就必须配置IP地址,由于交换机上的接口都是交换接口,是不允许配置IP的地址,直接为交换机的虚接口配置IP 地址,默认情况下交换机的默认虚接口就是vlan1接口
SW1(config)#int vlan 1
SW1(config-if)#ip address 192.168.100.100 255.255.255.0
SW1(config-if)#no shutdown
- 配置设备的连接终端
Switch#conf t
Switch(config-line)#line vty 0 4
Switch(config-line)#password 123456
Switch(config-line)#login //表示直接使用密码登录
- 创建连接用户名密码,配置设备的连接终端并应用
Switch#conf t
Switch(config)#username zahngsan password 123
Switch(config)#line vty 0 4
Switch(config-line)#login local //表示直接使用用户名密码登录
ssh
Switch(config)#hostname SW1
SW1(config)#int vlan1
SW1(config-if)#ip address 192.168.100.100 255.255.255.0
SW1(config-if)#no shutdown
SW1(config)#ip domain-name cc.com
SW1(config)#crypto key generate rsa
SW1(config)#ip ssh time-out 120
SW1(config)#ip ssh authentication-retries 5
SW1(config)#username lisi password cc
SW1(config)#line vty 0 4 SW1(config-line)#login local
4、设置特权密码
Switch(config)#enable password 123
Switch(config)#enable secret 456
Switch#show running-config