任务1

1、组网需求: 如 图1-1 所示,小区用户Host A、Host B、Host C分别与Device的端口GigabitEthernet 1/0/1、GigabitEthernet 1/0/2 、GigabitEthernet 1/0/3 相连, Device 设备通过GigabitEthernet 1/0/4 端口与外部网络相连。现需要实现小区用户Host A、Host B和Host C彼此之间二层报文不能互通,但可以和外部网络通信。试验拓扑图如下: 2、配置步骤: 创建隔离组2。 <Device> system-view [Device] port-isolate group 2 将端口GigabitEthernet 1/0/1、GigabitEthernet 1/0/2、GigabitEthernet 1/0/3 加入隔 离组2。 [Device] interface gigabitethernet 1/0/1 [Device-GigabitEthernet1/0/1] port-isolate enable group 2 [Device-GigabitEthernet1/0/1] quit [Device] interface gigabitethernet 1/0/2 [Device-GigabitEthernet1/0/2] port-isolate enable group 2 [Device-GigabitEthernet1/0/2] quit [Device] interface gigabitethernet 1/0/3 [Device-GigabitEthernet1/0/3] port-isolate enable group 2 3、验证配置如图所示: 任务2

1、组网需求: • Host A 和Host C 属于部门A,但是通过不同的设备接入公司网络;Host B 和Host D 属于部 门B,也通过不同的设备接入公司网络。 • 为了通信的安全性,也为了避免广播报文泛滥,公司网络中使用 VLAN 技术来隔离部门间的 二层流量。其中部门A 使用VLAN 100,部门B 使用VLAN 200。 • 现要求不管是否使用相同的设备接入公司网络,同一 VLAN 内的主机能够互通,即Host A 和 Host C 能够互通,Host B 和Host D 能够互通。试验拓扑图如下: 3、配置步骤: (1) 配置 Device A 创建VLAN 100,并将GigabitEthernet1/0/1 加入VLAN 100。 <DeviceA> system-view [DeviceA] vlan 100 [DeviceA-vlan100] port gigabitethernet 1/0/1 [DeviceA-vlan100] quit 创建VLAN 200,并将GigabitEthernet1/0/2 加入VLAN 200。 [DeviceA] vlan 200 [DeviceA-vlan200] port gigabitethernet 1/0/2 [DeviceA-vlan200] quit

#为了使Device A 上VLAN 100 和VLAN 200 的报文能发送给Device B , 将 GigabitEthernet1/0/3 的链路类型配置为Trunk,并允许VLAN 100 和VLAN 200 的报文通过。 [DeviceA] interface gigabitethernet 1/0/3 [DeviceA-GigabitEthernet1/0/3] port link-type trunk [DeviceA-GigabitEthernet1/0/3] port trunk permit vlan 100 200

(2) Device B 上的配置与Device A 上的配置相同,不再赘述。

(3) 将Host A 和Host C 配置在一个网段,比如192.168.100.0/24;将Host B 和Host D 配置在 一个网段,比如192.168.200.0/24。 3.验证配置如图所示: 任务3

1、组网需求: 如下图所示,办公区的主机属于不同的网段 192.168.5.0/24 和192.168.50.0/24,Device C 在收到 来自办公区主机的报文时,根据报文的源IP 地址,使来自不同网段主机的报文分别在指定的VLAN 中传输。试验拓扑图如下: 2、配置步骤: (1) 配置 Device C 配置子网192.168.5.0/24 与VLAN 100 关联。 <DeviceC> system-view [DeviceC] vlan 100 [DeviceC-vlan100] ip-subnet-vlan ip 192.168.5.0 255.255.255.0 [DeviceC-vlan100] quit 配置子网192.168.50.0/24 与VLAN 200 关联。 [DeviceC] vlan 200 [DeviceC-vlan200] ip-subnet-vlan ip 192.168.50.0 255.255.255.0 [DeviceC-vlan200] quit 配置端口GigabitEthernet1/0/11 允许通过VLAN 100 的报文。 [DeviceC] interface ten-gigabitethernet 1/0/11 [DeviceC-Ten-GigabitEthernet1/0/11] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/11] port hybrid vlan 100 tagged [DeviceC-Ten-GigabitEthernet1/0/11] quit 配置端口GigabitEthernet1/0/12 允许通过VLAN 200 的报文。 [DeviceC] interface ten-gigabitethernet 1/0/12 [DeviceC-Ten-GigabitEthernet1/0/12] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/12] port hybrid vlan 200 tagged [DeviceC-Ten-GigabitEthernet1/0/12] quit 配置端口GigabitEthernet1/0/1 和基于IP 子网的VLAN 100、VLAN 200 关联。 [DeviceC] interface ten-gigabitethernet 1/0/1 [DeviceC-Ten-GigabitEthernet1/0/1] port link-type hybrid [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid vlan 100 200 untagged [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 100 [DeviceC-Ten-GigabitEthernet1/0/1] port hybrid ip-subnet-vlan vlan 200 [DeviceC-Ten-GigabitEthernet1/0/1] quit

(2) 配置Device A 和Device B 配置Device A 和Device B 允许对应VLAN 通过。 3.验证配置如图所示: 任务4

组网需求 • Device B 上的VLAN 5 和VLAN 10 为Primary VLAN,其上行端口GigabitEthernet1/0/1 需要允许VLAN 5 和VLAN 10 的报文携带VLAN Tag 通过。 • Device B 的下行端口GigabitEthernet1/0/2 允许Secondary VLAN 2 通过, GigabitEthernet1/0/3 允许Secondary VLAN 3 通过,VLAN 2 和VLAN 3 映射到Primary VLAN 5。 • Device B 的下行端口GigabitEthernet1/0/6 允许Secondary VLAN 6 通过, GigabitEthernet1/0/8 允许Secondary VLAN 8 通过,VLAN 6 和VLAN 8 映射到Primary VLAN 10。 • 从 Device A 看,下接的Device B 只有VLAN 5 和VLAN 10。试验拓扑图如下: 配置步骤: (1) 配置 Device B 配置VLAN 5 和VLAN 10 为Primary VLAN。 <DeviceB> system-view [DeviceB] vlan 5 [DeviceB-vlan5] private-vlan primary [DeviceB-vlan5] quit [DeviceB] vlan 10 [DeviceB-vlan10] private-vlan primary [DeviceB-vlan10] quit 创建Secondary VLAN 2、3、6、8。 [DeviceB] vlan 2 to 3 [DeviceB] vlan 6 [DeviceB-vlan6] quit [DeviceB] vlan 8 [DeviceB-vlan8] quit

配置上行端口 GigabitEthernet1/0/1 在VLAN 5 和VLAN 10 中工作在trunk promiscuous 模 式。 [DeviceB] interface gigabitethernet 1/0/1 [DeviceB- GigabitEthernet1/0/1] port private-vlan 5 10 trunk promiscuous [DeviceB- GigabitEthernet1/0/1] quit 将下行端口 GigabitEthernet1/0/2 加入VLAN 2, GigabitEthernet1/0/3 加入VLAN 3,并 配置他们工作在host 模式。 [DeviceB] interface gigabitethernet 1/0/2 [DeviceB- GigabitEthernet1/0/2] port access vlan 2

[DeviceB- GigabitEthernet1/0/2] port private-vlan host [DeviceB- GigabitEthernet1/0/2] quit [DeviceB] interface ten-gigabitethernet 1/0/3 [DeviceB- GigabitEthernet1/0/3] port access vlan 3 [DeviceB- GigabitEthernet1/0/3] port private-vlan host [DeviceB- GigabitEthernet1/0/3] quit

配置Primary VLAN 5 和Secondary VLAN 2、3 间的映射关系。 [DeviceB] vlan 5 [DeviceB-vlan5] private-vlan secondary 2 to 3 [DeviceB-vlan5] quit

将下行端口 GigabitEthernet1/0/6 加入VLAN 6, GigabitEthernet1/0/8 加入VLAN 8,并 配置它们工作在host 模式。 [DeviceB] interface gigabitethernet 1/0/6 [DeviceB- GigabitEthernet1/0/6] port access vlan 6 [DeviceB- GigabitEthernet1/0/6] port private-vlan host [DeviceB- GigabitEthernet1/0/6] quit [DeviceB] interface gigabitethernet 1/0/8 [DeviceB- GigabitEthernet1/0/8] port access vlan 8 [DeviceB- GigabitEthernet1/0/8] port private-vlan host [DeviceB- GigabitEthernet1/0/8] quit

配置Primary VLAN 10 和Secondary VLAN 6、8 间的映射关系。 [DeviceB] vlan 10 [DeviceB-vlan10] private-vlan secondary 6 8 [DeviceB-vlan10] quit

(2) 配置Device A 创建VLAN 5 和VLAN 10。 [DeviceA] vlan 5 [DeviceA-vlan5] quit [DeviceA] vlan 10 [DeviceA-vlan10] quit 配置端口 GigabitEthernet1/0/1 为Hybrid 端口,并允许VLAN 5 和VLAN 10 携带Tag 通过。 [DeviceA] interface gigabitethernet 1/0/1 [DeviceA- GigabitEthernet1/0/1] port link-type hybrid [DeviceA- GigabitEthernet1/0/1] port hybrid vlan 5 10 tagged [DeviceA- GigabitEthernet1/0/1] quit 3.验证配置如图所示:

任务5

组网需求(模拟器对supervlan支持不足,不能正确显示效果) • 创建 Super VLAN 10,对应VLAN 接口的IP 地址为10.0.0.1/24。 • 创建 Sub VLAN:VLAN 2、VLAN 3、VLAN 5。 • 端口 GigabitEthernet1/0/1 和端口GigabitEthernet1/0/2 属于VLAN 2, 端口GigabitEthernet1/0/3 和端口GigabitEthernet1/0/4 属于VLAN 3, 端口GigabitEthernet1/0/5 和端口GigabitEthernet1/0/6 属于VLAN 5。 • 各 Sub VLAN 的用户之间能够满足二层隔离和三层互通。试验拓扑图如下: 配置步骤: 创建VLAN 10,配置VLAN 接口的IP 地址为10.0.0.1/24。 <Sysname> system-view [Sysname] vlan 10 [Sysname-vlan10] quit [Sysname] interface vlan-interface 10 [Sysname-Vlan-interface10] ip address 10.0.0.1 255.255.255.0 开启设备的本地ARP 代理功能。 [Sysname-Vlan-interface10] local-proxy-arp enable [Sysname-Vlan-interface10] quit

创建VLAN 2,并添加端口 GigabitEthernet1/0/1 和端口 GigabitEthernet1/0/2。 [Sysname] vlan 2 [Sysname-vlan2] port gigabitethernet 1/0/1 gigabitethernet 1/0/2 [Sysname-vlan2] quit

创建VLAN 3,并添加端口 GigabitEthernet1/0/3 和端口 GigabitEthernet1/0/4。 [Sysname] vlan 3 [Sysname-vlan3] port gigabitethernet 1/0/3 gigabitethernet 1/0/4 [Sysname-vlan3] quit

创建VLAN 5,并添加端口 GigabitEthernet1/0/5 和端口 GigabitEthernet1/0/6。 [Sysname] vlan 5 [Sysname-vlan5] port gigabitethernet 1/0/5 gigabitethernet 1/0/6 [Sysname-vlan5] quit

指定VLAN 10 为Super VLAN,VLAN 2、VLAN 3 和VLAN 5 为Sub VLAN。 [Sysname] vlan 10 [Sysname-vlan10] supervlan [Sysname-vlan10] subvlan 2 3 5 [Sysname-vlan10] quit [Sysname] quit 3.验证配置如图所示:

任务6 1.组网情况: PC_A连接到DeviceA的 g1/0/1;PC_B连接到DeviceA的 g1/0/2;PC_C连接到DeviceA的 g1/0/3; PC_D连接到DeviceB的 g1/0/1;PC_E连接到DeviceB的 g1/0/2;PC_F连接到DeviceB的 g1/0/3; DeviceA的g1/0/1属于vlan10, g1/0/2属于vlan20, g1/0/3属于vlan30;g1/0/24为trunk模式 DeviceB的g1/0/1属于vlan10, g1/0/2属于vlan20, g1/0/3属于vlan30;g1/0/24为trunk模式 DeviceC的g1/0/23连接到DeviceA的g1/0/24; g1/0/24连接到DeviceB的g1/0/24 DeviceC的g1/0/23和g1/0/24都为trunk模式。试验拓扑图如下: 2.实验步骤: 1、DeviceA的基本配置 sys vlan 10 port g 1/0/1 vlan 20 port g 1/0/2 vlan 30 port g 1/0/3 inter g 1/0/24 port link-type trunk port trunk permit vlan all

2、DeviceB的基本配置与DeviceA相同

3、DeviceC的基本配置 sys inter r g 1/0/23 to g 1/0/24 port link-type trunk port trunk permit vlan all

4、PC_A访问PC_D发现不通 在DeviceC上面使用dis vlan只能看到vlan 1

5、开启mvrp功能 #DeviceA配置MVRP mvrp global enable inter g 1/0/24 mvrp enable

#DeviceB配置MVRP与DeviceA相同

#DeviceC配置MVRP mvrp global enable inter r g 1/0/23 to g 1/0/24 mvrp enable

6、再次用PC_A访问PC_D,成功访问 在DeviceC上面使用dis vlan可以看到有vlan 10 20 30

3.验证配置如图所示: