CLIENT1屬於vlan10
CLIENT2屬於vlan20
接下來看LSW1的配置
首先
vlan batch 10 20 100 to 101 #創建需要使用的所有vlan
[Huawei-Ethernet0/0/4]dis this #連接CLIENT1的4口
#
interface Ethernet0/0/4
port hybrid pvid vlan 10 #這裏使用hybird接口,且PVID爲vlan 10,端口接收數據時會打上
vlan 10的標籤
port hybrid untagged vlan 10 20 100 #這裏配置此端口發送帶vlan 10,20,100標籤的數據時,剝掉標籤
發送
#
[Huawei-Ethernet0/0/6]di this
#
interface Ethernet0/0/6 #這裏的配置與4口差不多
port hybrid pvid vlan 20
port hybrid untagged vlan 10 20 101
#
[Huawei-GigabitEthernet0/0/1]dis this
#
interface GigabitEthernet0/0/1 #連接路由器的1口
port link-type trunk #端口類型trunk
port trunk pvid vlan 100 #端口PVID100,接收時打上vlan100的標籤
port trunk allow-pass vlan 2 to 4094 #允許所有vlan通過
#
[Huawei-GigabitEthernet0/0/2]dis this
#
interface GigabitEthernet0/0/2 #連接路由器的2口,與1口類似
port link-type trunk
port trunk pvid vlan 101
port trunk allow-pass vlan 2 to 4094
#
#
interface Vlanif10 #vlan10下的網關
ip address 192.168.10.254 255.255.255.0
dhcp select interface #vlan 10的dhcp配置
#
interface Vlanif20 #vlan 20下的網關
ip address 192.168.20.254 255.255.255.0
dhcp select interface
#
interface Vlanif100
ip address 192.168.100.254 255.255.255.0
#
interface Vlanif101
ip address 192.168.101.254 255.255.255.0
#
# #靜態路由
ip route-static 0.0.0.0 0.0.0.0 192.168.100.1
ip route-static 0.0.0.0 0.0.0.0 192.168.101.1
ip route-static 192.168.10.0 255.255.255.0 Ethernet0/0/4
ip route-static 192.168.20.0 255.255.255.0 Ethernet0/0/6
#
AR1上只做瞭如下設置
#
interface GigabitEthernet0/0/0
ip address 192.168.100.1 255.255.255.0
#
interface GigabitEthernet0/0/1
ip address 192.168.101.1 255.255.255.0
#
#
ip route-static 192.168.10.0 255.255.255.0 192.168.100.254
ip route-static 192.168.20.0 255.255.255.0 192.168.101.254
#
在client1上面pingclient2
要特別注意hybird接口的使用