项目3、虚拟局域网VLAN.ppt_第1页
项目3、虚拟局域网VLAN.ppt_第2页
项目3、虚拟局域网VLAN.ppt_第3页
项目3、虚拟局域网VLAN.ppt_第4页
项目3、虚拟局域网VLAN.ppt_第5页
已阅读5页,还剩30页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

虚拟局域网VLAN 主讲 张朋平湖职业中专 一 交换机端口隔离 交换网络中问题的解决 VLAN VLAN20 通过VLAN技术可以对网络进行一个安全的隔离 分割广播域 VLAN10 VLAN30 VLAN40 VLAN技术 VLAN VirtualLocalAreaNetwork 虚拟局域网 是指在一个物理网段内 进行逻辑的划分 划分成若干个虚拟局域网 VLAN最大的特性是不受物理位置的限制 可以进行灵活的划分 VLAN具备了一个物理网段所具备的特性 相同VLAN内的主机可以互相直接访问 不同VLAN间的主机之间互相访问必须经由路由设备进行转发 广播数据包只可以在本VLAN内进行传播 不能传输到其他VLAN中 VLAN的种类 基于端口的VLANPortVlan是实现VLAN的方式之一 PortVlan是利用交换机的端口进行VLAN的划分基于MAC地址的VLAN这种划分VLAN的方法是根据每个主机的MAC地址来划分 即对每个MAC地址的主机都配置他属于哪个组 它实现的机制就是每一块网卡都对应唯一的MAC地址 VLAN交换机跟踪属于VLANMAC的地址 VLAN的类型 PortVLAN F0 1 F0 2 F0 3 基于交换机的端口 一个端口只属于一个VLAN PortVLAN设置在连接主机的端口 Port vlan原理 F0 1 F0 2 F0 3 A B C Vlan10 Vlan20 Vlan10 ABAC X 配置PortVLAN Access 创建VLAN10 将它命名为test的例子Switch configureterminalSwitch config vlan100Switch config vlan nametestSwitch config vlan end把ethernet0 10作为access口加入了VLAN100Switch configureterminalSwitch config interfacefastethernet0 10Switch config if switchportmodeaccessSwitch config if switchportaccessvlan100Switch config if end 将一组接口加入某一个VLANSwitch config interfacerangefastethernet0 1 10 0 15 0 20Switch config if range switchportaccessvlan20注 连续接口0 1 10 不连续接口用逗号隔开 但一定要写明模块编号 项目实施 项目拓扑 在未划VLAN前两台PC互相ping可以通 创建VLAN switch configureterminal 进入交换机全局配置模式switch config vlan10 创建vlan10switch config vlan nametest10 将Vlan10命名为test10switch config vlan20 创建vlan20switch config vlan nametest20 将Vlan20命名为test202 验证测试 switch showvlan 查看已配置的VLAN信息 VLANNameStatusPorts 1defaultstaticFa0 1 Fa0 2 Fa0 3Fa0 4 Fa0 5 Fa0 6Fa0 7 Fa0 8 Fa0 9Fa0 10 Fa0 11 Fa0 12Fa0 13 Fa0 14 Fa0 15Fa0 16 Fa0 17 Fa0 18Fa0 19 Fa0 20 Fa0 21Fa0 22 Fa0 23 Fa0 24 默认情况下所有接口都属于VLAN110test10static 创建的VLAN10 没有端口属于VLAN1020test20static 创建的VLAN20 没有端口属于VLAN20 将接口分配到VLAN switch configureterminalswitch config interfacefastethernet0 5switch config if switchportaccessvlan10 将fastethernet0 5端口加入vlan10中switch config if interfacefastethernet0 15switch config if switchportaccessvlan20 将fastethernet0 15端口加入vlan20中两台PC互相ping不通 3 验证测试 switch showvlanVLANNameStatusPorts 1defaultstaticFa0 2 Fa0 3 Fa0 4Fa0 6 Fa0 7 Fa0 8Fa0 9 Fa0 10 Fa0 11Fa0 12 Fa0 13 Fa0 14Fa0 15 Fa0 16 Fa0 17Fa0 18 Fa0 19 Fa0 20Fa0 21 Fa0 22 Fa0 23Fa0 2410test10staticFa0 520test20staticFa0 1 注意事项 1 交换机所有的端口在默认情况下属于ACCESS端口 可直接将端口加入某一VLAN 利用switchportmodeaccess trunk命令可以更改端口的VLAN模式 2 VLAN1属于系统的默认VLAN 不可以被删除3 删除某个VLAN 使用no命令 例如 switch config novlan104 删除当前某个VLAN时 注意先将属于该VLAN的端口加入别的VLAN 再删除VLAN 二 跨交换机实现VLAN划分 TagVlan是基于交换机端口的另外一种类型 主要用于实现跨交换机的相同VLAN内主机之间可以直接访问 同时对于不同VLAN的主机进行隔离 TagVlan遵循了IEEE802 1q协议的标准 在利用配置了Tagvlan的接口进行数据传输时 需要在数据帧内添加4个字节的802 1q标签信息 用于标识该数据帧属于哪个VLAN 以便于对端交换机接收到数据帧后进行准确的过滤 VLAN的类型 TagVLAN SwitchB VLAN30 VLAN20 VLAN10 TagVLAN 1 传输多个VLAN的信息2 实现同一VLAN跨越不同的交换机 在Trunk链路上传输多个VLAN信息要求Trunk至少要100M IEEE802 1Q数据帧 标记协议标识 TPID 固定值0 x8100 表示该帧载有802 1q标记信息标记控制信息 TCI Priority3比特表示优先级 Canonicalformatindicator1比特用于总线型以太网 FDDI 令牌环网 VlanID12比特表示VID 范围1 4094 目的 源MAC地址 类型 数据 重新计算帧检测序列 2字节标记协议标识2字节标记控制信息 802 1q工作原理 802 1q数据帧只在交换机的trunk链路上传输 对于用户是完全透明的 默认条件下 Trunk上会转发交换机上存在的所有VLAN的数据 A 交换机1 交换机2 B 数据帧 Tag标签 配置TagVLAN Trunk 把Fa0 1配成Trunk口Switch configureterminalSwitch config interfacefastethernet0 1Switch config if switchportmodetrunk NativeVLAN Switch config if switchporttrunknativevlan20Switch config if end每个Trunk口的缺省nativeVLAN是VLAN1 在配置Trunk链路时 请确保连接链路两端的Trunk口属于相同的nativeVLAN 配置TagVLAN Trunk 下面是一个把端口0 20配置为TRUNK端口 但是不包含VLAN2的例子 Switch config interfacefastethernet0 20Switch config if switchporttrunkallowedvlanremove2Switch config if end 项目实施 项目拓扑 PC1 192 168 10 10PC2 192 168 20 20PC1 192 168 10 30 1 设置3台PC机的IP地址2 按照拓扑结构图组网3 在交换机SwitchA上创建Vlan10 并将0 5端口划分到Vlan10中 SwitchA configureterminalSwitchA config vlan10SwitchA config vlan namesalesSwitchA config vlan exitSwitchA config interfacefastethernet0 5SwitchA config if switchportaccessvlan104 验证测试 验证已创建了Vlan10 并将0 5端口已划分到Vlan10中 SwitchA showvlanid10 查看某一个VLAN的信息VLANNameStatusPorts 10salesactiveFa0 5 5 在交换机switchA上创建Vlan20 并将0 15端口划分到Vlan20中 SwitchA config vlan20SwitchA config vlan nametechnicalSwitchA config vlan exitSwitchA config interfacefastethernet0 15SwitchA config if switchportaccessvlan206 验证测试 验证已创建了Vlan20 并将0 15端口已划分到Vlan20中 SwitchA showvlanid20VLANNameStatusPorts 20technicalactiveFa0 15 7 把交换机SwitchA与交换机SwitchB相连的端口 假设为0 24端口 定义为tagvlan模式 SwitchA config interfacefastethernet0 24SwitchA config if switchportmodetrunk 将fastethernet0 24端口设为tagvlan模式验证测试 验证fastethernet0 24端口已被设置为tagvlan模式 SwitchA showinterfacesfastEthernet0 24switchportInterfaceSwitchportModeAccessNativeProtectedVLANlists Fa0 24EnabledTrunk11DisabledALL注 交换机的Trunk接口默认情况下支持所有VLAN 8 在交换机SwitchB上创建Vlan10 并将0 5端口划分到Vlan10中 SwitchB configureterminalSwitchB config vlan10SwitchB config vlan namesalesSwitchB config vlan exitSwitchB config interfacefastethernet0 5SwitchB config if switchportaccessvlan109 验证测试 验证已在SwitchB上创建了Vlan10 并将0 5端口已划分到Vlan10中 SwitchB showvlanid10VLANNameStatusPorts 10salesactiveFa0 5 10 把交换机SwitchB与交换机SwitchA相连的端口 假设为0 24端口 定义为tagvlan模式 SwitchB config interfacefastethernet0 24SwitchB config if switchportmodetrunk11 验证测试 验证fastethernet0 24端口已被设置为tagvlan模式 SwitchB showinterfacesfastEthernet0 24switchportInterfaceSwitchportModeAccessNativeProtectedVLANlists Fa0 24EnabledTrunk11DisabledAll验证PC1与PC3能互相通信 但PC2与PC3不能互相通信 12 在PC1的cmd窗口下ping192 168 10 30 在PC1的命令行方式下验证能Ping通PC3Pinging192 168 10 30with32bytesofdata Replyfrom192 168 10 30 bytes 32time 10msTTL 128Replyfrom192 168 10 30 bytes 32time 10msTTL 128Replyfrom192 168 10 30 bytes 32time 10msTTL 128Replyfrom192 168 10 30 bytes 32time 10msTTL 128Pingstatisticsfor192 168 10 30 Packets Sent 4 Received 4 Lost 0 0 loss Approximateroundtriptimesinmilli seconds Minimum 0ms Maximum 0ms Average 0ms 13 在PC2的cmd窗口下ping192 168 10 30 在PC2的命令行方式下验证不能Ping通PC3Pinging192 168 10 30with3

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论