思科模拟器基本命令交换机文档格式.docx
《思科模拟器基本命令交换机文档格式.docx》由会员分享,可在线阅读,更多相关《思科模拟器基本命令交换机文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
Switch#configureterminal进入交换机全局配置模式Switch(configure)#hostnameyzh改变名字为XXX
yzh(configure)#显示改名成功
yzh(configure)#exit退回上级操作模式,即返回特权模式yzh#
yzh#exit返回到用户模式
yzh>
参看交换机有关信息
yzh#
yzh#configureterminal进入交换机全局配置模式yzh#showversion查看交换机的版本信息
yzh#showvlan查看交换机的VLAN信息,默认情况下所有借口均属于VLAN
yzh#showrunning-config查看交换机当前生效的配置信息配置交换机接口f0/2
enable
yzh#configureterminal进入交换机配置模式yzh(config)#interfacefastEthernet0/2进入交换机接口fa0/2yzh(config-if)#进入接口配置模式yzh(config-if)#speed100设置接口F0/2速率为100Myzh(config-if)#duplexhalf配置接口的双工模式是半双工yzh(config-if)#noshutdown开启接口,使得处于工作状态,等待转发数据。
yzh(config-if)#exit输入exit返回全局模式yzh(config)#exit返回特权模式
yzh#位于特权模式
yzh#showinterfacesfastEthernet0/2查看刚才对接口f0/2配置情况设置交换机Enable特权密码为admin
进入超级终端控制台yzh>
enable进入交换机特权模式yzh#configureterminal进入交换机配置模式yzh(config)#enablesecretadmin设置Enable密码为admin注:
验证密码自己思考。
查看设备配置信息
yzh#showrunning-config
保存配置信息
yzh#write保存设置配置,把配置指令写入对到系统文件夹中yzh#dir查看系统文件
删除配置,恢复初始配置
yzh#dir查看系统文件
yzh#delete?
输入“,”号,获得帮助yzh#deleteflash:
config.txt删除配置文件
系统就恢复了出厂配置
三层交换机与二层交换机的大多数都相同。
配置三层交换机的名称为SW3,enable密码为admin,并且配置与远程登陆相关的选项。
Switch>
enable进入交换机特权模式Switch#configureterminal进入交换机全局模式Swirch(config)#hostnameyzh修改交换机名称
Yzh(config)#enablepasswordadmin设置交换机enable密码为adminYzh(config)#interfacevlan1进入vlan1
Yzh(config-if-VLAN1)#ipaddress192.168.1.1255.255.255.0配置IP地址yzh(config-if-VLAN1)#exit退出配置vlan1yzh(config)#usernameadminpasswordadmin配置登陆交换机的用户名与密码yzh(config)#linevty04进入vty端口配置
yzh(config-line)#loginlocal配置vty端口使用本地数据库验证yzh(config-line)#exit退出vty端口配置
yzh(config)#配置OK
保存三层交换机配置。
SW3#write
配置三层交换机名称与VLAN
yzh#configureterminal进入交换机全局模式
yzh(config)#hostnameYZH修改交换机名称为YZH
YZH(config)#vlan10创建vlan10
YZH(config-vlan)#vlan20创建vlan20
YZH(config-vlan)#exitYZH(config)#interfacerangefastEthernet0/1-10进入fa/1-10端口YZH(config-if-range)#switchportaccessvlan10划分fa/1-10端口为vlan10
YZH(config-if-range)exit
YZH(config)#interfacerangefastEthernet0/11-20进入fa/11-20端口YZH(config-if-range)#switchportaccessvlan20划分fa/11-20端口为vlan20YZH(config-if-range)#exit
查看vlan配置信息
YZH(config)#exit
YZH#showvlan查看交换机vlan信息配置vlan10与vlan20的IP地址,使vlan10与vlan20之间能相互通讯。
YZH(config)#interfacevlan10进入vlan10YZH(config-vlan10)#ipaddress192.168.1.1255.255.255.0配置vlan10的IP地址YZH(config-vlan10)#exit
YZH(config)#interfacevlan20进入vlan20YZH(config-vlan20)#ipaddress192.168.2.1255.255.255.0配置vlan20的IP地址YZH(config)#exit
YZH#showrunning-config查看交换机配置信息在三层交换机上配置vlan10与20的IP地址后,PC1与PC2可以相互通讯YZH>
enable进入特权模式
YZH#configureterminal进入全局模式
YZH(config)#hostnameyzh修改名称
yzh(config)#interfacerangefasrEthernet0/1-2进入fa0/1、fa0/2端口yzh(config-if-range)#port-group1把fa0/1、fa0/2端口聚合为端口组1yzh(config-if-range)#exit
yzh(config)#exit注:
验证测试:
查看交换机配置yzh#showrunning-config
配置三层交换机SW1的生成树协议
yzh#configure
yzh(config)#hostnameYZH
YZH(config)#spanning-tree配置生成树
验证配置:
YZH#showvlan查看VLAN划分信息配置二层交换机SWB的VLAN划分
YZH>
YZH#configureterminal
YZH(config)#hostnameSWB配置交换机名称YZH(config)#vlan20创建VLAN20YZH(config-vlan)#exit
YZH(config)#intfa0/1
YZH(config-if)#swit
YZH(config-if)#switchportaccessvlan20将端口Fa0/1划分为VLAN20YZH(config-if)#exit
YZH(config)#intfa0/24
YZH(config-if)#switchportaccessvlan20将端口Fa0/24划分为VLAN20YZH(config-if)#exit
配置三层交换机SW1不同VLAN之间的通信
YZH(config)#hostnameyzh~配置交换机名称yzh(config)#vlan10~创建VLAN10yzh(config-vlan)#vlan20~创建VLAN20yzh(config-vlan)#vlan30~创建VLAN30
yzh(config-vlan)#exit
yzh(config)#interfacevlan10~配置VLAN10的IP地址
yzh(config-VLAN10)#ipaddress192.168.1.1255.255.255.0yzh(config-VLAN10)#exit
yzhconfig)#interfacevlan20~配置VLAN20的IP地址
yzh(config-VLAN20)#ipaddress192.168.2.1255.255.255.0yzhconfig-VLAN20)#exit
yzh(config)#interfacevlan30~配置VLAN30的IP地址
yzh(config-VLAN30)#ipaddress192.168.3.1255.255.255.0
yzh(config-VLAN30)#exit
yzh(config)#interfacerangefastEthernet0/1-7yzh(config-if-range)#switchportaccessvlan10~划分VLAN10
yzh(config-if-range)#exit
yzh(config)#interfacerangefastEthernet0/8-14yzh(config-if-range)#switchportaccessvlan20~划分VLAN20
yzh(config)#interfacerangefastEthernet0/15-21yzh(config-if-range)#switchportaccessvlan30~划分VLAN30
配置风暴控制。
在交换机配置F0/1端口(连接PC1的端口)对广播报文进行风暴控制,限制其端口收到的报文速率(pps)
yzh(config)#interfacefastEthernet0/1yzh(config-if)#storm-controlbroadcastpps100配置报文速率阈每秒100个报文yzh(config-if)#exit
配置交换机端口安全的最大连接数和端口违背模式,绑定PC机IP地址和MAC地址到端口上
yzh(config)#interfacefastEthernet0/1yzh(config-FastEthernet0/1)#switchportport-secur