在下图所示的网络中 需要实现接入交换机作为PC的网关,实现不同网段用户间通

考试题库2022-08-02  33

问题 在下图所示的网络中需要实现接入交换机作为PC的网关,实现不同网段用户间通信。根据以下SW2的配置进行命令填空或者解释,ystem-view[HUAWEI] sysname SW2 //修改设备的名称为SW2,便于识别[SW2] (1) //批量创建VLAN 2和VLAN 3[SW2] interface gigabitethernet 1/0/23[SW2-GigabitEthernet1/0/23] (2) //将与PC相连接口的接口类型设置为access[SW2-GigabitEthernet1/0/23] port default vlan 2 //将PC1划分到VLAN 2[SW2-GigabitEthernet1/0/23] quit[SW2] interface gigabitethernet 1/0/24[SW2-GigabitEthernet1/0/24] port link-type access[SW2-GigabitEthernet1/0/24] port default vlan 3 //将PC2划分到VLAN 3[SW2-GigabitEthernet1/0/24] quit[SW2] (3) //创建VLANIF2接口[SW2-Vlanif2] (4) //配置IP地址,此IP地址是PC1的网关地址[SW2-Vlanif2] quit[SW2] interface vlanif 3 //创建VLANIF3接口[SW2-Vlanif3] ip address 192.168.3.1 24 //配置IP地址,此IP地址是PC2的网关地址[SW2-Vlanif3] quit[SW2] vlan batch 5 //创建VLAN 5[SW2] interface gigabitethernet 1/0/1[SW2-GigabitEthernet1/0/1] port link-type access[SW2-GigabitEthernet1/0/1] port default vlan 5 //SW2和SW1以Untagged方式通信[SW2-GigabitEthernet1/0/1] quit[SW2] interface vlanif 5 //(5)[SW2-Vlanif5] ip address 192.168.5.2 24 //配置IP地址,此IP地址是SW2与SW1互连接口的IP地址[SW2-Vlanif5] quit[SW2] (6) //配置缺省路由,为PC用户找到访问路由器的出口。缺省路由的下一跳是SW1相连接口的IP

选项

答案

解析 (1)vlan batch 2 to 3 (2)port  link-type access (3) interface vlanif 2 (4)ip address 192.168.2.1 24(5) 创建vlanif5接口 (6)ip route-static 0.0.0.0 0.0.0.0 192.168.5.1要实现利用接入交换机作为PC的网关,实现不同网段用户间通信,只要配置好接入交换机的Vlanif接口和对应的IP地址即可。完整的命令配置和解释如下:system-view[HUAWEI] sysname SW2 //修改设备的名称为SW2,便于识别[SW2] vlan batch 2 to 3 //批量创建VLAN 2和VLAN 3# 将接口加入相应VLAN。[SW2] interface gigabitethernet 1/0/23[SW2-GigabitEthernet1/0/23] port link-type access //将与PC相连接口的接口类型设置为access[SW2-GigabitEthernet1/0/23] port default vlan 2 //将PC1划分到VLAN 2[SW2-GigabitEthernet1/0/23] quit[SW2] interface gigabitethernet 1/0/24[SW2-GigabitEthernet1/0/24] port link-type access[SW2-GigabitEthernet1/0/24] port default vlan 3 //将PC2划分到VLAN 3[SW2-GigabitEthernet1/0/24] quit# 配置VLANIF接口,作为用户PC的网关。[SW2] interface vlanif 2 //创建VLANIF2接口[SW2-Vlanif2] ip address 192.168.2.1 24 //配置IP地址,此IP地址是PC1的网关地址[SW2-Vlanif2] quit[SW2] interface vlanif 3 //创建VLANIF3接口[SW2-Vlanif3] ip address 192.168.3.1 24 //配置IP地址,此IP地址是PC2的网关地址[SW2-Vlanif3] quit# 配置SW2和SW1互连。[SW2] vlan batch 5 //创建VLAN 5[SW2] interface gigabitethernet 1/0/1[SW2-GigabitEthernet1/0/1] port link-type access[SW2-GigabitEthernet1/0/1] port default vlan 5 //SW2和SW1以Untagged方式通信[SW2-GigabitEthernet1/0/1] quit[SW2] interface vlanif 5 //创建VLANIF5接口[SW2-Vlanif5] ip address 192.168.5.2 24 //配置IP地址,此IP地址是SW2与SW1互连接口的IP地址[SW2-Vlanif5] quit[SW2] ip route-static 0.0.0.0 0.0.0.0 192.168.5.1 //配置缺省路由,为PC用户找到访问路由器的出口。缺省路由的下一跳是SW1相连接口的IP  类似的把接口配置成hybrid接口,如下:[Quidway] sysname SwitchA [SwitchA] vlan batch 100 200 [SwitchA] interface gigabitethernet 0/0/1 [SwitchA-GigabitEthernet0/0/1] port hybrid pvid vlan 100 [SwitchA-GigabitEthernet0/0/1] port hybrid untagged vlan 100 [SwitchA-GigabitEthernet0/0/1] quit
转载请注明原文地址:https://tihaiku.com/congyezige/2404634.html

最新回复(0)