(交换机)简单的思科交换机配置命令
编程语言
2018-09-16 07:45:32
阅读次数: 0
今天有机会配置了一波思科交换机,配置思路和华为交换机区别有限。 趁此机会做个学习总结。
我是用串口线直连交换机进行配置,由于经常出现断开连接的情况,所以进入虚拟终端设置了一下超时时间。
一,起手式
提示符 |
操作 |
命令 |
switch> |
进入特权模式 |
enable |
switch# |
进入全局配置模式 |
config t |
switch# |
查看当前运行的配置 |
show run |
switch# |
保存当前配置到下次启动 |
copy run startup |
switch# |
返回命令 |
exit |
虚拟终端设置(一般远程登录用)
提示符 |
操作 |
命令 |
switch# |
进入虚拟终端 |
line vty 0 4 |
switch(config-line)# |
设置超时时间为10分0秒 |
exec-timeout 10 0 |
switch(config-line)# |
虚拟终端允许登录 |
login ##实际未配置 |
switch(config-line)# |
设置虚拟终端登录口令csico6 |
password csico6 #实际未配置 |
switch(config-line)# |
返回命令 |
exit |
二,VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中
提示符 |
操作 |
命令 |
switch# |
vlan database |
进入VLAN设置 实际未配置,可能是比较老的版本需要 |
switch(vlan)# |
vlan 2 |
建VLAN 2 |
switch(vlan)# |
no vlan 2 |
删vlan 2 |
switch(config)# |
int f0/1 |
进入端口f0/1,参照着写,比如,int g1/0/12 |
switch(config)# |
description TO_PC1 |
这是该端口描述为TO_PC1 |
switch(config-if)# |
switchport access vlan 2 |
当前端口加入vlan 2 |
switch(config-if)# |
switchport mode trunk |
设置为trunk模式(access模式) |
switch(config-if)# |
switchport trunk allowed vlan 1,2 |
设置允许通过的vlan |
switch(config-if)# |
switchport trunk allowed vlan all |
设置允许通过所有vlan |
三,设置IP地址,默认网关,配置静态MAC地址表
提示符 |
命令 |
配置 |
switch(config)# |
interface vlan 1 |
进入vlan 1 |
switch(config-if)# |
ip address 192.168.1.1 255.255.255.0 |
设置IP地址 |
switch(config-if)# |
exit |
返回命令 |
switch(config)# |
ip default-gateway 192.168.1.6 |
设置默认网关 |
switch(config)# |
ip routing |
开启交换机三层路由 |
switch(config)# |
mac-address-table? |
查看mac-address-table的子命令 |
switch(config)# |
mac-address-table aging-time 100 |
设置超时时间为100ms |
switch(config)# |
mac-address-table permanent 0000.0c01.bbcc f0/3 |
加入永久地址在f0/3端口 |
switch(config)# |
mac-address-table restricted static 0000.0c02.bbcc f0/6 f0/7 |
加入静态地址目标端口f0/6源端口f0/7 |
switch(config)# |
end |
回到特权模式 |
switch# |
show mac-address-table |
查看整个MAC地址表 ##查看mac的信息有时会非常有用 |
switch# |
clear mac-address-table restricted static |
清除限制性静态地址 |
四,交换机查看命令
命令 |
说明 |
show run |
查看当前运行的配置 |
show run interfaces |
查看端口更具体的信息,可以敲“?”号查看 |
show vlan |
查看vlan的配置信息 |
show int |
查看端口信息 |
show int ? |
查看端口更具体的信息,可以敲“?”号查看 |
show ip interfaces brief |
查看包括ip信息在内的端口简要状态信息 |
dir flash |
查看闪存 |
五,恢复出厂设置命令
提示符 |
命令 |
switch> |
enable |
switch# |
erase startup-configure |
switch# |
reload |
转载自blog.csdn.net/qq_15742255/article/details/82625738