码迷,mamicode.com
首页 > 其他好文 > 详细

HCL 配置端口隔离及VLAN实例

时间:2019-03-17 23:45:13      阅读:478      评论:0      收藏:0      [点我收藏+]

标签:route   二层   广播   display   https   alt   quit   ping   process   

一. 端口隔离

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 中的信息。
[Device] display port-isolate group 2
Port isolation group information:
Group ID: 2
Group members:
GigabitEthernet 0/1
GigabitEthernet1/0/2
GigabitEthernet1/0/3
以上信息显示Device 上的端口GigabitEthernet1/0/1 、GigabitEthernet1/0/2 、
GigabitEthernet1/0/3 已经加入隔离组2,从而实现二层隔离,分别对应的Host A、Host B 和
Host C 彼此之间不能Ping 通。

二. VLAN

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 能够互通。

技术图片

2. 配置步骤

(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。

#### 验证配置
   (1) Host A 和Host C 能够互相ping 通,但是均不能ping 通Host B。Host B 和Host D 能够互相
      ping 通,但是均不能ping 通Host A。
(2) 通过查看显示信息验证配置是否成功。

查看Device A 上VLAN 100 和VLAN 200 的配置信息,验证以上配置是否生效。
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 100
VLAN ID: 100
VLAN type: Static
Route interface: Not configured
Description: VLAN 0100
Name: VLAN 0100
Tagged ports:
Ten-GigabitEthernet1/0/3
13
Untagged ports:
Ten-GigabitEthernet1/0/1
[DeviceA-Ten-GigabitEthernet1/0/3] display vlan 200
VLAN ID: 200
VLAN type: Static
Route interface: Not configured
Description: VLAN 0200
Name: VLAN 0200
Tagged ports:
Ten-GigabitEthernet1/0/3
Untagged ports:
Ten-GigabitEthernet1/0/2

1. 组网需求

如下图所示,办公区的主机属于不同的网段 192.168.5.0/24 和192.168.50.0/24,Device C 在收到
来自办公区主机的报文时,根据报文的源IP 地址,使来自不同网段主机的报文分别在指定的VLAN
中传输。

技术图片

配置思路
创建 VLAN100、VLAN200,配置子网与VLAN 的关联关系,并配置端口与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

配置端口Ten-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

配置端口Ten-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

配置端口Ten-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.显示与验证

查看所有子网VLAN 的信息。
[DeviceC] display ip-subnet-vlan vlan all
VLAN ID: 100
Subnet index IP address Subnet mask
192.168.5.0 255.255.255.0
VLAN ID: 200
Subnet index IP address Subnet mask
192.168.50.0 255.255.255.0
查看端口Ten-GigabitEthernet1/0/1 关联的子网VLAN 的信息。
[DeviceC] display ip-subnet-vlan interface ten-gigabitethernet 1/0/1
Interface: Ten-GigabitEthernet1/0/1
VLAN ID Subnet index IP address Subnet mask Status
100 0 192.168.5.0 255.255.255.0 Active
200 0 192.168.50.0 255.255.255.0 Active

HCL 配置端口隔离及VLAN实例

标签:route   二层   广播   display   https   alt   quit   ping   process   

原文地址:https://blog.51cto.com/13664810/2364287

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!