CISCO3560VLAN配置实例.docx
《CISCO3560VLAN配置实例.docx》由会员分享,可在线阅读,更多相关《CISCO3560VLAN配置实例.docx(8页珍藏版)》请在冰豆网上搜索。
CISCO3560VLAN配置实例
CISCO3560-VLAN配置实例
LT
Switch(vlan)#vlan3创建VLAN3
Switch(vlan)#exit
8.为VLAN设置IP地址
为VLAN2设置IP地址
Switch#configureterminal进入配置子模式
Switch(config)#interfacevlan2配置IP,VLAN2
Switch(config-if)#ipaddress133.37.125.5255.255.255.0设置交换机IP(具体IP请依照实际情况设置)
Switch(config-if)#exit
为VLAN3设置IP地址
Switch(config)#interfacevlan3配置IP,VLAN3
Switch(config-if)#ipaddress192.168.1.5255.255.255.0设置交换机IP(具体IP请依照实际情况设置)
Switch(config-if)#exit
9.为VLAN划分交换机接口
配置1-12号电口为VLAN2
Switch(config)#interfacerangefastEthernet0/1-12进入F0/1到F0/12
Switch(config-if)#Switchportmodeaccess设成静态VLAN访问模式
Switch(config-if)#Switchportaccessvlan2将此口分给VLAN2
Switch(config-if)#exit
===================
配置13-24号电口为VLAN3
Switch(config)#interfacerangefastEthernet0/13-24进入F0/13到F0/24
Switch(config-if)#Switchportmodeaccess设成静态VLAN访问模式
Switch(config-if)#Switchportaccessvlan3将此口分给VLAN3
Switch(config-if)#exit
===================
配置1号光口为VLAN-2
Switch(config)#interfaceGigabitEthernet0/1进入G0/1
Switch(config-if)#Switchportmodeaccess设成静态VLAN访问模式
Switch(config-if)#Switchportaccessvlan2将此口分给VLAN2
Switch(config-if)#exit
===================
配置2号光口为VLAN-3
Switch(config)#interfaceGigabitEthernet0/2进入G0/2
Switch(config-if)#Switchportmodeaccess设成静态VLAN访问模式
Switch(config-if)#Switchportaccessvlan3将此口分给VLAN3
Switch(config-if)#exit
Switch(config)#exit
10.关闭VLAN1
Switch#configureterminal进入配置子模式
Switch(config)#interfacevlan1配置VLAN1
Switch(config-if)#shutdown关闭VLAN1
Switch(config-if)#exit
Switch(config)#exit
Switch#showinterfacefastethernet0/1status查看F0/1网口状态
Switch#showinterfacefastethernet0/1查看F0/1网口详细配置
Switch#showrunning-config查看全局配置
11.配置默认网关
Switch#configureterminal进入配置子模式
Switch(config)#ipdefault-gateway133.37.125.4
Switch(config)#exit
12.设置使可以远程telnet登陆
Switch#configureterminal进入配置子模式
Switch(config)#linevty04
Switch(config-line)#passwordcisco
Switch(config-line)#login
Switch(config-line)#exit
Switch(config)#exit
13.保存当前配置
Switch#copyrunning-configstartup-config
Destinationfilename[startup-config]?
回车
片刻后出现:
Buildingconfiguration...
[OK]
表示当前配置保存成功。
14.交换机配置情况图示
配置完成,目前整个交换机配置情况如下:
15.其它相关知识
交换机与交换机/路由器间级联通信:
当级联的设备端口设置了trunk或划分了VLAN等情况,可能需要修改级联端口的工作模式为trunk模式才能实现相互之间的通信。
如果是与电口级联,可以修改1号网口为trunk工作模式,使用该接口进行级联:
Switch#configureterminal进入配置子模式
Switch(config)#interfacefastethernet0/1进入F0/1口
Switch(config-if)#switchporttrunkencapsulationdot1q
Switch(config-if)#switchportmodetrunk设成TRUNK口
Switch(config-if)#switchporttrunkallowedvlanall允许所有VLAN从此口通过
Switch(config-if)#exit
Switch(config)#exit
如果是与光纤接口级联,可以修改1号光纤接口为trunk工作模式,使用该接口进行级联:
Switch#configureterminal进入配置子模式
Switch(config)#interfaceGigabitEthernet0/1进入G0/1
Switch(config-if)#switchporttrunkencapsulationdot1q
Switch(config-if)#switchportmodetrunk设成TRUNK口
Switch(config-if)#switchporttrunkallowedvlanall允许所有VLAN从此口通过
Switch(config-if)#exit
Switch(config)#exit
执行后请按照第13步中的描述保存当前配置。
WEB方式检查交换机状态:
如果需要对交换机的状态进行实施查看,可以通过
URL:
http:
//192.168.1.5或http:
//133.37.125.5
账号:
admin
密码:
cisco
登陆后进行查看。
恢复交换机出厂设置:
Switch>en进入特权模式
Switch#writeerase
Erasingthenvramfilesystemwillremoveallconfigurationfiles!
Continue?
[confirm]回车
[OK]
Eraseofnvram:
complete
00:
36:
19:
%SYS-7-NV_BLOCK_INIT:
Initializedthegeometryofnvram
Switch#reload
Proceedwithreload?
[confirm]回车
00:
36:
59:
%SYS-5-RELOAD:
Reloadrequestedbyconsole.ReloadReason:
ReloadCommand.
片刻之后,交换机会进行重启,并在重启后恢复为出厂设置。
远程通过telnet登陆交换机终端:
将本机IP设置为与交换机VLAN2或VLAN3同一个网段;
开始-运行-cmd;
执行telnet133.37.125.5或telnet192.168.1.5即可。
CISCO交换机基本配置:
Console端口连接
用户模式hostname#;
特权模式hostname(config)#;
全局配置模式hostname(config-if)#;
交换机口令设置:
switch>enable;进入特权模式
switch#configterminal;进入全局配置模式
switch(config)#hostnamecsico;设置交换机的主机名
switch(config)#enablesecretcsico1;设置特权加密口令
switch(config)#enablepasswordcsico8;设置特权非密口令
switch(config)#lineconsole0;进入控制台口
switch(config-line)#linevty04;进入虚拟终端
switch(config-line)#login;虚拟终端允许登录
switch(config-line)#passwordcsico6;设置虚拟终端登录口令csico6
switch#exit;返回命令
交换机VLAN创建,删除,端口属性的设置,配置trunk端口,将某端口加入vlan中,配置VTP:
switch#vlandatabase;进入VLAN设置
switch(vlan)#vlan2;建VLAN2
switch(vlan)#vlan3namevlan3;建VLAN3并命名为vlan3
switch(vlan)#novlan2;删vlan2
switch(config)#intf0/1;进入端口1
switch(config)#speed?
查看speed命令的子命令
switch(config)#speed100设置该端口速率为100mb/s(10/auto)
switch(config)#duplex?
查看duplex的子命令
switch(config)#duplexfull设置该端口为全双工(auto/half)
switch(config)#descriptionTO_PC1这是该端口描述为TO_PC1
switch(config-if)#switchportaccessvlan2;当前端口加入vlan2
switch(config-if)#switchportmodetrunk;设置为trunk模式(access模式)
switch(config-if)#switchporttrunkallowedvlan1,2;设置允许的vlan
switch(config-if)#switchporttrunkencapdot1q;设置vlan中继
switch(config)#vtpdomainvtpserver;设置vtp域名相同
switch(config)#vtppassword;设置发vtp密码
switch(config)#vtpserver;设置vtp服务器模式
switch(conf