如图所示:LSW1创建静态vlan 10,SW2和SW3没有配置vlan,通过配置gvrp和trunk,让SW2、SW3自动学习vlan
LSW1
<Huawei>undo terminal mon
<Huawei>undo terminal monitor #关闭提示信息
Info: Current terminal monitor is off.
[Huawei]vlan 10 #创建vlan 10
[Huawei-vlan10]q #推出vlan 10
[Huawei]gvrp #开启gvrp功能
[Huawei]int g0/0/1 #进入端口
[Huawei-GigabitEthernet0/0/1]port link-type trunk #将端口设置为trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all #允许所有vlan进入此端口
[Huawei-GigabitEthernet0/0/1]gvrp #在该端口开启gvrp功能
LSW2
<Huawei>undo terminal monitor #关闭提示信息
Info: Current terminal monitor is off.
<Huawei>sys #进入系统视图
Enter system view, return user view with Ctrl+Z.
[Huawei]gvrp #开启gvrp
[Huawei]int g0/0/2 #进入端口
[Huawei-GigabitEthernet0/0/2]port link-type trunk #将端口设置为trunk
[Huawei-GigabitEthernet0/0/2]port trunk allow-pass vlan all #允许所有端口进入
LSW3
<Huawei>undo terminal monitor #关闭提示信息
Info: Current terminal monitor is off.
<Huawei>sys #进入系统视图
Enter system view, user view with Ctrl+Z.
[Huawei]gvrp #开启gvrp
[Huawei]int g0/0/1 #进入端口
[Huawei-GigabitEthernet0/0/1]port link-type trunk #将端口设置为trunk
[Huawei-GigabitEthernet0/0/1]port trunk allow-pass vlan all #允许所有端口进入
[Huawei-GigabitEthernet0/0/1]gvrp #开启gvrp
[Huawei-GigabitEthernet0/0/1]q #退出端口视图
最后在LSW2和LSW3的命令行输入: [Huawei]display vlan 来验证
注:自动学习到的vlan是动态vlan,不能在动态vlan上直接加入端口,需要将其改为静态vlan即可