当前位置:文档之家› 交换机常用配置命令

交换机常用配置命令

交换机常用配置命令
1.在全局配置模式下进入接口模式
Switch(config)# Interface fastethernet 0/0
2.在line接口模式下设置用户模式之前设置密码Switch(config) #Line console 0
Switch(config-line)# password
Switch(config-line)# login
3.在全局模式下为交换机配置主机名
Switch(config)# hostname XXXX
4.在特权模式下查看交换机设置
Switch# show running-config
5.在特权模式下设置使能口令
Switch# enable password XXXXX
6.在特权模式下加密保存使能口令
Switch# enable secret XXXXX
7.在全局模式下配置交换机网关
Switch(config)# ip default-gateway 192.168.1.1 8.在特权模式下查看交换机的MAC地址Switch# show mac-address table
9.在特权模式下查看交换机直连设备
Switch# show cdp neighbors
10.在特权模式下查看所有入口项细节
Switch# show cdp entry *
11.在特权模式下查看接口的详细cdp配置信息Switch# show cdp interface f0/0
12.在特权模式下保存交换机配置信息
Switch# copy running-config startup-config 或Switch# write
13.在特权模式下删除交换机配置信息
Switch# erase startup
Switch# reload
14.Cisco 2950交换机密码恢复
1)拔下交换机电源线
2)用手按在交换机的MODE按键上,插上电源线
3)看到控制台出现完成界面,松开MODE按键
4)输入flash_init
5)查看flash 中的文件
6)把config.text 改为config.old
7)重启交换机输入:boot
8)进入特权模式查看flash 输入:dir flash
9)把文件config.old 改为config.text
10)把config.text 复制为系统的running-config
11)输入:copy flash:config.text running-confi g
VLAN常用命令
1.在特权模式下创建VLAN
Switch# vlan database
Switch# vlan 10 name caiwu
2.在特权模式下查看vlan或者某个vlan信息
Switch# show vlan 或show vlan ID
3.在接口模式下在vlan中添加端口
Switch(config)# interface fastethernet 0/0
Switch(config-if)# switchport access vlan 10 (删除前加no)
4.多个端口设置为VLAN
Switch(config)# interface range fastethernet 0/1 – 10
Switch(config-if-range)# switchport access vlan 10 (把端口1-10都设为vlan10) Trunk常用命令
5.在全局模式下把f0/0端口设置为Trunk
Switch(config)# interface fastethernet 0/0
Switch(config-if)# switchport mode trunk、
6.在Trunk中添加/删除VLAN
Switch(config)#interface fastethernet 0/0
Switch(config-if)# switchport allowed vlan remove 10 (删除vlan10)Switch(config-if)# switchport allowed vlan add 10 (添加vlan10)
路由器的常用命令(与交换机基本相同)
Router(config-subif)# 子接口模式
Router(config-router)# 路由模式
1.在全局模式下配置静态路由
Router(config)# ip route 目的网络地址+ 目的地址的子网掩码+ 到达目的网络下一跳接口地址
2.在全局模式下配置默认路由
Router(config)# ip route 0.0.0.0 0.0.0.0 下一个路由器的接口地址
3.在接口模式下激活端口
Router(config-if)# no shutdown
4.在特权模式下查看路由器信息
Router# show ip route
5.在全局模式下配置路由器标示信息(说明)
Router(config)# banner motd $描述信息$
6.在全局模式下对所有密码加密
Router(config)# service password-encryption
7.配置超时
Router(config)# line console 0
Router(config-line)# exec-timeout 0 0
8.显示同步
Router(config)# line console 0
Router(config-line)# logging synchronous
9.在路由器中对vlan进行封装和配置IP地址
Router(config)# interface fastethernet 0/0
Router(config-subif)# encapsolution dot1q vlan ID Router(config-subif)# ip address 192.168.1.1 255.255.255.0 10.配置禁用DNS
Router(config)# no ip domain-lookup
11.查看路由表版本信息
Router# show version
12.查看路由当前时间
Router# show clock
ARP的常用命令
在DOS中显示ARP缓存表
C:\ arp-a
不停Ping下去
C:\ping-t 192.168.1.1
改变Ping包大小为1000字节
C:\ ping 192.168.1.1 –l 1000
删除ARP缓存表
C:\ arp –d。

相关主题