PC5-9 ip分別爲 10.1.1.1( 2 3 4 5 )ide
[LSW3]vlan 10 # 兩種建立vlan方法 [LSW3]vlan 20 [LSW4]vlan batch 30 40 dis vlan # 用來查看vlan信息 LSW3 # 配置LSW3交換機劃分vlan10 、20 system-view int eth0/0/1 port link-type access port default vlan 10 int eth0/0/2 port link-type access port default vlan 10 int eth0/0/3 port link-type access port default vlan 20 LSW4 # 配置LSW4交換機劃分vlan30、40 sys int eth0/0/1 port link-type access port default vlan 30 int eth0/0/2 port link-type access port default vlan 40
pc 1-4 ip 爲 10.1.1.1(2 3 4)spa
首先建立vlan LSW2 #研發部屬於vlan10 市場部屬於vlan 20 vlan 10 description R¥D vlan 20 description Market 其他兩臺同理 用 display vlan 或 displayvlan summary 查看配置的vlan信息 配置交換機與pc機的access接口而且劃分vlan LSW2 sys int eth0/0/2 port link-ty access port default vlan10 int eth0/0/3 port link-type access port default vlan 20 另外一臺同理 display port vlan #用來檢查valn和接口的配置
此時 PC1與PC3 ,PC2 與PC4 沒法ping通 ,由於交換機與交換機之間相連的接口上沒有相應的vlan信息, 不識別和發送跨越交換機的報文,此時vlan只具備每臺交換機的本地意義,沒法實現相同vlan的跨交換機通訊, 此時須要將交換機之間相連的接口配置爲trunk接口,過程以下:
LSW2 int eth0/0/1 port link-type trunk port trunk allow-pass vlan 10 20 LSW3 int eth0/0/2 port link-type trunk port trunk allow-pass vlan 10 20 LSW1 int GE0/0/1 port link-type trunk port trunk allow-pass vlan all int GE0/0/2 port link-type trunk port trunk allow-pass vlan all dispaly port vlan 檢查
PC1 ping PC33d
成功!code
PC1.2.3.4 ip 爲192.168.1.1,2,3,4 PC5 ip 192.168.1.100
要求:市場部與產品部只能各自通訊,IT部門能夠和任意主機通訊blog
S1 vlan batch 10 20 30 int e0/0/1 port link-ty hybrid port hybrid tagged vlan 10 20 30 int e0/0/2 port link-ty hybrid port hybrid untagged vlan 20 30 port hybrid pvid vlan 20 int e0/0/3 port link-ty hybrid port hybrid untagged vlan 10 30 port hybrid pvid vlan 10 int e0/0/4 port link-ty hybrid port hybrid pvid vlan 30 port hybrid untagged vlan 10 20 30 S2 vlan batch 10 20 30 int e0/0/1 port link-ty hybrid port hybrid tagged vlan 10 20 30 int e0/0/2 port link-ty hybrid port hybrid untagged vlan 20 30 port hybrid pvid vlan 20 int e0/0/3 port link-ty hybrid port hybrid untagged vlan 10 30 port hybrid pvid vlan 10 20 30
在配置S2時沒有建立vlan30,致使PC5 沒法ping通PC3 PC4接口