实验需求
如下图所示,PC1和PC2在vlan10下,PC3和PC4在vlan20下,Server1在vlan30下,需要实现这5台设备之间互相通讯。
实验操作
配置各个终端的ip地址
PC1~PC4都按照下图进行配置(注意ip地址和网关有不同的地方),注意配置好之后要点击右下角的应用
Server1配置如图下所示,配置好之后,点击保存
将S1进行如下配置
The device is running!
#进入系统模式
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
#关闭提示信息
[Huawei]un in en
Info: Information center is disabled.
#更改设备名称为S1
[Huawei]sysname S1
#批量创建vlan10、vlan20、vlan30
[S1]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
#进入e0/0/1接口
[S1]int e0/0/1
#设置接口类型为access
[S1-Ethernet0/0/1]port link-type access
#将接口加入vlan10
[S1-Ethernet0/0/1]port default vlan 10
#进入e0/0/2接口
[S1-Ethernet0/0/1]int e0/0/2
#设置接口类型为trunk
[S1-Ethernet0/0/2]port link-type trunk
#允许该trunk口所有vlan通过
[S1-Ethernet0/0/2]port trunk allow-pass vlan all
将S2进行如下配置
The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname S2
[S2]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[S2]int e0/0/1
[S2-Ethernet0/0/1]port link-type access
[S2-Ethernet0/0/1]port default vlan 10
[S2-Ethernet0/0/1]int e0/0/2
[S2-Ethernet0/0/2]port link-type trunk
[S2-Ethernet0/0/2]port trunk allow-pass vlan all
将S3进行如下配置
The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname S3
[S3]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[S3]int e0/0/1
[S3-Ethernet0/0/1]port link-type access
[S3-Ethernet0/0/1]port default vlan 20
[S3-Ethernet0/0/1]int e0/0/2
[S3-Ethernet0/0/2]port link-type trunk
[S3-Ethernet0/0/2]port trunk allow-pass vlan all
将S4进行如下配置
The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname S4
[S4]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
[S4]int e0/0/1
[S4-Ethernet0/0/1]port link-type access
[S4-Ethernet0/0/1]port default vlan 20
[S4-Ethernet0/0/1]int e0/0/2
[S4-Ethernet0/0/2]port link-type trunk
[S4-Ethernet0/0/2]port trunk allow-pass vlan all
将S5进行如下配置
The device is running!<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname S5
[S5]vlan batch 10 20 30
Info: This operation may take a few seconds. Please wait for a moment...done.
#创建接口组1
[S5]port-group 1
#将e0/0/2 ~ e0/0/5的接口都加入到端口组1中
[S5-port-group-1]group-member e0/0/2 to e0/0/5
#将接口组1中的接口批量设置为trunk口
[S5-port-group-1]port link-type trunk
#以下自动生成
[S5-port-group-1]port link-type trunk
[S5-Ethernet0/0/2]port link-type trunk
[S5-Ethernet0/0/3]port link-type trunk
[S5-Ethernet0/0/4]port link-type trunk
[S5-Ethernet0/0/5]port link-type trunk
#将接口组1中的接口批量允许所有vlan通过
[S5-port-group-1]port trunk allow-pass vlan all
#以下自动生成
[S5-port-group-1]port trunk allow-pass vlan all
[S5-Ethernet0/0/2]port trunk allow-pass vlan all
[S5-Ethernet0/0/3]port trunk allow-pass vlan all
[S5-Ethernet0/0/4]port trunk allow-pass vlan all
[S5-Ethernet0/0/5]port trunk allow-pass vlan all
#退出接口组1
[S5-port-group-1]q
#进入g0/0/1接口
[S5]int g0/0/1
#将接口设置为trunk口
[S5-GigabitEthernet0/0/1]port link-type trunk
#允许该trunk口vlan全部通过
[S5-GigabitEthernet0/0/1]port trunk allow-pass vlan all
#进入接口e0/0/6中
[S5-GigabitEthernet0/0/1]int e0/0/6
#将接口e0/0/6设置为access类型
[S5-Ethernet0/0/6]port link-type access
#将接口划分到vlan30中
[S5-Ethernet0/0/6]port default vlan 30
将R1进行如下配置
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]un in en
Info: Information center is disabled.
[Huawei]sysname R1
#进入虚拟接口g0/0/1.10
[R1]int g0/0/1.10
#给虚拟接口g0/0/1.10配置ip
[R1-GigabitEthernet0/0/1.10]ip add 192.168.10.254 24
#封装协议,加标签
[R1-GigabitEthernet0/0/1.10]dot1q termination vid 10
#开启arp广播
[R1-GigabitEthernet0/0/1.10]arp broadcast enable
[R1-GigabitEthernet0/0/1.10]int g0/0/1.20
[R1-GigabitEthernet0/0/1.20]ip add 192.168.20.254 24
[R1-GigabitEthernet0/0/1.20]dot1q termination vid 20
[R1-GigabitEthernet0/0/1.20]arp broadcast enable
[R1-GigabitEthernet0/0/1.20]int g0/0/1.30
[R1-GigabitEthernet0/0/1.30]ip add 192.168.30.254 24
[R1-GigabitEthernet0/0/1.30]dot1q termination vid 30
[R1-GigabitEthernet0/0/1.30]arp broadcast enable
连通性测试
将PC1~PC4,以及Server1之间的ip互相ping测试,发现都可以互相ping通,实验成功。
错误排查
如若发生无法ping通的问题,请按照如下思路进行排查
- 使用ipconfig命令排查下各个终端的ip是否配置正确
- 使用display port vlan命令对交换机进行配置排查
- 使用display ip interface brief命令对路由器进行配置排查
使用命令:display port vlan
查看设备上所有接口的接口类型和缺省VLAN
其中,“Link Type”表示接口的接口类型,“PVID”表示接口上的缺省VLAN,“Trunk VLAN List”表示Trunk接口上允许通过的VLAN列表,或Hybrid接口上以Tagged方式加入的VLAN。如果接口类型是Access,或Hybrid接口没有以Tagged方式加入VLAN,该处显示“-”。
S1交换机的接口类型如下(同S2交换机)
S3交换机的接口类型如下(同S4交换机)
S5交换机的接口类型如下
检查R1接口配置
#查明接口简要配置信息
[R1]display ip interface brief