交换机配置的常用命令

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

vlan配置思路(access、Trunk)(1)创建Vlan在基于IOS的交换机上配置静态VLAN:switch#vlandatabaseswitch(vlan)#vlanvlan-numnamevlan-nameswitch(vlan)#exitswitch#configureteriminalswitch(config)#interfaceinterfacemodule/numberswitch(config-if)#switchportmodeaccess//设置端口模式为access模式switch(config-if)#switchportaccessvlanvlan-num//设置端口所属的VLANswitch(config-if)#end核验配置:showvlan(2)配置干道链路干道是在两台catalyst交换机端口或catalyst交换机与路由器间的一条点对点链路。干道链路可以承载多个vlan.在基于IOS的交换机上配置干道链路switch(config)#interfaceinterfacemod/portswitch(config-if)#switchportmodetrunk//设置端口模式为trunk模式switch(config-if)#switchporttrunkencapsulation{isl|dotlq}//设置trunk所封装的帧switch(config-if)#switchporttrunkallowedvlanremovevlan-list//允许那些VLAN通过干路(附:switchporttrunkallowedvlan{add|all|except|remove}vlan-list)*noswitchportnoswitchport//把物理端口变成三层口,即把三层口当成路由器上的口,当将一个端口配置成三层端口之后,就可以在此端口上分配IP地址了,当然还是可以连接PC机的,.路由口:路由口是指某一物理端口在端口配置状态下用noswitchport命令生成的端口,所有的三层都需要IP地址以实现路由交换。配置举例如下:Switch#configureterminalSwitch(config)#interfacegigabitethernet0/2Switch(config-if)#noswitchportSwitch(config-if)#ipaddress192.20.135.21255.255.255.0Switch(config-if)#noshutdownSwitch(config-if)#end附:showinterfaces[interface-id]switchport//显示二层端口的状态,可以用来决定此口是否为二层或三层口。Eg:Switch#showinterfacesfastethernet0/1switchport[nextpage]*三层交换机上VLAN的设置(1)方法一:一般常规配置Switch#configureterminalSwitch(config)#vlan20Switch(config-vlan)#nametest20Switch(config-vlan)#ipaddress1.1.1.1255.255.255.0Switch(config-vlan)#end方法二:也可以在enable状态下,进行VLAN配置:Switch#vlandatabase//进入VLAN配置状态Switch(vlan)#vlan20nametest20//加入VLAN号及VLAN名Switch(vlan)#exit更新VLAN数据库并退出(2)将端口分配给某个VLANSwitch#configureterminalSwitch(config)#interfacefastethernet0/1Switch(config-if)#switchportmodeaccess//定义二层口的工作模式为接入模式Switch(config-if)#switchportaccessvlan2//把端口分配给某一VLANSwitch(config-if)#endSwitch#(3)配置VLANTrunksSwitch#configureterminalSwitch(config)#interfacefastethernet0/4Switch(config-if)#switchportmodetrunkSwitch(config-if)#switchporttrunkencapsulationdot1qSwitch(config-if)#end附:switchporttrunkencapsulation{isl|dot1q|negotiate}//配置trunk封装ISL或802.1Q或自动协商switchportmode{dynamic{auto|desirable}|trunk}(一般不用它),配置二层trunk模式。(dynamicauto-自动协商是否成为trunk;dynamicdesirable-把端口设置为trunk如果对方端口是trunk,desirable,或自动模式;trunk-设置端口为强制的trunk方式,而不理会对方端口是否为trunk)(4)定义trunk允许的VLANSwitch(config)#interfacefastethernet0/1Switch(config-if)#switchporttrunkallowedvlanremove2//配置trunk允许的VLANSwitch(config-if)#end附:switchporttrunkallowedvlan{add|all|except|remove}vlan-list(5)配置NativeVLAN(802.1q)switch(config-if)#switchporttrunknativevlan-num//封装802.1q的trunk端口可以接受带有标签和不带标签的数据流,交换机向nativevlan传送不带标签的数据流,缺省情况下nativeVLAN是VLAN1使用noswitchporttrunknativevlan端口配置命令回到缺省的状态(6)配置一组端口4006#configureterminal4006(config)#interfacerangefastethernet2/1–54006(config-if-range)#noshutdown//注意:端口号之间需要加入空格,如:interfacerangefastethernet2/1–5是有效的,而interfacerangefastethernet2/1-5是无效的。12下一页以下的例子显示使用逗号来配置不同类型端口的组:4006#configureterminal4006(config)#interfacerangefastethernet2/1–3,gigabitethernet3/1–24006(config-if-range)#noshutdown(7)其它常用命令duplex{auto|full|half}//设置全双工或半双工。speed{10|100|1000|auto|nonegotiate}设置端口速率//注:1000只工作在千兆口。GBIC模块只工作在1000Mbps下。nonegotiate只能在这些GBIC上用1000BASE-SX,-LX,and-ZXGBIC.copyrunning-configstartup-config//保存设置[nextpage](8)配置EtherChannel以太通道捆绑几个以太端口为一个独立的逻辑链路。如4006交换机,你可以捆绑在4006任何模块上最多8个兼容的具有相同速率的端口。每个以太通道具有一个port-channel端口号。要捆绑一个以太通道时,会产生一个逻辑port-channel端口,逻辑端口下的配置可影响与之捆绑的物理端口,但物理端口下的配置不能影响逻辑端口的配置。1)三层以太通道(逻辑port-channe)的配置Switch#configureterminalSwitch(config)#interfaceport-channel1//创建一个逻辑端口Switch(config-if)#ipaddress172.32.52.10255.255.255.0Switch(config-if)#end2)三层物理端口配置Switch#configureterminalSwitch(config)#interfacerangefastethernet5/4–5(注意:空格是必需的)Switch(config-if)#noswitchport//改变该端口为三层接口Switch(config-if)#noipaddress//确认接口没有配置IP地址Switch(config-if)#channel-group1modedesirableSwitch(config-if)#end附:Switch(config-if)#channel-groupport_channel_numbermode{auto|desirable|on}//将该物理端口加入一个以太通道中,并确定PagP模式。3)二层以太通道配置Switch#configureterminalSwitch(config)#interfacerangefastethernet5/6–7(注意:空格是必需的)Switch(config-if-range)#channel-group2modedesirableSwitch(config-if-range)#endSwitch#showrunning-configinterfaceport-channel2Buildingconfiguration…Currentconfiguration:!interfacePort-channel2switchportaccessvlan10switchportmodeaccessendSwitch#*如何作端口聚合如果要配置二台6509之间的Trunk联接,首先将二6509用千兆光纤相联好,然后分别配置二相联端口的trunk,可以是只用一双光纤,或用二对光纤做portchannel,配置如下:一双光纤相联时,分别在二台65上进行以下的配置:interfaceGigabitEthernet1/1noipaddressswitchportswitchporttrunkencapsulationdot1qswitchporttrunknativevlan1二对光纤相联时,必须要做portchannel,分别在二台65上进行以下的配置:interfaceport-channe1noipaddressswitchportswitchporttrunkencapsulationdot1qswitchporttrunknativevlan1!interfaceGigabitEthernet1/1noipaddressduplexfullspeed1000switchportmodetrunkswitchporttrunkencapsulationdot1qswitchporttrunknativevlan1channel-group1modeon!interfaceGigabitEthernet1/2noipaddressduplexfullspeed1000switchportmodetrunkswitchporttrunkencapsulationdot1qswitchporttrunknativevlan1channel-group1modeon*VTP裁剪(1)在基于IOS的交换机上配置VTP模式:switch#vlandatabaseswitch(vlan)#vtpdomaindomain-nameswitch(vlan)#vtp{sever|cilent|transparent}switch

1 / 8
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功