基本常用命令:
router> enable 从用户模式进入特权模式
router# disable or exit 从特权模式退出到用户模式
end or ctrl+z 从各种配置模式退到特权模式
router# config terminal 从用户模式进入特权模式
router# show ip interface 查看端口的IP 配置信息
show interface fastethernet0/1 status 查看端口0/1的状态
(config-if)# no shutdown 路由器出厂默认所有端口关闭,使用此命令使它们打开
router# show sessions 查看本机上的TELNET 会话
route# disconnect 关闭所有的TELNET 会话
route# show users 查看本机上的用户
router# erase startup-config 删除NVRAM 中的配置
router# reload 重启路由器
router(config)# hostname rl 配置用户名为rl
router(config)# #banner welcome# 配置开机话语
router# show controllers serial0 查看串口0 的物理层信息,主要是查看DTE/DCE
router# show hosts 查看主机表
rl# copy running-config startup-config 保存配置
show mac-address-table 查看整个MAC地址表
rl(config-if)# ip add 10.0.0.1 255.0.0.0 进入相应的接口,配置相应的IP 地址
ip default-gateway 192.168.1.254 / 设置默认网关
show mac-address-table /查看整个Mac地址表
dulplex full/half/auto /设置该端口为全双工
show vlan brief
 
 
域名解析
rl(config)# no ip domain-lookup 关闭动态域名解析
rl(config)# ip domain-lookup 打开动态域名解析
rl(config)# ip name-server 202.106.0.20 打开动态域名解析之后便可以指定DNS 服务
rl(config)# interface serial 0 进入serial 0 的接口配置模式
rl# show cdp neighbors 查看CDP 邻居信息
ip domain-name cisco.com / 设置域名
ip name-server 200.0.0.1 / 设置域名服务器
 
 
 
修改主机名称:
在基于IOS 的交换机上设置主机名/系统名:
switch(config)# hostname hostname
在基于CLI 的交换机上设置主机名/系统名:
switch(enable) set system name name-string
rl# show ip protocol 查看配置的路由协议
 
 
显示同步
rl(config)# line console 0
rl(config-line)# login
rl(config-line)# password cisco 配置进入用户模式的密码
rl(config-line)# logging synchronous 输入同步
rl(config-line)# exec-timeout 0 0 禁止因为一段时间没有输入而跳出
 
 
在基于IOS 的交换机:
《1》:设置登录口令:
switch(config)# enable password level 1 password
《2》:设置远程访问:
switch(config)# interface vlan 1
switch(config-if)# ip address ip-address netmask
switch(config-if)# ip default-gateway ip-address
《3》:启用和浏览CDP 信息:
switch(config-if)# cdp enable
switch(config-if)# no cdp enable
《4》:查看Cisco 邻接设备的CDP 通告信息:
switch# show cdp interface [type modle/port]
switch# show cdp neighbors [type module/port] [detail]
《5》:交换机的端口描述:
switch(config-if)# description description-string
《6》:设置端口速度:
switch(config-if)# speed{10|100|auto}
《7》:设置以太网的链路模式:
switch(config-if)# duplex {auto|full|half}
《8》:配置静态VLAN:
switch# vlan database
switch(vlan)# vlan vlan-num name vla
switch(vlan)# exit
switch# configure teriminal
switch(config)# interface interface module/number
switch(config-if)# switchport mode access
switch(config-if)# switchport access vlan vlan-num
switch(config-if)# end
《9》:上配置VLAN中继线:
switch(config)# interface interface mod/port
switch(config-if)# switchport mode trunk
switch(config-if)# switchport trunk encapsulation {isl|dotlq}
switch(config-if)# switchport trunk allowed vlan remove vlan-list
switch(config-if)# switchport trunk allowed vlan add vlan-list
 
《10》:中继,trunk命令:
switchport mode trunk /设置当前端口为Trunk模式
switchport trunk allowed vlan all /设置允许从该端×××换数据的VLAN
switchport trunk vlan remote vlan2 /设置允许交换数据的Vlan(除vlan2外)
switchport mode access /设置端口为静态VLAN访问模式
switchport access vlan2 /将端口9分配给相信的VLAN2
show vlan
生成树协议配置(负载均衡)
 
 
《11》:三层交换机的配置
A:ip routing 三层交换机上启动路由
B:配置vlan的ip地址:
interface vlan vlan-id
ip address ip-address subnet-mask
no shut
C:查看FIB表
show ip cef
D:查看邻接关系表:
show adjacency detail
E:在三层交换机上配置路由接口,默认情况下三层交换机的接口是属于vlan1,要给三层交换机配置ip地址,首先得把这个接口配置为路由的子接口
no switchport
 
 
《12》:配置VTP:
A: 配置VTP管理域
switch# vlan database
switch(vlan)# vtp domain domain-name switch(enable) set vtp [domain domain-name]
或者在全局模式下:
switch(config)#vtp domian domain_name
B:配置交换机的VTP模式:
switch# vlan database
switch(vlan)# vtp domain domain-name
switch(vlan)# vtp {sever|cilent|transparent}
switch(vlan)# vtp password password password  设置vtp密码
C:配置VTP版本
switch# vlan database
switch(vlan)# vtp version 2
D:启动VTP剪裁
switch# vlan database
switch(vlan)# vtp pruning
E:查看vtp的配置信息
swit#show vtp status