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接口的使用
原文地址:http://rachelxie.blog.51cto.com/9080122/1749474