本文共 2094 字,大约阅读时间需要 6 分钟。
PC5-9 ip分别为 10.1.1.1( 2 3 4 5 )
[LSW3]vlan 10 # 两种创建vlan方法[LSW3]vlan 20[LSW4]vlan batch 30 40dis vlan # 用来查看vlan信息LSW3 # 配置LSW3交换机划分vlan10 、20system-viewint eth0/0/1port link-type accessport default vlan 10int eth0/0/2port link-type accessport default vlan 10int eth0/0/3port link-type accessport default vlan 20LSW4 # 配置LSW4交换机划分vlan30、40sysint eth0/0/1port link-type accessport default vlan 30int eth0/0/2port link-type accessport default vlan 40
首先创建vlanLSW2 #研发部属于vlan10 市场部属于vlan 20vlan 10 description R¥D vlan 20description Market其余两台同理用 display vlan 或 displayvlan summary 查看配置的vlan信息配置交换机与pc机的access接口并且划分vlanLSW2sysint eth0/0/2port link-ty access port default vlan10int eth0/0/3port link-type accessport default vlan 20另一台同理display port vlan #用来检查valn和接口的配置
此时 PC1与PC3 ,PC2 与PC4 无法ping通 ,因为交换机与交换机之间相连的接口上没有相应的vlan信息,不识别和发送跨越交换机的报文,此时vlan只具有每台交换机的本地意义,无法实现相同vlan的跨交换机通信,此时需要将交换机之间相连的接口配置为trunk接口,过程如下:
LSW2int eth0/0/1port link-type trunkport trunk allow-pass vlan 10 20LSW3int eth0/0/2port link-type trunkport trunk allow-pass vlan 10 20LSW1int GE0/0/1port link-type trunkport trunk allow-pass vlan allint GE0/0/2port link-type trunkport trunk allow-pass vlan alldispaly port vlan 检查
PC1 ping PC3
成功!
PC1.2.3.4 ip 为192.168.1.1,2,3,4PC5 ip 192.168.1.100
要求:市场部与产品部只能各自通信,IT部门可以和任意主机通信
S1vlan batch 10 20 30int e0/0/1 port link-ty hybridport hybrid tagged vlan 10 20 30int e0/0/2port link-ty hybrid port hybrid untagged vlan 20 30port hybrid pvid vlan 20int e0/0/3port link-ty hybridport hybrid untagged vlan 10 30port hybrid pvid vlan 10int e0/0/4port link-ty hybridport hybrid pvid vlan 30port hybrid untagged vlan 10 20 30S2vlan batch 10 20 30int e0/0/1 port link-ty hybridport hybrid tagged vlan 10 20 30int e0/0/2port link-ty hybrid port hybrid untagged vlan 20 30port hybrid pvid vlan 20int e0/0/3port link-ty hybridport hybrid untagged vlan 10 30port hybrid pvid vlan 10 20 30
在配置S2时没有创建vlan30,导致PC5 无法ping通PC3 PC4
转载于:https://blog.51cto.com/13872978/2145997