题目
拓扑图
PC1/3接口用access
创建WLAN
LSW1
创建WLAN
[lsw1]vlan batch 2 to 6
[lsw1-Ethernet0/0/1]p
[lsw1-Ethernet0/0/1]port l
[lsw1-Ethernet0/0/1]port link-
[lsw1-Ethernet0/0/1]port link-flap
[lsw1-Ethernet0/0/1]port link-type acc
[lsw1-Ethernet0/0/1]port link-type access
[lsw1-Ethernet0/0/1]po
[lsw1-Ethernet0/0/1]port
[lsw1-Ethernet0/0/1]por de
[lsw1-Ethernet0/0/1]port de
[lsw1-Ethernet0/0/1]port default vlan 2
[lsw1]int e0/0/3
[lsw1-Ethernet0/0/3]po
[lsw1-Ethernet0/0/3]port lin
[lsw1-Ethernet0/0/3]port link-
[lsw1-Ethernet0/0/3]port link-flap
[lsw1-Ethernet0/0/3]port link-type acc
[lsw1-Ethernet0/0/3]port link-type access
[lsw1-Ethernet0/0/3]port
[lsw1-Ethernet0/0/3]port de
[lsw1-Ethernet0/0/3]port default vlan 2
[lsw1-Ethernet0/0/3]
PC2/4/5/6用混杂 (hybird)
LSW1
[lsw1]int e0/0/2
[lsw1-Ethernet0/0/2]po
[lsw1-Ethernet0/0/2]port hy
[lsw1-Ethernet0/0/2]port hybrid pvid vlan 3
[lsw1-Ethernet0/0/2]port hybrid un
[lsw1-Ethernet0/0/2]port hybrid untagged vlan 2 to 6 #vlan2到6都能不加标签进入PC2
[lsw1-Ethernet0/0/2]
[lsw1]int e0/0/4
[lsw1-Ethernet0/0/4]po
[lsw1-Ethernet0/0/4]port hy
[lsw1-Ethernet0/0/4]port hybrid pvid vlan 4
[lsw1-Ethernet0/0/4]port hybrid pvid vlan 4
[lsw1-Ethernet0/0/4]port hybrid un
[lsw1-Ethernet0/0/4]port hybrid untagged vlan 2 to 4 #vlan2到4都能不加标签进入PC2,而vlan5、6无法进入
[lsw1-Ethernet0/0/4]
LSW2
创建WLAN
[lsw2]vlan batch 2 to 6
[lsw2]int e0/0/1
[lsw2-Ethernet0/0/1]port hybrid pvid vlan 5
[lsw2-Ethernet0/0/1]port hybrid un
[lsw2-Ethernet0/0/1]port hybrid untagged
[lsw2-Ethernet0/0/1]port hybrid untagged vlan 2 3 5 #只允许vlan2/3/5不加标签进入,其他vlan不行
[lsw2-Ethernet0/0/1]int e0/0/2
[lsw2-Ethernet0/0/2]
[lsw2-Ethernet0/0/2]po
[lsw2-Ethernet0/0/2]port hy
[lsw2-Ethernet0/0/2]port hybrid pvid vlan 6
[lsw2-Ethernet0/0/2]port hybrid un
[lsw2-Ethernet0/0/2]port hybrid untagged vlan 2 3 6 #只允许vlan2/3/6不加标签进入,其他vlan不行
[lsw2-Ethernet0/0/2]
配置trunk
LSW1
[lsw1]int e0/0/5
[lsw1-Ethernet0/0/5]po
[lsw1-Ethernet0/0/5]port hy
[lsw1-Ethernet0/0/5]port hybrid ta
[lsw1-Ethernet0/0/5]port hybrid tagged vlan 2 to 6 #允许vlan 2到6通过
[lsw1-Ethernet0/0/5]
[lsw1-Ethernet0/0/5]int e0/0/6
[lsw1-Ethernet0/0/6]po
[lsw1-Ethernet0/0/6]port hy
[lsw1-Ethernet0/0/6]port hybrid tag
[lsw1-Ethernet0/0/6]port hybrid tagged vlan 2 #允许vlan2带标签通过
[lsw1-Ethernet0/0/6]port hybrid un
[lsw1-Ethernet0/0/6]port hybrid untagged vlan
[lsw1-Ethernet0/0/6]port hybrid untagged vlan 3 to 6 #允许vlan3到6不带标签通过
[lsw1-Ethernet0/0/6]
LSW2
[lsw2-Ethernet0/0/2]int e0/0/3
[lsw2-Ethernet0/0/3]port hy
[lsw2-Ethernet0/0/3]port hybrid ta
[lsw2-Ethernet0/0/3]port hybrid tagged vlan 2 to 6 #允许vlan 2到6通过
[lsw2-Ethernet0/0/3]
开通DHCP自动获取IP地址
分为两个部分,应该是vlan2的,一个是vlan3到6的
[r1]dhcp en
[r1]dhcp enable
Info: The operation may take a few seconds. Please wait for a moment.done.
[r1]ip pool v2
Info: It's successful to create an IP address pool.
[r1-ip-pool-v2]net
[r1-ip-pool-v2]network 192.168.1.0 mask 24
[r1-ip-pool-v2]ga
[r1-ip-pool-v2]gateway-list 192.168.1.250
[r1-ip-pool-v2]q
[r1]ip pool v3to6
Info: It's successful to create an IP address pool.
[r1-ip-pool-v3to6]netw
[r1-ip-pool-v3to6]network 192.168.2.0 mask 24
[r1-ip-pool-v3to6]ga
[r1-ip-pool-v3to6]gateway-list 192.168.2.250
[r1-ip-pool-v3to6]q
# vlan2加标签的配置地址
[r1]int g0/0/0.1
[r1-GigabitEthernet0/0/0.1]do
[r1-GigabitEthernet0/0/0.1]dot1q te
[r1-GigabitEthernet0/0/0.1]dot1q termination vid 2
[r1-GigabitEthernet0/0/0.1]ip add 192.168.1.250 24
Aug 18 2023 11:25:06-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0.1 has entered the UP state.
[r1-GigabitEthernet0/0/0.1]arp br
[r1-GigabitEthernet0/0/0.1]arp broadcast en
[r1-GigabitEthernet0/0/0.1]arp broadcast enable
[r1-GigabitEthernet0/0/0.1]dhcp se
[r1-GigabitEthernet0/0/0.1]dhcp select gl
[r1-GigabitEthernet0/0/0.1]dhcp select global
[r1-GigabitEthernet0/0/0.1]q
# vlan3到6不加标签,配置地址
[r1]int g0/0/0
[r1-GigabitEthernet0/0/0]ip add 192.168.2.250 24
[r1-GigabitEthernet0/0/0]
Aug 18 2023 11:25:44-08:00 r1 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]dhcp se
[r1-GigabitEthernet0/0/0]dhcp select gl
[r1-GigabitEthernet0/0/0]dhcp select global
[r1-GigabitEthernet0/0/0]
检验:
PC1可以ping通PC2/3/4/5/6