VLAN与TRUNK配置
- 格式:ppt
- 大小:1.29 MB
- 文档页数:19
交换机上配置静态VLAN1、创建VLAN(1)在全局模式下创建VLAN:switch>enable 进入特权模式switch#configure terminal 进入全局模式switch(config)#vlan vlan-ID创建VLAN号switch(config)#name vlan-name配置VLAN名称switch(config)#mtu mtu-size改变MTU大小(可选命令)switch(config)#end 退出switch(config)#show vlan {name vlan-name|ID vlan-id}验证查看vlanswitch(config)#copy running-config startup-config 保存配置(2)在VLAN数据库中创建VLAN(VLAN数据库模式目前已经过时IOS版本不在支持,推荐使用全局模式配置定义VLAN)switch#vlan datebase 进入VLAN配置状态switch(vlan)#vlan vlan-id name vlan-name创建VLAN号及VLAN名称switch(vlan)#vlan vlan-id mtu mtu-size 修改MTU大小switch(vlan)#exit 更新VLAN数据并退出switch(config)#show vlan {name vlan-name|ID vlan-id}验证查看vlanswitch(config)#copy running-config startup config 保存配置(3)在VLAN中添加、删除端口switch#configure terminal 进入配置状态switch(config)# interface interface-id 进入要分配的端口switch(config)#switchport mode access 定义二层端口switch(config)#switchport access vlan vlan-id把端口划分给某个VLANswitch(config)#end 退出switch#show running-config interface interface-ID验证端口号的VLAN号switch#show interfaces interface-id switchport 验证端口的管理模式和VLAN情况switch#copy running-config startup-config 保存配置使用default interface interface-id命令可以还原接口的默认配置状态(4)验证VLAN的配置switch#show vlan brief 查看VLAN信息的命令switch#show vlan vlan-id查看指定的某一个VLAN信息(5)删除VLAN用no vlan vlan-id命令Switch#configure terminalSwitch(config)#no vlan vlan-id++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2、Turnk的模式和协商接口的配置模式1、switchport mode access将接口设定为永久的非中继模式,并协商将链路转换为非中继链路,即使邻接端口是中继端口,此接口也会成为非中继接口2、switchport mode dynamic desirable 使得接口主动尝试将链路转换为中继链路。
一、VLAN的基本概念经过上一次大讲坛的了解,我们已经知道,对于一台二层交换机来说,整机就是一个广播域、一个LAN。
这意味着,只要连接到这个广播域的PC配置在一个IP子网内,即可进行互相访问,而且更重要的一点是,处于同一个广播域内的某个用户,发送一个广播数据帧,意味着在这个广播域内的所有用户都会收到这个数据帧,并且耗费资源来处理(即使她它可能并不需要这个数据帧)。
当这个广播域变得特别大、用户数量变得特别多时,网络就非常有可能被大量的广播消耗掉大量资源。
另一方面,实际的网络中经常存在这样的需求:连接在同一个交换机上的用户有可能是不同的业务部门,我希望对他们进行隔离,或者以独立的网络单元进行管理。
基于上述需求,我们引入VLAN的概念,所谓VLAN,翻译为Virtual LAN,实际上是一个虚拟的、逻辑的LAN,通过VLAN技术,我们可以在交换机上,根据接口等信息进行LAN的划定。
例如:上图中,我们基于设备接口进行VLAN的划分。
将接口1、2划分到了VLAN10,将接口23、24划分到了VLAN20。
这样一来,接口1、2所连接的PC就加入了VLAN10,处于同一个LAN、同一个广播域内,那么这些PC只要配置同一个网段的IP地址,就能够直接进行互访了。
而接口23、24处于另一个VLAN20,另一个LAN、另一个广播域。
属于VLAN20的PC之间能够直接进行互访。
但是,不同的VLAN之间,用户是被隔离的(除非借助路由设备),当然,一个VLAN内的广播数据帧并不会被泛洪到另一个VLAN来,因为他们处于不同的广播域。
有了VLAN技术,我们的网络设计将更加灵活、更加可控。
VLAN是一个虚拟的LAN,不再受设备的限制。
我们可以根据实际的业务环境需要,灵活的进行VLAN的规划。
而VLAN更可以跨交换机,因此VLAN的成员,也就是业务PC所处的位置就非常灵活了。
例如上图所示,你可能希望每个部门单独划分到一个LAN 中,部分之间互相隔离,而一个部门的员工又往往未必在同一楼层,可能分散在不同的楼层,那么有了VLAN 技术,完全可以把分散在不同楼层的业务PC划分入一个VLAN。
一、在SwA上分别创建VLAN2和VLAN3,并把端口划归相应的VLAN Switch>enable //进入特权模式Switch#vlan database //进入vlan配置模式% Warning: It is recommended to configure VLAN from config mode,as VLAN database mode is being deprecated. Please consult userdocumentation for configuring VTP/VLAN in config mode.Switch(vlan)#vlan 2 name NetA //划分vlan 2名称为NetAVLAN 2 added:Name: NetASwitch(vlan)#vlan 3 name NetB //划分vlan 3名称为NetBVLAN 3 added:Name: NetBSwitch(vlan)#exitAPPLY completed.Exiting....Switch#conf tEnter configuration commands, one per line. End with CNTL/Z.Switch(config)#int f0/1 //进入交换机的Fastethernet0/1接口Switch(config-if)#switchport mode access //配置成接入模式Switch(config-if)#switchport access vlan 2 //将vlan 划分到Fastethernet0/1接口Switch(config-if)#exitSwitch(config)#int f0/3 //同上Switch(config-if)#switchport mode accessSwitch(config-if)#switchport access vlan 3Switch(config-if)#endSwitch#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#wr //保存当前配置Building configuration...[OK]Switch#二、对SwB划分VLAN2和VLAN3,并划归相应端口。
实验过程:环境:PC1:172..16.1.1 PC2:172.16.1.21.划分VLAN之前两台交换机未做任何配置,可以PING通。
2.对交换机switch2配置两个VLAN:2和3(1)下图为创建VLAN2 和VLAN3两个VLAN。
(2)下图将SW2的fa0/2配置到VLAN3中(接PC1),fa0/1配置到VLAN2中(接SW1)。
(3)测试(在PC2上进行)3.TRUNK实验拓扑如下:(1)环境:6个PC 的IP地址依次为:172.16.1.1、1.2、1.3、1.4、1.5、1.6。
PC1、PC2、PC3、PC4属于VLAN2PC3、PC6属于VLAN3。
两个SW通过FA0/12连接(2)两个SW的VLAN基本配置①SW1的配置:②SW2的配置:也是先创建2个VLAN,VLAN2和VLAN3,然后分配借口。
③测试:PC1 PING PC2 通PC1 PING PC3、PC4、PC5、PC6 不通(3)两个SW的TRUNK配置①SW1的配置:②SW2的配置:③测试:PC1 PING PC2 、PC4、PC5 通PC1 PING PC3、PC6 不通PC3 PING PC6 通;其他的不通。
4.VTP实验cisco#vlan database \*进入VLAN配置cisco(vlan)# \*表示你进入了VLAN配置模式cisco(vlan)#vtp domain VTP 域名\*配置VTP的域名cisco(vlan)#VTP password 密码\*为VTP域设置密码cisco(vlan)#VTP MODE server|client|transparent\*这里特别说明一下,SERVER就是配置VTP为服务器,CLIENT就是配置VTP 的客户端TRANSPARENT就是设置为透明模式,按照你的需求设置5.单臂路由实验(1)环境(2)PC的IP192.168.2.1和192.168.2.2 /24 GW:192.168.2.254 192.168.3.1和192.168.3.2 /24 GW:192.168.3.254 (3)VLAN的IP:VLAN1:192.168.2.253(包含PC1、PC2)VLAN2:192.168.3.253(包含PC3、PC4)(4)SW配置(5)测试各个终端之间不通。
网络性能是影响业务效率的一个重要因素。
将大型广播域分段是提高网络性能的方法之一。
路由器能够将广播包阻隔在一个接口上,但是,路由器的LAN接口数量有限,它的主要功能是在网络间传输数据,而不是对终端设备提供网络接入。
访问LAN的功能还是由接入层交换机来实现。
与三层交换机相类似,通过在二层交换机上创建VLAN来减少广播域。
现代交换机就是通过VLAN来构造的,因此在某种程度上,学习交换机就是学习VLAN。
问题的产生:如下图所示,当网络上的所有设备在广播域产生大量的广播以及多播帧,就会与数据流竞争带宽。
这是由网络管理数据流组成,如:ARP,DHCP,STP等。
如下图所示,假设PC 1产生ARP,Windows登录,DHCP等请求:这些广播帧到达交换机1之后,遍历整个网络并到达所有节点直至路由器。
随着网络节点增加,开销的总数也在增长,直至影响交换机性能。
通过实施VLAN断开广播域将数据流隔离开来,能够解决这一问题。
什么是VLAN:VLAN(virtual local area network)是一组与位置无关的逻辑端口。
VLAN就相当于一个独立的三层网络。
VLAN的成员无需局限于同一交换机的顺序或偶数端口。
下图显示了一个常规的部署,左边这张图节点连接到交换机,交换机连接到路由器。
所有的节点都位于同一IP网络,因为他们都连接到路由器同一接口。
图中没有显示的是,缺省情况下,所有节点实际上都是同一VLAN。
因此,这种拓扑接口可看作是基于同一VLAN的,如上面右图所示。
例如,Cisco设备默认VLAN是VLAN 1,也称为管理VLAN。
默认配置下包含所有的端口,体现在源地址表(source address table,SAT)中。
该表用于交换机按照目的MAC地址将帧转发至合适的二层端口。
引入VLAN之后,源地址表按照VLAN将端口与MAC地址相对应起来,从而使得交换机能够做出更多高级转发决策。
下图显示了show mac address table和show vlan命令的显示输出。
关于LAN网内VLAN与Trunk的详细配置此实验过程是在Boson NetSim for CCNP version 6.0 BETA 1软件下做的。
其中使用2台C2905switch和4台PC机。
实验内容:1、配置控制端口和虚拟线路2、设置VLAN两个,分别为:VLAN100 Pcontrol和VLAN200 Accout3、分别将接口加入到VLAN100和VLAN200后配置Trunk线路,保证VLAN间的通信4、最后进行测试是否成功关于LAN网内VLAN与Trunk的详细配置SW1(C2950)交换机测试详细步骤及结果:CLI session with the switch is open.To end the CLI session, enter [Exit].Switch>%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/6, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/7, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/8, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/9, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/11, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/11, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/12, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down Switch>enableSwitch#show versionBoson Operating Simulation SoftwareBOSS (tm) C2900 Software (C2900-Enterprise), Version 12.1, RELEASE SOFTWARE Copyright (c) 1998-2003 by Boson Software, Inc.BOSS ROM: System Bootstrap, Version 12.2, RELEASE SOFTWARESwitch Uptime Is 0 days, 0 hours, 0 minutesSystem restarted by power-onSystem image file is ""flash:c2900-enterprise.12.1.boss"", booted via flashBoson 2900 (BOSS) processor (revision 5.0)12 FastEthernet/IEEE 802.3 interface(s)32K bytes of simulated non-volatile configuration memory.8192K bytes of simulated System flash (Read/Write)Switch#Switch#Switch#show runn!Version 12.1service timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname Switch!!!ip subnet-zerospanning-tree extend system-id!!!!!!!!interface FastEthernet0/1!interface FastEthernet0/2Switch#show runn!Version 12.1service timestamps debug uptime service timestamps log uptime no service password-encryption !hostname Switch!!!ip subnet-zerospanning-tree extend system-id !!!!!!!!interface FastEthernet0/1!interface FastEthernet0/2!interface FastEthernet0/3!interface FastEthernet0/4!interface FastEthernet0/5!interface FastEthernet0/6!interface FastEthernet0/7!interface FastEthernet0/8!interface FastEthernet0/9!interface FastEthernet0/10!interface FastEthernet0/11interface FastEthernet0/12!vtp domain bigdomain!interface Vlan 1no ip addressno ip route-cache!!ip classlessno ip http server!!!!line con 0transport input noneline aux 0line vty 0 15!no scheduler allocateendSwitch#Switch#Switch#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Switch(config)#hostname SW1SW1(config)#line console 0SW1(config-line)#exec-timeout 20 0SW1(config-line)#logging synchronousSW1(config-line)#password dsfengSW1(config-line)#loginSW1(config-line)#line vty 0 15SW1(config-line)#exec-timeout 15 0SW1(config-line)#logging synchronousSW1(config-line)#password dsfengSW1(config-line)#loginSW1(config-line)#enable secret ciscoSW1(config)#exitSW1#SW1#SW1#vlan databaseSW1(vlan)#vlan 100 name PcontrolVLAN 100 added:Name:PcontrolSW1(vlan)#vlan 200 name AccoutVLAN 200 added:Name:AccoutSW1(vlan)#exitAPPL Y completed.Exiting....SW1#SW1#SW1#configure terminalEnter configuration commands, one per line. End with CNTL/Z.SW1(config)#interface fastethernet 0/2SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 100SW1(config-if)#exitSW1(config)#interface fastethernet 0/3SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 200SW1(config-if)#exitSW1(config)#interface fasteterhent 0/10SW1(config-if)#switchport mode trunkSW1(config-if)#switchport trunk encapsulation dot1qSW1(config-if)#endSW1#SW1#SW1#show interface fastethernet 0/2FastEthernet0/2 is up, line protocol is upHardware is Fast Ethernet, address is 000C.6542.9093 (bia 000C.6542.9093) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW1#SW1#SW1#show interface fastethernet 0/3FastEthernet0/3 is up, line protocol is upHardware is Fast Ethernet, address is 000C.3849.2796 (bia 000C.3849.2796) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW1#SW1#SW1#show interface fastethernet 0/10FastEthernet0/10 is up, line protocol is upHardware is Fast Ethernet, address is 000C.3878.9745 (bia 000C.3878.9745) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW1#SW1#SW1#show vlanVLAN Name Status Ports---- -------------------------------- --------- -------------------------------1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6Fa0/7, Fa0/8, Fa0/9, Fa0/10Fa0/11, Fa0/12100 Pcontrol active Fa0/2200 Accout active Fa0/31002 fddi-default active1003 token-ring-default active1004 fddinet-default active1005 trnet-default activeVLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------1 enet 100001 1500 - - - - - 0 0100 enet 100100 1500 - - - - - 0 0200 enet 100200 1500 - - - - - 0 01002 fddi 101002 1500 - - - - - 0 01003 tr 101003 1500 - - - - - 0 01004 fdnet 101004 1500 - - - ieee - 0 01005 trnet 101005 1500 - - - ibm - 0 0SW1#SW1#SW1#show cdp neighborsCapability Codes: R - Router, T - Trans Bridge, B - Source Route BridgeS -Switch, H - Host, i - IGMP, r - RepeaterDevice ID Local Intrfce Holdtme Capability Platform Port IDSW2 Fas0/10 167 T S 2950 Fas 0/10SW1#SW1#SW1#show mac-address-tableCapability Codes: R - Router, T - Trans Bridge, B - Source Route BridgeS -Switch, H - Host, i - IGMP, r - RepeaterDevice ID Local Intrfce Holdtme Capability Platform Port IDSW2 Fas0/10 167 T S 2950 Fas 0/10Mac Address Table------------------------------------------Vlan Mac Address Type Ports---- ----------- ---- -----200 000C.9631.1997 DYNAMIC Fa0/3100 000C.7036.8702 DYNAMIC Fa0/21 000C.3817.8412 DYNAMIC Fa0/101 000C.9623.5011 DYNAMIC Fa0/101 000C.1738.3819 DYNAMIC Fa0/10Total Mac Addresses for this criterion: 5SW1#SW1#SW1#show run!Version 12.1service timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname SW1enable secret 5 $sdf$6978yhg$jnb76sd!!!ip subnet-zerospanning-tree extend system-id!!!!!!!!interface FastEthernet0/1!interface FastEthernet0/2 switchport mode access switchport access vlan 100!interface FastEthernet0/3 switchport mode access switchport access vlan 200!interface FastEthernet0/4!interface FastEthernet0/5!interface FastEthernet0/6!interface FastEthernet0/7!interface FastEthernet0/8!interface FastEthernet0/9!interface FastEthernet0/10 switchport mode trunkswitchport trunk encapsulation dot1q !interface FastEthernet0/11!interface FastEthernet0/12!vtp domain bigdomain!interface Vlan 1no ip addressno ip route-cache!vlan 100 name Pcontrolvlan 200 name Accout!ip classlessno ip http server!!!!line con 0logintransport input nonepassword dsfengexec-timeout 15 0logging synchronousline aux 0line vty 0 15loginpassword dsfeng!no scheduler allocateendSW1#SW1#SW1#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]SW1#SW1#SW2(C2950)交换机测试详细步骤及结果:CLI session with the switch is open.To end the CLI session, enter [Exit].%LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/4, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/4, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/5, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/5, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/6, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/6, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/7, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/7, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/8, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/8, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/9, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/9, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/11, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/11, changed state to down %LINK-3-UPDOWN: Interface FastEthernet0/12, changed state to down%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down Switch>Switch>enableSwitch#show versionBoson Operating Simulation SoftwareBOSS (tm) C2900 Software (C2900-Enterprise), Version 12.1, RELEASE SOFTWARE Copyright (c) 1998-2003 by Boson Software, Inc.BOSS ROM: System Bootstrap, Version 12.2, RELEASE SOFTWARESwitch Uptime Is 0 days, 0 hours, 5 minutesSystem restarted by power-onSystem image file is ""flash:c2900-enterprise.12.1.boss"", booted via flashBoson 2900 (BOSS) processor (revision 5.0)12 FastEthernet/IEEE 802.3 interface(s)32K bytes of simulated non-volatile configuration memory.8192K bytes of simulated System flash (Read/Write)Switch#Switch#Switch#show runn!Version 12.1service timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname Switch!!!ip subnet-zerospanning-tree extend system-id !!!!!!!!interface FastEthernet0/1!interface FastEthernet0/2!interface FastEthernet0/3!interface FastEthernet0/4!interface FastEthernet0/5!interface FastEthernet0/6!interface FastEthernet0/7!interface FastEthernet0/8!interface FastEthernet0/9!interface FastEthernet0/10!interface FastEthernet0/11!interface FastEthernet0/12!vtp domain bigdomain!interface Vlan 1no ip addressno ip route-cache!!ip classlessno ip http server!!!!line con 0transport input noneline aux 0line vty 0 15!no scheduler allocateendSwitch#Switch#Switch#configure terminalEnter configuration commands, one per line. End with CNTL/Z. Switch(config)#hostname SW2SW2(config)#line console 0SW2(config-line)#exec-timeout 20 0SW2(config-line)#logging synchronousSW2(config-line)#password dsfengSW2(config-line)#loginSW2(config-line)#line vty 0 15SW2(config-line)#exec-timeout 15 0SW2(config-line)#logging synchronousSW2(config-line)#password dsfengSW2(config-line)#loginSW2(config-line)#enable secret ciscoSW2(config)#endSW2#SW2#SW2#vlan databaseSW2(vlan)#vlan 100 name PcontrolVLAN 100 added:Name:PcontrolSW2(vlan)#vlan 200 name AccoutVLAN 200 added:Name:AccoutSW2(vlan)#exitAPPL Y completed.Exiting....SW2#SW2#SW2#configure terminalEnter configuration commands, one per line. End with CNTL/Z.SW2(config)#interface fastethernet 0/2SW2(config-if)#switchport mode accessSW2(config-if)#switchport access vlan 100SW2(config-if)#exitSW2(config)#interface fastethernet 0/3SW2(config-if)#switchport mode accessSW2(config-if)#switchport access vlan 200SW2(config-if)#exitSW2(config)#interface fastethernet 0/10SW2(config-if)#switchport mode trunkSW2(config-if)#switchport trunk encapsulation dot1qSW2(config-if)#endSW2#SW2#SW2#show interface fastethernet 0/2FastEthernet0/2 is up, line protocol is upHardware is Fast Ethernet, address is 000C.2018.9057 (bia 000C.2018.9057) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW2#SW2#SW2#show interface fastethernet 0/3FastEthernet0/3 is up, line protocol is upHardware is Fast Ethernet, address is 000C.4287.4991 (bia 000C.4287.4991) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW2#SW2#SW2#show interface fastethernet 0/10FastEthernet0/10 is up, line protocol is upHardware is Fast Ethernet, address is 000C.3817.8412 (bia 000C.3817.8412) MTU 1500 bytes, BW 10000 Kbit, DL Y 1000 usec,reliability 255/255, txload 1/255, rxload 1/255Auto-duplex, Auto-speedEncapsulation ARPA, loopback not setARP type: ARPA, ARP Timeout 04:00:00Last input 02:29:44, output never, output hang neverLast clearing of "show interface" counters neverInput queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0 Queueing strategy: fifoOutput queue :0/40 (size/max)5 minute input rate 0 bits/sec, 0 packets/sec5 minute output rate 0 bits/sec, 0 packets/sec269 packets input, 71059 bytes, 0 no bufferReceived 6 broadcasts, 0 runts, 0 giants, 0 throttles0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored7290 packets output, 429075 bytes, 0 underruns0 output errors, 3 interface resets0 output buffer failures, 0 output buffers swapped outSW2#SW2#SW2#show vlanVLAN Name Status Ports---- -------------------------------- --------- -------------------------------1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6Fa0/7, Fa0/8, Fa0/9, Fa0/10Fa0/11, Fa0/12100 Pcontrol active Fa0/2200 Accout active Fa0/31002 fddi-default active1003 token-ring-default active1004 fddinet-default active1005 trnet-default activeVLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------1 enet 100001 1500 - - - - - 0 0100 enet 100100 1500 - - - - - 0 0200 enet 100200 1500 - - - - - 0 01002 fddi 101002 1500 - - - - - 0 01003 tr 101003 1500 - - - - - 0 01004 fdnet 101004 1500 - - - ieee - 0 01005 trnet 101005 1500 - - - ibm - 0 0SW2#SW2#SW2#show mac-address-tableVLAN Name Status Ports---- -------------------------------- --------- -------------------------------1 default active Fa0/1, Fa0/4, Fa0/5, Fa0/6Fa0/7, Fa0/8, Fa0/9, Fa0/10Fa0/11, Fa0/12100 Pcontrol active Fa0/2200 Accout active Fa0/31002 fddi-default active1003 token-ring-default active1004 fddinet-default active1005 trnet-default activeVLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2 ---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------1 enet 100001 1500 - - - - - 0 0100 enet 100100 1500 - - - - - 0 0 200 enet 100200 1500 - - - - - 0 0 1002 fddi 101002 1500 - - - - - 0 0 1003 tr 101003 1500 - - - - - 0 0 1004 fdnet 101004 1500 - - - ieee - 0 0 1005 trnet 101005 1500 - - - ibm - 0 0Mac Address Table------------------------------------------Vlan Mac Address Type Ports---- ----------- ---- -----200 000C.1738.3819 DYNAMIC Fa0/3100 000C.9623.5011 DYNAMIC Fa0/21 000C.3878.9745 DYNAMIC Fa0/101 000C.7036.8702 DYNAMIC Fa0/101 000C.9631.1997 DYNAMIC Fa0/10Total Mac Addresses for this criterion: 5SW2#SW2#SW2#show runn!Version 12.1service timestamps debug uptimeservice timestamps log uptimeno service password-encryption!hostname SW2enable secret 5 $sdf$6978yhg$jnb76sd!!!ip subnet-zerospanning-tree extend system-id!!!!!!!!interface FastEthernet0/1!interface FastEthernet0/2 switchport mode access switchport access vlan 100!interface FastEthernet0/3 switchport mode access switchport access vlan 200!interface FastEthernet0/4!interface FastEthernet0/5!interface FastEthernet0/6!interface FastEthernet0/7!interface FastEthernet0/8!interface FastEthernet0/9!interface FastEthernet0/10 switchport mode trunkswitchport trunk encapsulation dot1q !interface FastEthernet0/11!interface FastEthernet0/12!vtp domain bigdomain!interface Vlan 1no ip addressno ip route-cache!vlan 100 name Pcontrolvlan 200 name Accout!ip classlessno ip http server!!!!line con 0logintransport input nonepassword dsfengexec-timeout 15 0logging synchronousline aux 0line vty 0 15loginpassword dsfeng!no scheduler allocateendSW2#SW2#SW2#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]SW2#SW2#PC1测试结果:Boson BOSS 5.0Copyright 1998-2005 Boson Software, Inc.Use the command help to get startedPress Enter to beginC:>C:>ipconfig /ip 192.168.1.1 255.255.255.0C:>ping 192.168.1.2Pinging 192.168.1.2 with 32 bytes of data:Reply from 192.168.1.2: bytes=32 time=60ms TTL=241 Reply from 192.168.1.2: bytes=32 time=60ms TTL=241Reply from 192.168.1.2: bytes=32 time=60ms TTL=241Reply from 192.168.1.2: bytes=32 time=60ms TTL=241Reply from 192.168.1.2: bytes=32 time=60ms TTL=241Ping statistics for 192.168.1.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:Minimum = 50ms, Maximum = 60ms, Average = 55msPC2测试结果:Boson BOSS 5.0Copyright 1998-2005 Boson Software, Inc.Use the command help to get startedPress Enter to beginC:>ipconfig /ip 192.168.10.1 255.255.255.0C:>C:>ping 192.168.10.2Pinging 192.168.10.2 with 32 bytes of data:Reply from 192.168.10.2: bytes=32 time=60ms TTL=241Reply from 192.168.10.2: bytes=32 time=60ms TTL=241Reply from 192.168.10.2: bytes=32 time=60ms TTL=241Reply from 192.168.10.2: bytes=32 time=60ms TTL=241Reply from 192.168.10.2: bytes=32 time=60ms TTL=241Ping statistics for 192.168.10.2: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:Minimum = 50ms, Maximum = 60ms, Average = 55msPC3测试结果:Boson BOSS 5.0Copyright 1998-2005 Boson Software, Inc.Use the command help to get startedPress Enter to beginC:>ipconfig /ip 192.168.1.2 255.255.255.0C:>ping 192.168.1.1Pinging 192.168.1.1 with 32 bytes of data:Reply from 192.168.1.1: bytes=32 time=60ms TTL=241Reply from 192.168.1.1: bytes=32 time=60ms TTL=241Reply from 192.168.1.1: bytes=32 time=60ms TTL=241Reply from 192.168.1.1: bytes=32 time=60ms TTL=241Reply from 192.168.1.1: bytes=32 time=60ms TTL=241Ping statistics for 192.168.1.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:Minimum = 50ms, Maximum = 60ms, Average = 55msPC4测试结果:Boson BOSS 5.0Copyright 1998-2005 Boson Software, Inc.Use the command help to get startedPress Enter to beginC:>ipconfig /ip 192.168.10.2 255.255.255.0C:>ping 192.168.10.1Pinging 192.168.10.1 with 32 bytes of data:Reply from 192.168.10.1: bytes=32 time=60ms TTL=241Reply from 192.168.10.1: bytes=32 time=60ms TTL=241Reply from 192.168.10.1: bytes=32 time=60ms TTL=241Reply from 192.168.10.1: bytes=32 time=60ms TTL=241Reply from 192.168.10.1: bytes=32 time=60ms TTL=241Ping statistics for 192.168.10.1: Packets: Sent = 5, Received = 5, Lost = 0 (0% loss), Approximate round trip times in milli-seconds:Minimum = 50ms, Maximum = 60ms, Average = 55ms。
基于trunk端口划分vlan的基本配置基于trunk端口划分VLAN的基本配置是网络管理员必须了解和掌握的重要技能之一。
VLAN(虚拟局域网)是一种将物理网络划分成逻辑上独立的多个网络的技术。
通过将不同的设备和用户分配到不同的VLAN中,可以实现网络资源的灵活分配和管理。
本文将以基于trunk端口划分VLAN的基本配置为主题,逐步回答相关问题,帮助读者了解和掌握这一技能。
一、什么是trunk端口?Trunk端口是一种可以传输多个VLAN数据的端口。
它可以将来自不同VLAN的数据打包封装,通过一个物理链路传输到其他设备,从而实现VLAN之间的通信。
二、为什么需要使用trunk端口?在实际网络中,通常会有多个VLAN,而这些VLAN之间需要进行通信。
如果不使用trunk端口,每个VLAN将被限制在各自的物理链路中,无法实现互相连接。
而使用trunk端口,能够将多个VLAN的数据打包封装在一个物理链路中传输,从而提高网络的灵活性和可管理性。
三、如何配置trunk端口划分VLAN?1. 确认网络拓扑:首先,需要了解网络的拓扑结构,包括设备和链路的连接关系。
2. 配置VLAN:在交换机上创建所需的VLAN,可以通过VLAN ID来标识不同的VLAN。
3. 配置trunk端口:确定哪些端口需要配置为trunk端口。
进入交换机的配置模式,找到相应的端口,输入命令“switchport mode trunk”来将端口配置为trunk模式。
4. 配置允许的VLAN:在trunk端口上,需要配置允许传输的VLAN。
可以使用命令“switchport trunk allowed vlan”+“VLAN ID”的方式来配置允许传输的VLAN,可以同时配置多个VLAN。
5. 验证配置:使用命令“show interfaces trunk”来验证trunk端口的配置,确认配置已经生效。
四、trunk端口配置注意事项1. 确保网络拓扑准确无误:配置trunk端口前,必须清楚网络的拓扑结构,确保理解了各个设备和链路的连接关系,避免配置错误。
配置要求:PC1与PC3之间互通,PC2/PC4之间能互通,PC1与PC2/PC4不能互通,PC2与PC1、PC3不能互通。
LSW1:The device is running!<Huawei><Huawei>u t mInfo: Current terminal monitor is off.<Huawei><Huawei>system-view (进入全局配置模式)Enter system view, return user view with Ctrl+Z.[Huawei][Huawei][Huawei]sy[Huawei]sysname SW1(命名)[SW1][SW1]vlan b[SW1]vlan batch 10 20 (批量创建vlan)Info: This operation may take a few seconds. Please wait for a moment...done.[SW1][SW1]int g[SW1]int GigabitEthernet 0/0/2[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]port[SW1-GigabitEthernet0/0/2]port link-type?link-type[SW1-GigabitEthernet0/0/2]port link-type ?access Access portdot1q-tunnel QinQ porthybrid Hybrid porttrunk Trunk port[SW1-GigabitEthernet0/0/2]port link-type a[SW1-GigabitEthernet0/0/2]port link-type access (配置交换机接口类型Access)[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]port d?default discard[SW1-GigabitEthernet0/0/2]port de[SW1-GigabitEthernet0/0/2]port default vl[SW1-GigabitEthernet0/0/2]port default vlan 10 (将接口加入到vlan)[SW1-GigabitEthernet0/0/2][SW1-GigabitEthernet0/0/2]dis this (查看当前配置)#interface GigabitEthernet0/0/2port link-type accessport default vlan 10#return[SW1-GigabitEthernet0/0/2]q[SW1][SW1]int g[SW1]int GigabitEthernet 0/0/3[SW1-GigabitEthernet0/0/3][SW1-GigabitEthernet0/0/3]po[SW1-GigabitEthernet0/0/3]port li[SW1-GigabitEthernet0/0/3]port link-t[SW1-GigabitEthernet0/0/3]port link-type a[SW1-GigabitEthernet0/0/3]port link-type access[SW1-GigabitEthernet0/0/3][SW1-GigabitEthernet0/0/3]po[SW1-GigabitEthernet0/0/3]port d[SW1-GigabitEthernet0/0/3]port de[SW1-GigabitEthernet0/0/3]port default vlan 20[SW1-GigabitEthernet0/0/3][SW1-GigabitEthernet0/0/3]dis this#interface GigabitEthernet0/0/3port link-type accessport default vlan 20#return[SW1-GigabitEthernet0/0/3][SW1-GigabitEthernet0/0/3][SW1-GigabitEthernet0/0/3]q[SW1][SW1][SW1][SW1]int[SW1]interface g[SW1]interface GigabitEthernet 0/0/1[SW1-GigabitEthernet0/0/1]port link-t[SW1-GigabitEthernet0/0/1]port link-type t[SW1-GigabitEthernet0/0/1]port link-type trunk (配置接口类型:trunk)[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]Mar 13 2017 16:55:39-08:00 SW1 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.191.3.1 configurations have been changed. The current change number is 11, thechange loop count is 0, and the maximum number of records is 4095.[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]dis this (查当前配置)#interface GigabitEthernet0/0/1port link-type trunk#return[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]port t[SW1-GigabitEthernet0/0/1]port trunk ?allow-pass Allowed vlanpvid Specify current port's PVID VLAN characteristics[SW1-GigabitEthernet0/0/1]port trunk all[SW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 (允许当前vlan通过此接口)[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]dis this#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 10 20#return[SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1][SW1-GigabitEthernet0/0/1]q[SW1][SW1][SW1][SW1]q<SW1>sa (保存配置)The current configuration will be written to the device.Are you sure to continue?[Y/N]yInfo: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:Mar 13 2017 17:01:30-08:00 SW1 %%01CFM/4/SAVE(l)[0]:The user chose Y when decidi ng whether to save the configuration to the device.<SW1><SW1>dis<SW1>display por<SW1>display port v<SW1>display port vlan (查看vlan接口类型)Port Link Type PVID Trunk VLAN List-------------------------------------------------------------------------------GigabitEthernet0/0/1 trunk 1 1 10 20GigabitEthernet0/0/2 access 10 -GigabitEthernet0/0/3 access 20 -GigabitEthernet0/0/4 hybrid 1 -GigabitEthernet0/0/5 hybrid 1 -GigabitEthernet0/0/6 hybrid 1 -GigabitEthernet0/0/7 hybrid 1 -GigabitEthernet0/0/8 hybrid 1 -GigabitEthernet0/0/9 hybrid 1 -GigabitEthernet0/0/10 hybrid 1 -GigabitEthernet0/0/11 hybrid 1 -GigabitEthernet0/0/12 hybrid 1 -GigabitEthernet0/0/13 hybrid 1 -GigabitEthernet0/0/14 hybrid 1 -GigabitEthernet0/0/15 hybrid 1 -GigabitEthernet0/0/16 hybrid 1 -GigabitEthernet0/0/17 hybrid 1 -GigabitEthernet0/0/18 hybrid 1 -GigabitEthernet0/0/19 hybrid 1 -GigabitEthernet0/0/20 hybrid 1 -GigabitEthernet0/0/21 hybrid 1 -GigabitEthernet0/0/22 hybrid 1 -GigabitEthernet0/0/23 hybrid 1 -GigabitEthernet0/0/24 hybrid 1 -<SW1><SW1><Huawei><Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei][Huawei][SW1][SW1]dis int br (查看接口情况)PHY: Physical*down: administratively down(l): loopback(s): spoofing(b): BFD down(e): ETHOAM down(dl): DLDP down(d): Dampening SuppressedInUti/OutUti: input utility/output utilityInterface PHY Protocol InUti OutUti inErrors outErrors GigabitEthernet0/0/1 up up 0% 0% 0 0 GigabitEthernet0/0/2 up up 0% 0% 0 0 GigabitEthernet0/0/3 up up 0% 0% 0 0 GigabitEthernet0/0/4 down down 0% 0% 0 0 GigabitEthernet0/0/5 down down 0% 0% 0 0 GigabitEthernet0/0/6 down down 0% 0% 0 0 GigabitEthernet0/0/7 down down 0% 0% 0 0 GigabitEthernet0/0/8 down down 0% 0% 0 0 GigabitEthernet0/0/9 down down 0% 0% 0 0 GigabitEthernet0/0/10 down down 0% 0% 0 0 GigabitEthernet0/0/11 down down 0% 0% 0 0 GigabitEthernet0/0/12 down down 0% 0% 0 0 GigabitEthernet0/0/13 down down 0% 0% 0 0 GigabitEthernet0/0/14 down down 0% 0% 0 0 GigabitEthernet0/0/15 down down 0% 0% 0 0 GigabitEthernet0/0/16 down down 0% 0% 0 0 GigabitEthernet0/0/17 down down 0% 0% 0 0 GigabitEthernet0/0/18 down down 0% 0% 0 0 GigabitEthernet0/0/19 down down 0% 0% 0 0 GigabitEthernet0/0/20 down down 0% 0% 0 0 GigabitEthernet0/0/21 down down 0% 0% 0 0 GigabitEthernet0/0/22 down down 0% 0% 0 0 GigabitEthernet0/0/23 down down 0% 0% 0 0 GigabitEthernet0/0/24 down down 0% 0% 0 0 MEth0/0/1 down down 0% 0% 0 0 NULL0 up up(s) 0% 0% 0 0 Vlanif1 up down -- -- 0 0[SW1][SW1][SW1] User interface con0 is availablePlease Press ENTER.---------------------------------------------------------------------------------------------------LSW2The device is running!<Huawei><Huawei>u t mInfo: Current terminal monitor is off.<Huawei><Huawei>sy<Huawei>system-viewEnter system view, return user view with Ctrl+Z.[Huawei][Huawei]sys SW2[SW2][SW2][SW2]v[SW2]vlan b[SW2]vlan batch 10 20Info: This operation may take a few seconds. Please wait for a moment...done. [SW2][SW2][SW2]dis[SW2]display po[SW2]display por[SW2]display port ?vlan Virtual LAN[SW2]display port v[SW2]display port vlanPort Link Type PVID Trunk VLAN List------------------------------------------------------------------------------- GigabitEthernet0/0/1 hybrid 1 -GigabitEthernet0/0/2 hybrid 1 -GigabitEthernet0/0/3 hybrid 1 -GigabitEthernet0/0/4 hybrid 1 -GigabitEthernet0/0/5 hybrid 1 -GigabitEthernet0/0/6 hybrid 1 -GigabitEthernet0/0/7 hybrid 1 -GigabitEthernet0/0/8 hybrid 1 -GigabitEthernet0/0/9 hybrid 1 -GigabitEthernet0/0/10 hybrid 1 -GigabitEthernet0/0/11 hybrid 1 -GigabitEthernet0/0/12 hybrid 1 -GigabitEthernet0/0/13 hybrid 1 -GigabitEthernet0/0/14 hybrid 1 -GigabitEthernet0/0/15 hybrid 1 -GigabitEthernet0/0/16 hybrid 1 -GigabitEthernet0/0/17 hybrid 1 -GigabitEthernet0/0/18 hybrid 1 -GigabitEthernet0/0/19 hybrid 1 -GigabitEthernet0/0/20 hybrid 1 -GigabitEthernet0/0/21 hybrid 1 -GigabitEthernet0/0/22 hybrid 1 -GigabitEthernet0/0/23 hybrid 1 -GigabitEthernet0/0/24 hybrid 1 -[SW2][SW2][SW2]vlan b[SW2]vlan batch 10 20Info: This operation may take a few seconds. Please wait for a moment...done. [SW2][SW2][SW2][SW2]int g[SW2]int GigabitEthernet 0/0/1[SW2-GigabitEthernet0/0/1][SW2-GigabitEthernet0/0/1]por[SW2-GigabitEthernet0/0/1]port lin[SW2-GigabitEthernet0/0/1]port link-t[SW2-GigabitEthernet0/0/1]port link-type t[SW2-GigabitEthernet0/0/1]port link-type trunk[SW2-GigabitEthernet0/0/1][SW2-GigabitEthernet0/0/1]por[SW2-GigabitEthernet0/0/1]port t[SW2-GigabitEthernet0/0/1]port trunk ?allow-pass Allowed vlanpvid Specify current port's PVID VLAN characteristics[SW2-GigabitEthernet0/0/1]port trunk a[SW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20[SW2-GigabitEthernet0/0/1][SW2-GigabitEthernet0/0/1]dis this#interface GigabitEthernet0/0/1port link-type trunkport trunk allow-pass vlan 10 20#return[SW2-GigabitEthernet0/0/1]q[SW2][SW2][SW2]int g0/0/2[SW2-GigabitEthernet0/0/2]por[SW2-GigabitEthernet0/0/2]port lin[SW2-GigabitEthernet0/0/2]port link-t[SW2-GigabitEthernet0/0/2]port link-type a [SW2-GigabitEthernet0/0/2]port link-type access [SW2-GigabitEthernet0/0/2][SW2-GigabitEthernet0/0/2]por[SW2-GigabitEthernet0/0/2]port de[SW2-GigabitEthernet0/0/2]port default v [SW2-GigabitEthernet0/0/2]port default vlan 10 [SW2-GigabitEthernet0/0/2][SW2-GigabitEthernet0/0/2]dis this#interface GigabitEthernet0/0/2port link-type accessport default vlan 10#return[SW2-GigabitEthernet0/0/2]q[SW2][SW2][SW2][SW2]int g0/0/3[SW2-GigabitEthernet0/0/3][SW2-GigabitEthernet0/0/3]por[SW2-GigabitEthernet0/0/3]port lin[SW2-GigabitEthernet0/0/3]port link-t[SW2-GigabitEthernet0/0/3]port link-type a [SW2-GigabitEthernet0/0/3]port link-type access [SW2-GigabitEthernet0/0/3][SW2-GigabitEthernet0/0/3]por[SW2-GigabitEthernet0/0/3]port de[SW2-GigabitEthernet0/0/3]port default v[SW2-GigabitEthernet0/0/3]port default vlan 20[SW2-GigabitEthernet0/0/3][SW2-GigabitEthernet0/0/3]dis this#interface GigabitEthernet0/0/3port link-type accessport default vlan 20#return[SW2-GigabitEthernet0/0/3]q[SW2][SW2][SW2]dis[SW2]display po[SW2]display por[SW2]display port v[SW2]display port vlanPort Link Type PVID Trunk VLAN List ------------------------------------------------------------------------------- GigabitEthernet0/0/1 trunk 1 1 10 20 GigabitEthernet0/0/2 access 10 - GigabitEthernet0/0/3 access 20 - GigabitEthernet0/0/4 hybrid 1 - GigabitEthernet0/0/5 hybrid 1 - GigabitEthernet0/0/6 hybrid 1 - GigabitEthernet0/0/7 hybrid 1 - GigabitEthernet0/0/8 hybrid 1 - GigabitEthernet0/0/9 hybrid 1 - GigabitEthernet0/0/10 hybrid 1 - GigabitEthernet0/0/11 hybrid 1 - GigabitEthernet0/0/12 hybrid 1 - GigabitEthernet0/0/13 hybrid 1 - GigabitEthernet0/0/14 hybrid 1 - GigabitEthernet0/0/15 hybrid 1 - GigabitEthernet0/0/16 hybrid 1 - GigabitEthernet0/0/17 hybrid 1 - GigabitEthernet0/0/18 hybrid 1 - GigabitEthernet0/0/19 hybrid 1 - GigabitEthernet0/0/20 hybrid 1 - GigabitEthernet0/0/21 hybrid 1 - GigabitEthernet0/0/22 hybrid 1 -GigabitEthernet0/0/23 hybrid 1 -GigabitEthernet0/0/24 hybrid 1 -[SW2]q<SW2><SW2>saThe current configuration will be written to the device.Are you sure to continue?[Y/N]yInfo: Please input the file name ( *.cfg, *.zip ) [vrpcfg.zip]:Now saving the current configuration to the slot 0.Save the configuration successfully.<SW2><SW2>----------------------------------------------------------------------------------------------------- ping测试。
实验报告班级组号05 联络人组长同组人组成员课程名称计算机网络实验日期10月16日实验名称实验三 Vlan配置和eth-trunk配置成绩实验目的:1.掌握vlan的配置,掌握端口的类型,以及各种端口类型下的vlan配置;2.掌握Eth-trunk的配置,能够创建eth-trunk,并增加eth-trunk成员。
实验条件:计算机、eNSP实验内容:实验拓扑图如下:实验思路:要在各个交换机上配置vlan,SWC的interface Ethernet0/0/1只能通过vlan 10,interface Ethernet0/0/2只能通过vlan 20,其他接口都能通过vlan 10 20.即如下:[SWA]vlan batch 10 20[SWB]vlan batch 10 20[SWC]vlan batch 10 20实验步骤:配置交换机SWC的接口类型以及相应的vlaninterface Ethernet0/0/1要用access型接口,因为它连接的是一台PC机。
它的缺省vlan即为所在vlan。
interface Ethernet0/0/2和接口interface Ethernet0/0/1一样,不同的是它的缺省vlan为20.interface Ethernet0/0/3要用trunk型接口,因为它连接的是交换机。
配置交换机SWA(SWB)时要用到eth-trunkEth-trunk:将多个以太网接口捆绑形成一个逻辑接口以增大带宽和提高设备之间链路的可靠性,保证流量的可靠传输。
配置交换机SWA的接口类型以及相应的vlan(SWB同SWA)interface Ethernet0/0/1要用trunk型接口,因为它连接的是交换机。
interface Ethernet0/0/2和interface Ethernet0/0/3要形成一个逻辑接口eth-trunk,以此来增加带宽,保证可靠性。
测试:SWCSWA(SWB同SWA)Eth-trunk。