大家好,这里是G-LAB IT实验室。
今天我们来了解一下思科设备命令。
一、思科交换机巡检命令
show interface stats #查看交换机所有接口当前接口流量。
show running-config #查看当前设备配置。
show version #查看IOS版本信息及设备正常运行时间
show clock #查看设备时钟信息
show vtp status #查看交换机vtp配置模式
show vtp password #查看交换机vtp配置口令
show env all #查看设备温度,电源和风扇运转参数及是否报警
show inventory #调取设备内部板卡出厂模块型号及序列号
show spanning-tree root #查看交换机生成树根位置
show cdp neighbors #查看邻接cisco设备基本信息
show cdp neighbors detail #查看邻接cisco设备详细信息
show interface status #查看交换机接口状态是否存在error disable接口disable接口
show interface summary #查看交换机所有接口当前接口流量
show interface |ierrors|FastEthernet|GigabitEthernet #查看接口是否存在大量input或output errors包错误
show processes cpu #查看设备cpu负载
show processes mem #查看设备mem负载
show access-list #查看访问控制列表配置及匹配数据包数量
show logging #查看本机内部日志记录情况
show ip route #查看路由表show firewall #检查防火墙的工作模式
show conn count #检查防火墙并发数
show xlate count #检查防火墙nat工作状态
二、思科交换机基础配置命令
进入特权模式
switch>enable
switch#
进入全局配置模式
switch>enable
switch#configure terminal
switch(conf)#
交换机命名
switch>enable
switch# configure terminal
switch(conf)# hostname hxsw-001hxsw-001(conf)#
配置使能口令
switch>enable
switch#configure terminal
switch(conf)# hostname hxsw-001hxsw-001(conf)# enable password cisco
配置使能密码
switch>enable
switch#configure terminal
switch(conf)#hostname hxsw-001hxsw-001(conf)# enble secret ciscolab
创建多个VLAN
switch>enable #进入特权模式
switch#vlan data #进入VLAN配置模式
switch(vlan)#vlan 10 name IT #划分VLAN 10,名称为IT
switch(vlan)#vlan 20 name HR #划分VLAN20,名称为HR
switch(vlan)#vlan 30 name FIN #划分VLAN30,名称为FIN
switch(vlan)#vlan 40 name LOG #划分VLAN40,名称为LOG
switch(vlan)#exit
设置VLAN1
switch>enable
switch#configure terminal
switch(conf)#hostname
hxsw-001
hxsw-001(conf)# interface vlan 1
hxsw-001(conf-if)#ip address 192.168.1.1 255.255.255.0 #配置交换机端口IP和子网掩码
hxsw-001(conf-if)#no shut
hxsw-001(conf-if)#exit
hxsw-001(conf)#ip default-gateway 192.168.254 #设置网关地址
进入交换机某一个端口
switch>enable
switch#configure terminal
switch(conf)#hostname
hxsw-001
hxsw-001(conf)#interface fastehernet 0/1
hxsw-001(conf-if)#
查看命令
switch>enableswitch#
show version #查看系统中的所有版本信息
show interface vlan 1 #查看交换机有关vlan1的配置信息
show running-configure #查看交换机当前起作用的配置信息
show interface fastethernet 0/1 #查看交换机1接口具体配置和统计信息
show mac-address-table #查看MAC地址表
show mac-address-table aging-time #查看MAC地址表自动老化时间
交换机恢复出厂命令
switch>enable
switch#erase startup-configure
switch#reload
双工模式设置
switch> enable
switch#configure terminal
switch(conf)#hostname
hxsw-001
hxsw-001(conf)# interface fastehernet 0/17
hxsw-001(conf-if)#duplex full/half/auto
#有 full、half、auto三个选项
cdp相关命令
switch> enable
switch# show cdp #查看设备的cdp全局配置信息
show cdp interface fastethernet 0/1
show cdp traffic #查看有关cdp包的统计信息
show cdp nerghbors #列出与设备相连的cisco设备
交换机远程登录设置
switch>enable
switch#configure terminal
switch(conf)#hostname hxsw-001
hxsw-001(conf)#enable password cisco
hxsw-001(conf)#interface fastethernet 0/1
hxsw-001(conf-if)#ip address 192.168.1.1 255.255.255.0
hxsw-001(conf-it)#no shut
hxsw-001(conf-if)#exit
hxsw-001(conf)line vty 0 4 #设置0-4个用户可以telnet远程登录
hxsw-001(conf-line)#password edge #以edge为远程登录的用户密码
主机设置:
IP 192.168.1.2 #主机的IP必须和交换机端口的地址在同一个网络段
metmask 255.255.255.0
gate-way 192.168.1.1 #网关地址是交换机端口地址
运行:
telent 192.168.1.1进入telnet远程登录界面
password:edge
hxsw-001>en
password:cisco
hxsw-001#
有计划学习考证。可关注 工 仲 好:IT运维大本营,留言