思路:
lsw1:
[lsw1]vlan batch 2 to 6---批量创建VLAN
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw1]
lw2:
[lsw2]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw2]
lsw3:
[lsw3]vlan batch 2 to 6
Info: This operation may take a few seconds. Please wait for a moment...done.
[lsw3]
lsw1:
[lsw1]int g 0/0/1
[lsw1-GigabitEthernet0/0/1]port link-type access----接口类型为access类型
[lsw1-GigabitEthernet0/0/1]port default vlan 2----接口划入VLAN 2
[lsw1-GigabitEthernet0/0/1]
[lsw1-GigabitEthernet0/0/1]int g 0/0/2
[lsw1-GigabitEthernet0/0/2]port link-type hybrid ----使用混杂模式
[lsw1-GigabitEthernet0/0/2]port hybrid pvid vlan 3 ---将接口划入VLAN 3
[lsw1-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5 6----3、4、5、6不带标签,
[lsw1-GigabitEthernet0/0/2]
[lsw1-GigabitEthernet0/0/2]int g 0/0/3
[lsw1-GigabitEthernet0/0/3]port link-type trunk ---使用trunk接口
[lsw1-GigabitEthernet0/0/3]port trunk allow-pass vlan all ---允许所有的VLAN通过
[lsw1-GigabitEthernet0/0/3]
[lsw1-GigabitEthernet0/0/3]int g 0/0/4
[lsw1-GigabitEthernet0/0/4]port link-type hybrid
[lsw1-GigabitEthernet0/0/4]port hybrid tagged vlan 2----VLAN 2 带上标签
[lsw1-GigabitEthernet0/0/4]port hybrid untagged vlan 3 4 5 6
[lsw1-GigabitEthernet0/0/4]
lsw2:
[lsw2]int g 0/0/1
[lsw2-GigabitEthernet0/0/1]port link-type access
[lsw2-GigabitEthernet0/0/1]port default vlan 2
[lsw2-GigabitEthernet0/0/1]
[lsw2]int g 0/0/1
[lsw2-GigabitEthernet0/0/1]port link-type access
[lsw2-GigabitEthernet0/0/1]port default vlan 2
[lsw2-GigabitEthernet0/0/1]int g 0/0/2
[lsw2-GigabitEthernet0/0/2]port link-type hybrid
[lsw2-GigabitEthernet0/0/2]port hybrid pvid vlan 4
[lsw2-GigabitEthernet0/0/2]port hybrid untagged vlan 3 4 5
[lsw2-GigabitEthernet0/0/2]int g 0/0/3
[lsw2-GigabitEthernet0/0/3]port link-type trunk
[lsw2-GigabitEthernet0/0/3]port trunk allow-pass vlan all
[lsw2-GigabitEthernet0/0/3]
[lsw2]int g 0/0/4
[lsw2-GigabitEthernet0/0/4]port link-type trunk
[lsw2-GigabitEthernet0/0/4]port trunk allow-pass vlan all
[lsw2-GigabitEthernet0/0/4]
lsw3:
[lsw3]int g 0/0/1
[lsw3-GigabitEthernet0/0/1]port link-type hybrid
[lsw3-GigabitEthernet0/0/1]port hybrid pvid vlan 5
[lsw3-GigabitEthernet0/0/1]port hybrid untagged vlan 3 4 5
[lsw3-GigabitEthernet0/0/1]
[lsw3-GigabitEthernet0/0/1]int g 0/0/2
[lsw3-GigabitEthernet0/0/2]port link-type hybrid
[lsw3-GigabitEthernet0/0/2]port hybrid pvid vlan 6
[lsw3-GigabitEthernet0/0/2]port hybrid untagged vlan 3 6
[lsw3-GigabitEthernet0/0/2]
[lsw3-GigabitEthernet0/0/2]int g 0/0/3
[lsw3-GigabitEthernet0/0/3]port link-type trunk
[lsw3-GigabitEthernet0/0/3]port trunk allow-pass vlan all
R1:
[r1]int g 0/0/0.1----创建子接口
[r1-GigabitEthernet0/0/0.1]ip address 192.168.1.1 24
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2---划入VLAN 2 的范围
[r1-GigabitEthernet0/0/0.1]arp broadcast enable ----开启广播
[r1-GigabitEthernet0/0/0.1]
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip address 192.168.2.1 24
[r1]dhcp enable ----开启DHCP
[r1]ip pool aa---创建aa的地址池
[r1-ip-pool-aa]network 192.168.1.0 mask 24
[r1-ip-pool-aa]gateway-list 192.168.1.1
[r1-ip-pool-aa]dns-list 114.114.114.114
[r1-ip-pool-aa]
[r1-ip-pool-aa]q
[r1]ip pool bb
[r1-ip-pool-bb]network 192.168.2.0 mask 24
[r1-ip-pool-bb]gateway-list 192.168.2.1
[r1-ip-pool-bb]dns-list 114.114.114.114
[r1]int g 0/0/0.1
[r1-GigabitEthernet0/0/0.1]dhcp select global ----开启全局模式
[r1-GigabitEthernet0/0/0.1]q
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]dhcp select global
点击DHCP,选择应用
:
PC1访问PC2/3/4/5/6
PC2访问PC4/5/6
PC3访问PC2/1/4/5/6
PC4可以访问PC5,但是不能访问PC6
PC5不能访问PC6