在本页
桥接和 VLAN
了解交换机上的桥接和 VLAN
网络交换机使用第 2 层桥接协议来发现其 LAN 的拓扑,并向 LAN 上的目标转发流量。本主题介绍有关桥接和 VLAN 的以下概念:
对于以太网接口、快速以太网接口、三重速率以太网(铜缆)接口、千兆以太网接口、10 千兆以太网接口和支持 VPLS 的聚合以太网接口,Junos OS 支持 IEEE 802.1Q 标准的一个子集,用于将以太网接口通道化为多个逻辑接口,从而允许将多台主机连接到同一台千兆以太网交换机,同时防止其处于同一个路由或桥接域中。
- 使用 VLAN 的好处
- VLAN 的历史
- VLAN 流量桥接的工作原理
- 数据包要么已标记,要么未标记
- 交换机接口模式 — 接入、中继或标记访问
- 每台交换机的最大 VLAN 数和 VLAN 成员数
- 将流量分配给 VLAN
- 转发 VLAN 流量
- VLAN 与集成路由和桥接接口通信
- VPLS 端口
使用 VLAN 的好处
除了减少流量从而加快网速外,VLAN 还有以下优点:
-
VLAN 提供传统上由 LAN 配置中的路由器提供的分段服务,从而降低硬件设备成本。
-
与 VLAN 关联的数据包能被可靠地识别并分类到不同的域中。您可以在网络的某些部分中包含广播,从而释放网络资源。例如,当 DHCP 服务器插入交换机并开始广播其状态时,您可以使用 VLAN 来分割网络,从而阻止某些主机对其进行访问。
-
对于安全问题,VLAN 提供对网络的精细控制,因为每个 VLAN 都由一个 IP 子网标识。进出 VLAN 的所有数据包都一致地使用该 VLAN 的 VLAN ID 进行标记,从而能轻松识别,因为数据包上的 VLAN ID 不能改变。
-
VLAN 对主机重新定位反应迅速 — 这也是由于数据包上的持久 VLAN 标记。
-
在以太网 LAN 上,所有网络节点都必须物理连接到同一个网络。在 VLAN 中,节点的物理位置并不重要,您可以按任何适合您组织的方式对网络设备进行分组,例如按部门或业务职能、网络节点类型或物理位置。
VLAN 的历史
以太网 LAN 最初是为小型、简单的网络而设计,主要用于传输文本。但是随着时间的推移,LAN 携带的数据类型逐渐扩展到包括语音、图形和视频等。这种更复杂的数据加上不断增长的传输速度,最终让原始的以太网 LAN 设计不堪重负。多数据包冲突明显地降低了大型 LAN 的速度。
IEEE 802.1D-2004 标准通过定义 透明桥接 (通常称为简单 桥接)的概念,帮助发展了以太网 LAN,以应对更高的数据和传输要求。桥接将一个物理 LAN(现在称为一个广播域)分成两个或更多虚拟 LAN 或 VLAN。每个 VLAN 都是一些 LAN 节点的集合,组合在一起构成各个广播域。
当 VLAN 按功能或组织以逻辑方式分组时,很大比例的数据流量将保留在 VLAN 中。这就减轻了 LAN 上的负载,因为不再需要将所有流量转发到 LAN 上的所有节点。VLAN 会先在 VLAN 中传输数据包,从而减少在整个 LAN 上传输的数据包数。由于来源和目标位于同一 VLAN 中的数据包仅在本地 VLAN 中转发,因此不发往本地 VLAN 的数据包是唯一转发至其他广播域的数据包。这样,通过减少 VLAN 内和整个 LAN 中可能发生的冲突数和数据包重新传输量,桥接和 VLAN 限制了整个 LAN 的流量传输。
VLAN 流量桥接的工作原理
IEEE 802.1D-2004 标准的目标是减少流量,从而减少以太网的潜在传输冲突,因此实施了一个系统来重用信息。透明桥接协议允许交换机记录已知节点的位置,而不是每次将帧发送至节点时都要进行定位。将数据包发送至节点时,这些目标节点位置存储在称为以太网交换表的地址查找表中。在发送数据包之前,使用桥接的交换机会先查询交换表,看看该节点是否已定位。如果节点的位置已知,则会将帧直接发送至该节点。
透明桥接使用五种机制在交换机上创建和维护以太网交换表:
-
知识分享
-
转发
-
泛洪
-
过滤
-
老化
LAN 和 VLAN 使用的主要桥接机制是学习。交换机首次连接到以太网 LAN 或 VLAN 时,对该网络上的其他节点一无所知。发送数据包时,交换机会学习发送节点的嵌入 MAC 地址,并将其与其他两条信息(目标节点上接收流量的接口(或端口)以及获知地址的时间)一起存储在以太网交换表中。
学习使交换机随后能执行转发。通过查询以太网交换表以查看表中是否已包含帧的目标 MAC 地址,交换机可以在将数据包转发到已知 MAC 地址时节省时间和资源。如果以太网交换表没有包含某个地址的条目,交换机将使用泛洪来学习该地址。
泛洪会在不使用以太网交换表的情况下查找特定的目标 MAC 地址。当流量从交换机上发出,而以太网交换表尚未包含目标 MAC 地址时,交换机会先将流量泛洪到 VLAN 中的所有其他接口。当目标节点收到泛洪的流量时,可以向交换机回发确认数据包,以便交换机学习其 MAC 地址,并将地址添加到以太网交换表中。
第四个桥接机制是过滤,即广播流量如何在可能时限制到本地 VLAN。随着以太网交换表中条目数量的增加,交换机会逐渐拼凑出 VLAN 和更大的 LAN 的完整画面 — 它会学习哪些节点位于本地 VLAN 中,哪些位于其他网段上。交换机使用这些信息过滤流量。具体而言,对于源和目标 MAC 地址在本地 VLAN 中的流量,过滤将防止交换机将此类流量转发至其他网络分段。
要使以太网交换表中的条目保持最新,交换机会使用第五个桥接机制,老化。老化是以太网交换表条目包含时间戳的原因。每次交换机检测到来自某个 MAC 地址的流量时,都会更新时间戳。交换机上的计时器会定期检查时间戳,如果时间戳早于用户配置的值,交换机将从以太网交换表中移除节点的 MAC 地址。此老化流程最终会将不可用的网络节点从以太网交换表中刷掉。
数据包要么已标记,要么未标记
将以太网 LAN 划分为多个 VLAN 时,每个 VLAN 都由一个唯一的 802.1Q ID 标识。下面列出了可用 VLAN 和 VLAN ID 的数量:
-
在运行 ELS 软件的交换机上(EX4100 交换机除外),您可以使用 VLAN ID 1 至 4094 配置 4094 个 VLAN。EX4100 交换机可支持 1022 个 VLAN。VLAN ID 0 和 4095 由 Junos OS 保留,无法分配。
-
在运行非 ELS 软件的交换机上,可以使用 VLAN ID 1-4094 配置 4094 个 VLAN。
以太网数据包有一个标记协议标识符 (TPID) EtherType 字段,用于识别正在传输的协议。当 VLAN 中的设备生成数据包时,此字段会包含一个值 0x8100,表示该数据包是 VLAN 标记的数据包。数据包还有一个 VLAN ID 字段,其中包含唯一的 802.1Q ID,用于标识数据包所属的 VLAN。
Junos OS 交换机支持 TPID 值 0x9100,用于交换机上的 Q-in-Q。除 TPID EtherType 值 0x8100 外,不支持增强型第 2 层软件 (ELS) 配置样式的 EX 系列交换机还支持 0x88a8 (提供商桥接和最短路径桥接)和 0x9100 (Q-inQ)。
对于只有一个 VLAN 的简单网络,所有数据包都包含一个默认的 802.1Q 标记,这是唯一不将数据包标记为已标记的 VLAN 成员资格。这些数据包是未标记的数据包。
NFX150 设备不支持 Q-in-Q 隧道。
交换机接口模式 — 接入、中继或标记访问
交换机上的端口或接口以三种模式之一运行:
-
访问模式
-
中继模式
-
标记访问模式
访问模式
访问模式下的端口可以将交换机连接到单个网络设备,如台式计算机、IP 电话、打印机、文件服务器或安全摄像头等。访问接口仅接受未标记的数据包。
默认情况下,当您启动的交换机运行的 Junos OS 支持 ELS 并使用出厂默认配置,或者当您启动交换机且未显式配置端口模式时,交换机上的所有接口均处于访问模式,并且仅接受来自 default
VLAN 的未标记数据包。您可以选择性地配置其他 VLAN 并用该 VLAN 代替 default
VLAN。
在不支持 ELS 的 n EX 交换机上,default
不会创建 VLAN。因此,在此类交换机上,您必须显式配置至少一个 VLAN,即使您的网络结构十分简单,并且只希望保留一个广播域也是如此。您还必须在接入模式下显式配置接口。将接口分配给 VLAN 后,该接口在访问模式下运行。
对于运行任一类型软件的交换机,您还可以将中继端口或接口配置为接受来自用户配置的 VLAN 中的未标记数据包。有关 本机 VLAN 的详细信息,请参阅 中继模式和本机 VLAN。
中继模式
中继模式接口通常用于将交换机进行相互连接。交换机之间发送的流量可由来自多个 VLAN 的数据包组成,经过多路复用,这些数据包可以通过同一物理连接进行发送。中继接口通常只接受已标记的数据包,并使用 VLAN ID 标记来确定数据包的 VLAN 源和 VLAN 目标。
如果运行的软件不支持 ELS,则中继端口无法识别未标记的数据包,除非您在该端口上配置额外设置。
如果交换机上运行的 Junos OS 支持 ELS,则对于链路聚合控制协议 (LACP) 和链路层发现协议 (LLDP) 等协议,中继端口可识别未标记的控制数据包。但是,中继端口不会识别未标记的数据相关数据包,除非您在该端口上配置额外设置。
NFX150 设备不支持 LACP。
在极少数情况下,如果您希望运行任一类型软件的交换机上的中继端口能识别未标记的数据包,则必须在中继端口上将单个 VLAN 配置为本机 VLAN。有关本机 VLAN 的更多信息,请参阅中继模式和本机 VLAN。
中继模式和本机 VLAN
如果运行的 Junos OS 不支持 ELS,则中继端口无法识别不包含 VLAN 标记的数据包,也称为未标记的数据包。如果交换机上运行的 Junos OS 支持 ELS,则中继端口可以识别未标记的控制数据包,但无法识别未标记的数据相关数据包。配置本机 VLAN 后,中继端口通常无法识别的未标记数据包将通过中继接口发送。如果数据包要从 IP 电话或打印机等设备发送到处于访问模式下的交换机,而您希望这些数据包从交换机通过中继端口进行发送,请使用本机 VLAN 模式。通过配置 VLAN ID 来创建本机 VLAN,并将中继端口指定为本机 VLAN 的成员。
然后,交换机的中继端口会将这些数据包与其他标记的数据包区别对待。例如,如果一个中继端口分配了三个 VLAN(VLAN 10、VLAN 20 和 VLAN 30,其中 VLAN 10 为本机 VLAN),则 VLAN 10 上从另一端的中继端口离开的数据包不会带有 802.1Q 标头(标记)。
要配置本机 VLAN 标识符,请参阅 第 2 层网络。
您可以让交换机为未标记的数据包添加标记,以及从已标记的数据包中删除标记。例如,如果您有两个接口,并且未标记的数据包通过用户配置的本机 VLAN ID 传递到第一个接口,则该数据包会通过与标记数据包相同的 VLAN ID 从第二个接口传出。传递到第二个接口的已标记数据包将作为未标记数据包从第一个接口传出。
标记访问模式
从 Junos OS 15.2 版开始,只有运行 Junos OS 且采用非 ELS 配置样式的 SRX 和 EX 交换机才支持标记访问模式。
每台交换机的最大 VLAN 数和 VLAN 成员数
从 QFX10000 交换机上的 Junos OS 17.3 版开始,集成路由和桥接接口以及聚合以太网接口的 VLAN 成员数已增加到 256,000。
每台交换机支持的 VLAN 数各不相同。使用配置模式命令 set vlans vlan-name vlan-id ?
确定交换机上允许的最大 VLAN 数。您不能超过此 VLAN 限制,因为在创建 VLAN 时必须分配特定的 ID 号 — 您可以覆盖其中一个编号,但不能超过限制。
但是,您可以超过交换机的建议 VLAN 成员数上限。
如果运行的 Junos OS 不支持 ELS 配置样式,则交换机上允许的最大 VLAN 成员数是交换机支持的最大 VLAN 数的 8 倍(VLAN 成员数上限 = VLAN 数上限 * 8)。如果交换机的配置超过建议的 VLAN 成员数上限,则在您提交配置时将出现警告消息。如果不顾警告提交配置,则提交会成功,但以太网交换进程 (eswd) 可能会由于内存分配失败而失败。
如果运行的 Junos OS 支持 ELS,则大多数交换机允许的最大 VLAN 成员数是交换机支持的最大 VLAN 数的 24 倍(VLAN 成员数上限 = VLAN 数上限 * 24)。如果交换机的配置超过建议的 VLAN 成员数上限,则系统日志 (syslog) 中将出现警告消息。
这些交换机 上允许的最大 VLAN 成员数如下:
-
EX2300 — 交换机支持的最大 VLAN 数的 8 倍(VLAN 成员数上限 = vlan max * 8)
-
EX3400 - 交换机支持的最大 VLAN 数的 16 倍(VLAN 成员数上限 = vlan max * 16)
-
EX4100— 交换机支持的最大 VLAN 数的倍(VLAN 成员数上限 = vlan max * )
-
EX4300 — 交换机支持的最大 VLAN 数的 24 倍(VLAN 成员数上限 = vlan max * 24)
-
EX4400— 交换机支持的最大 VLAN 数的倍(VLAN 成员数上限 = vlan max * )
在单个网络节点组、服务器节点组或冗余服务器节点组上,QFabric 系统支持多达 131,008 个 VLAN 成员。VLAN 成员数通过将最大 VLAN 数乘以 32 计算得出。
例如,要计算支持 4,000 个 VLAN 所需的接口数量,请将最大 VLAN 成员数 (128,000) 除以配置的 VLAN 数 (4,000)。在这种情况下,需要 32 个接口。
在网络节点组和服务器节点组上,可以跨多个接口配置链路聚合组 (LAG)。每个 LAG 和 VLAN 组合都被视为一个 VLAN 成员。
NFX150 设备不支持 LAG。
虚拟机箱交换结构支持多达 512,000 个 VLAN 成员。VLAN 成员数基于 VLAN 数量以及每个 VLAN 中配置的接口数。
无法在 NFX150 设备上配置默认 VLAN。
将流量分配给 VLAN
通过引用流量的接口端口或发送流量的设备的 MAC 地址,可以将任何交换机上的流量分配给特定 VLAN。
在同一物理接口上配置的两个逻辑接口不能映射到同一个 VLAN。
根据接口端口源分配 VLAN 流量
此方法最常用于将流量分配给 VLAN。在这种情况下,您指定将特定交换机接口上接收的所有流量分配给特定的 VLAN。您在配置交换机时配置此 VLAN 分配,方法是使用 VLAN 编号(称为 VLAN ID),或者使用 VLAN 名称,然后交换机将其转换为数字 VLAN ID。此方法称为创建 VLAN 成员资格,因为它是最常用的方法,用于运行支持 ELS 的 Junos OS 的交换机。对于运行不支持 ELS 的 Junos OS 的 EX 交换机,只能使用 VLAN 编号配置交换机。
根据源 MAC 地址分配 VLAN 流量
在这种情况下,发往特定 MAC 地址的所有流量都将转发到交换机上的特定出口接口(下一跃点)。基于 MAC 的 VLAN 可以是静态 的(通过配置), 也可以是动态 的(通过 802.1X 身份验证)。
要在支持 ELS 的交换机上配置基于 MAC 的静态 VLAN,请参阅向以太网交换表添加静态 MAC 地址条目。要在不支持 ELS 的交换机上配置基于 MAC 的静态 VLAN,请参阅向以太网交换表添加静态 MAC 地址条目。
有关使用 802.1X 身份验证来验证终端设备并允许访问 RADIUS 服务器上配置的动态 VLAN 的信息,请参阅了解使用 RADIUS 属性的动态 VLAN 分配。您可以选择性地实施此功能,以将 VLAN 流量的手动分配转移到自动化的 RADIUS 服务器数据库。
转发 VLAN 流量
要在 VLAN 内传递流量,交换机使用第 2 层转发协议,包括 IEEE 802.1Q 生成树协议。
要在两个 VLAN 之间传递流量,交换机使用标准第 3 层路由协议,例如静态路由、OSPF 和 RIP。支持第 2 层桥接协议的相同接口也支持第 3 层路由协议,从而提供多层交换。
要将流量从访问端口上的单个设备传递到交换机,然后在中继端口上传递这些数据包,请使用之前在中继模式下讨论过的本机模式配置。
VLAN 与集成路由和桥接接口通信
传统上,交换机会将流量发送到属于同一广播域 (VLAN) 的主机,但需要路由器才能将流量从一个广播域路由到另一个。此外,只有路由器执行其他第 3 层功能,如流量工程。
交换机 使用名为 irb 的集成路由和桥接 (IRB) 接口执行 VLAN 间路由功能 这些接口会检测 MAC 地址和 IP 地址,并将数据路由到第 3 层接口,因此通常无需同时使用交换机和路由器。
要配置 IRB 接口,请参阅 第 2 层网络。
VPLS 端口
您可以在虚拟交换机中配置 VPLS 端口,而不是这种类型的 vpls 专用路由实例,以便虚拟交换机中第 2 层 VLAN 的逻辑接口可以处理 VPLS 路由实例流量。在第 2 层中继接口上收到的数据包在具有相同 VLAN 标识符的 VLAN 内转发。
另请参阅
启用 VLAN
VLAN 必须包含一组参与第 2 层学习和转发的逻辑接口。您可以选择为 VLAN 配置 VLAN 标识符和第 3 层接口,使其也支持第 3 层 IP 路由。要配置 VLAN,请参阅 第 2 层网络。
要启用 VLAN,请包括以下语句:
[edit] vlans { vlan-name { interface interface-name; l3-interface interface-name; vlan-id (none | all | number); vlan-id-list [ vlan-id-numbers ]; vlan-tags outer number inner number); } }
不能在 VLAN 名称中使用斜杠 (/) 字符。否则,配置不会提交,并且会生成错误。
vlan-id
对于语句,您可以指定有效的 VLAN 标识符或noneall或选项。
要在 VLAN 中包含一个或多个逻辑接口,请为您在层次结构级别配置[edit interfaces]
的以太网接口指定 。interface-name
对于一个 VLAN 或为第 2 层桥接配置的虚拟专用 LAN 服务 (VPLS) 实例中的每个网格组,最多支持 4096 个活动逻辑接口。
默认情况下,每个 VLAN 都有一个第 2 层转发数据库,其中包含从属于该 VLAN 的端口上接收的数据包中获知的媒体访问控制 (MAC) 地址。您可以修改第 2 层转发属性,例如,禁用整个系统或 VLAN 的 MAC 学习,为特定逻辑接口添加静态 MAC 地址,以及限制整个系统、VLAN 或逻辑接口获知的 MAC 地址数。
您还可以配置生成树协议以防止转发环路。
在具有增强型第 2 层支持的交换机上配置 VLAN
交换机使用 VLAN 对具有自己的广播域的网络节点进行逻辑分组。您可以使用 VLAN 来限制流经整个 LAN 的流量,并减少冲突和数据包重新传输。 要配置第 2 层接口,请参阅 第 2 层网络。
这些步骤也适用于 ACX 路由器、SRX 防火墙和 NFX 系列设备。
有关 ELS 的详细信息,请参阅使用增强型第 2 层软件 CLI。
从 Junos OS 17.1R3 版开始,在 QFX10000 交换机上,不能同时配置具有 family ethernet-switching
和 的 flexible-vlan-tagging
接口。不支持此配置,如果尝试提交此配置,将发出警告。
在同一物理接口上配置的两个逻辑接口不能映射到同一个 VLAN ,也不能具有重叠的 VLAN ID。
对于 VLAN 上的每个端点,在相应接口上配置以下 VLAN 参数:
另请参阅
在没有增强型第 2 层支持的 QFX 交换机上配置 VLAN
交换机使用 VLAN 对具有自己的广播域的网络节点进行逻辑分组。您可以使用 VLAN 来限制流经整个 LAN 的流量,并减少冲突和数据包重新传输。
对于 VLAN 上的每个端点,在相应接口上配置以下 VLAN 参数:
另请参阅
在没有增强型第 2 层支持的 EX 交换机上配置 VLAN
EX 系列交换机可使用 VLAN 对自身带有广播域的网络节点进行逻辑分组。VLAN 可限制通过整个 LAN 的流量,从而减少冲突和数据包重新传输的情况。
为什么要创建 VLAN?
创建 VLAN 的部分原因有:
LAN 可拥有超过 200 台设备。
LAN 可容纳大量广播流量。
一组客户端要求将高于平均级别的安全性应用于进入或退出该组设备的流量。
一组客户端要求该组设备接收的广播流量要少于它们当前接收的流量,从而提升组间的数据传输速度。
使用最小过程创建 VLAN
创建 VLAN 需要执行两个步骤:
为 VLAN 指定唯一的标识符。为此,您可以为 VLAN 分配名称或 ID(或两者)。仅分配 VLAN 名称时,Junos OS 会生成一个 ID。
将至少一个交换机端口接口分配给 VLAN 进行通信。单个 VLAN 中的所有接口均位于单个广播域中,即使这些接口位于不同交换机上也是如此。您可以通过引用发送流量的接口或发送流量设备的 MAC 地址,将任何交换机上的流量分配给特定 VLAN。
以下示例仅使用两个必需步骤创建 VLAN。创建的 VLAN 名称为 employee-vlan。然后,将三个接口分配给该 VLAN,以便在这些接口之间传输流量。
在此示例中,您也可以为 VLAN 分配一个 ID 号。要求是 VLAN 具有唯一 ID。
[edit] set vlans employee-vlan [edit] set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members employee-vlan [edit] set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members employee-vlan [edit] set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members employee-vlan
在此示例中,连接到接口 ge-0/0/1、ge-0/0/2 和 ge-0/0/3 的所有用户可相互通信,但不能与此网络中其他接口上的用户进行通信。要配置 VLAN 之间的通信,必须配置路由 VLAN 接口 (RVI)。请参阅在交换机上配置路由 VLAN 接口 (CLI 过程)。
使用所有选项创建 VLAN
要配置 VLAN,请执行以下步骤:
VLAN 配置准则
创建 VLAN 需要执行两个步骤。您必须唯一标识 VLAN,并且必须为 VLAN 分配至少一个交换机端口接口以进行通信。
创建 VLAN 后,所有用户 连接到分配给该 VLAN 的接口的所有用户都可以相互通信,但不能与网络中其他接口上的用户通信。要配置 VLAN 之间的通信,必须配置路由 VLAN 接口 (RVI)。请参阅 在交换机上配置路由 VLAN 接口(CLI 过程) 以创建 RVI。
每个交换机支持的 VLAN 数因交换机类型而异。使用命令 set vlans id vlan-id ?
发现交换机上允许的最大 VLAN 数。您无法超过此 VLAN 限制,因为每个 VLAN 在创建时,系统都会为其分配一个 ID 号。但是,您可以超过建议的 VLAN 成员最大值。要确定交换机上允许的最大 VLAN 成员数,请将使用乘以 8 获得 set vlans id vlan-id ?
的 VLAN 最大值乘以。
如果交换机配置超过建议的 VLAN 成员数上限,则在提交配置时会看到一条警告消息。如果忽略警告并提交此类配置,则配置会成功,但由于内存分配失败,您将面临以太网交换进程 (eswd) 崩溃的风险。
当 EX2300 和 EX3400 ERPS 交换机的 VLAN-ID 在接口层次结构下配置了名称时,会发生提交错误。当 VLAN-ID 位于交换机中配置了 ERPS 的接口层次结构下时,请使用数字配置 VLAN-ID,为避免这种情况。
示例:在安全设备上配置 VLAN
此示例说明如何配置 VLAN。
要求
准备工作:
确定要使用的接口并验证它们是否处于交换模式。请参阅了解 VLAN。
确定要在设备上使用的端口以及如何对网络进行分段。请参阅 安全设备的以太网端换概述。
概述
在此示例中,您将创建一个新的 VLAN,然后配置其属性。您可以配置一个或多个 VLAN 来执行第 2 层交换。第 2 层交换功能包括集成路由和桥接 (IRB),支持同一接口上的第 2 层交换和第 3 层 IP 路由。SRX 系列防火墙 可以用作第 2 层交换机,每台交换机都有多个加入同一第 2 层网络的交换域或广播域。
配置
程序
CLI 快速配置
要快速配置此示例,请复制以下命令,将其粘贴到文本文件中,删除所有换行符,更改详细信息,以便与网络配置匹配,将命令复制并粘贴到 [edit]
层级的 CLI 中,然后从配置模式进入 commit
。
set interfaces ge-0/0/1 unit 0 family ethernet-switching interface-mode access set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members v10 set vlans v10 vlan-id 10 set vlans v10 l3-interface irb.10 set interfaces irb unit 10 family inet address 198.51.100.0/24
分步过程
下面的示例要求您在各个配置层级中进行导航。有关操作说明,请参阅 CLI 用户指南中的在配置模式下使用 CLI 编辑器。
要配置 VLAN:
将千兆以太网接口或 10 千兆以太网接口配置为接入接口:
[edit interfaces] user@host# set ge-0/0/1 unit 0 family ethernet-switching interface-mode access
通过指定逻辑接口(使用 unit 语句)并将 VLAN 名称指定为成员,为 VLAN 分配接口。
[edit interfaces] user@host# set ge-0/0/1 unit 0 family ethernet-switching vlan members v10
通过设置唯一 VLAN 名称和配置 VLAN ID 来创建 VLAN。
[edit] user@host# set vlans v10 vlan-id 10
将第 3 层接口与 VLAN 绑定。
[edit] user@host# set vlans v10 l3-interface irb.10
为 VLAN 的广播域创建子网。
[edit interfaces] user@host# set irb unit 10 family inet address 198.51.100.0/24
结果
在配置模式下,输入 show vlans
命令以确认您的配置。如果输出未显示预期的配置,请重复此示例中的配置说明,以便进行更正。
[edit] user@host# show vlans v10 { vlan-id 10; l3-interface irb.10; } user@host# show interfaces ge-0/0/1 { unit 0 { family ethernet-switching { interface-mode access; vlan { members v10; } } } } irb { unit 10 { family inet { address 198.51.100.0/24; } } }
如果完成设备配置,请从配置模式输入 commit
。
示例:为支持 ELS 的 EX 系列交换机设置基本桥接和 VLAN
此示例使用支持增强型第 2 层软件 (ELS) 配置样式的 EX 系列交换机的 Junos OS。如果交换机运行的 Junos OS 不支持 ELS,请参阅 示例:为 EX 系列交换机设置基本桥接和 VLAN。有关 ELS 的详细信息,请参阅使用增强型第 2 层软件 CLI。
EX 系列交换机使用桥接和虚拟 LAN (VLAN) 连接 LAN 中的网络设备(台式计算机或笔记本电脑、IP 电话、打印机、文件服务器、无线接入点等),并将 LAN 划分为较小的广播域。
此示例介绍如何在 EX 系列交换机上配置基本桥接和 VLAN:
要求
此示例使用以下硬件和软件组件:
一台 EX 系列交换机
适用于 EX 系列交换机的 Junos OS 13.2X50-D10 或更高版本
在设置桥接和 VLAN 之前,请确保您已:
已安装EX系列交换机。请参阅交换机的安装说明。
已执行初始交换机配置。请参阅连接和配置 EX 系列交换机(CLI 过程)。
概述和拓扑
EX 系列交换机连接办公室 LAN 或数据中心 LAN 中的网络设备,以实现打印机和文件服务器等公共资源的共享,并使无线设备能够通过无线接入点连接到 LAN。如果没有桥接和 VLAN,以太网 LAN 上的所有设备均会处于一个广播域中,并且将检测到 LAN 上的全部数据包。桥接可在 LAN 上创建单独的广播域,从而搭建 VLAN 网络,该网络是一种独立的逻辑网络,可将相关设备分组到不同的网段中。VLAN 上的设备分组与设备在 LAN 中的物理位置无关。
要使用 EX 系列交换机连接 LAN 上的网络设备,您必须至少显式配置至少一个 VLAN,即使您的网络很简单,并且您只希望存在一个广播域(如本例所示)。您还必须将所有需要的接口分配给 VLAN,之后接口在接入模式下运行。配置 VLAN 后,您可以将台式或笔记本电脑、IP 电话、文件服务器、打印机和无线接入点等接入设备插入交换机,这些设备会立即加入 VLAN,LAN 即可启动并运行。
此示例中使用的拓扑由一台 EX4300-24P 交换机组成,该交换机共有 24 个端口。所有端口都支持以太网供电 (PoE),这意味着它们为连接到端口的设备提供网络连接和电力。对于这些端口,您可以插入需要 PoE 的设备,例如 Avaya VoIP 电话、无线接入点和一些 IP 摄像机。(Avaya手机具有内置集线器,可让您将台式PC连接到手机,因此单个办公室中的台式机和电话只需要交换机上的一个端口。 表 1 详细说明此配置示例中使用的拓扑。
属性 | 设置 |
---|---|
交换机硬件 |
EX4300-24P 交换机,带 24 个千兆以太网端口:在此示例中,8 个端口用作 PoE 端口(ge-0/0/0 到 ge-0/0/7),16 个端口用作非 PoE 端口(ge-0/0/8 到 ge-0/0/23) |
VLAN 名称 |
员工-VLAN |
虚拟帧 ID |
10 |
连接到无线接入点(需要 PoE) |
ge-0/0/0 |
连接至 Avaya IP 电话 — 通过集成集线器,将电话和台式电脑连接至单个端口(需要 PoE) |
ge-0/0/1 至 ge-0/0/7 |
直接连接到台式电脑和笔记本电脑(无需 PoE) |
ge-0/0/8 到 ge-0/0/12 |
连接到文件服务器(无需 PoE) |
ge-0/0/17 和 ge-0/0/18 |
连接到集成打印机/传真机/复印机(无需 PoE) |
ge-0/0/19 到 ge-0/0/20 |
未使用的端口(用于将来扩展) |
ge-0/0/13 到 ge-0/0/16,以及 ge-0/0/21 到 ge-0/0/23 |
拓扑学
配置
要设置基本桥接和 VLAN,请执行以下操作:
程序
CLI 快速配置
要快速配置 VLAN,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set vlans employee-vlan vlan-id 10 set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/4 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/5 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/6 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/7 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/8 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/9 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/10 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/11 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/12 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/17 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/18 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/19 unit 0 family ethernet-switching vlan members employee-vlan set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members employee-vlan
然后,您必须将无线接入点插入支持 PoE 的端口ge-0/0/0
,并将 Avaya IP 电话通过 插入ge-0/0/7支持 PoE 的端口ge-0/0/1。此外,将 PC、文件服务器和打印机通过 ge-0/0/12ge-0/0/17ge-0/0/20插入端口。ge-0/0/8
分步过程
要设置基本桥接和 VLAN,请执行以下操作:
创建名为 employee-vlan 的 VLAN,并为其指定 VLAN ID 为 10:
[edit vlans] user@switch# set employee-vlan vlan-id 10
将接口 ge-0/0/0 到 ge-0/0/12 和 ge-0/0/17 到 ge-0/0/20 分配给员工 VLAN:
[edit interface] user@switch# set ge-0/0/0 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/1 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/2 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/3 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/4 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/5 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/6 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/7 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/8 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/9 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/10 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/11 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/12 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/17 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/18 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/19 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set ge-0/0/20 unit 0 family ethernet-switching vlan members employee-vlan
将无线接入点连接到交换机端口 ge-0/0/0。
将七部 Avaya 手机连接到将端口 ge-0/0/1 切换到 ge-0/0/7。
将这五台电脑连接到端口 ge-0/0/8 到 ge-0/0/12。
将两个文件服务器连接到端口 ge-0/0/17 和 ge-0/0/18。
将两台打印机连接到端口 ge-0/0/19 和 ge-0/0/20。
结果
检查配置结果:
user@switch> show configuration ge-0/0/0 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/1 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/2 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/3 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/4 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/5 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/6 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/7 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/8 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/9 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/10 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/11 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/12 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/17 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/18 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/19 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } ge-0/0/20 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } }
验证
要验证交换是否正常运行以及 employee-vlan
是否已创建交换,请执行以下任务:
验证是否已创建 VLAN
目的
验证是否已在交换机上创建名为 employee-vlan 的 VLAN。
操作
列出交换机上配置的所有 VLAN:
user@switch> show vlans Routing instance VLAN name Tag Interfaces default-switch employee-vlan 10 ge-0/0/0.0 ge-0/0/1.0 ge-0/0/2.0 ge-0/0/3.0 ge-0/0/4.0 ge-0/0/5.0 ge-0/0/6.0 ge-0/0/7.0 ge-0/0/8.0 ge-0/0/9.0 ge-0/0/10.0 ge-0/0/11.0 ge-0/0/12.0 ge-0/0/17.0 ge-0/0/18.0 ge-0/0/19.0 ge-0/0/20.0 ...
意义
命令将 show vlans
列出交换机上配置的 VLAN。此输出显示 VLAN employee-vlan 已创建。
验证接口是否与正确的 VLAN 相关联
目的
验证交换机接口上是否启用了以太网交换,以及 VLAN 中是否包含所有接口。
操作
列出启用了交换的所有接口:
user@switch> show ethernet-switching interfaces Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/0.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/1.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/2.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/3.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/4.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/5.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/6.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/7.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/8.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/9.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/10.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/11.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/12.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/17.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/18.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/19.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags ge-0/0/20.0 65535 untagged employee-vlan 10 65535 Discarding ...
意义
命令将 show ethernet-switching interfaces
列出启用了交换的所有接口(在列中 Logical interface ),以及接口上处于活动状态的 VLAN(在列中 VLAN members )。此示例中的输出显示所有连接的接口,ge-0/0/0 到 ge-0/0/12 和 ge-0/0/17 到 ge-0/0/20,并且它们都是 VLAN employee-vlan的一部分。请注意,列出的接口是逻辑接口,而不是物理接口。例如,输出显示 ge-0/0/0.0 而不是 ge-0/0/0。这是因为 Junos OS 在逻辑接口上创建 VLAN,而不是直接在物理接口上创建 VLAN。
示例:在交换机上设置基本桥接和 VLAN
QFX 系列产品使用桥接和虚拟 LAN (VLAN) 将网络设备(存储设备、文件服务器和其他 LAN 组件)连接到 LAN,并将 LAN 分段为较小的桥接域。
要将 LAN 上的流量分段到单独的广播域中,请在交换机上创建单独的虚拟 LAN (VLAN)。每个 VLAN 都是网络节点的集合。使用 VLAN 时,源帧和目的地址在同一 VLAN 中的帧仅在本地 VLAN 中转发,只有不发往本地 VLAN 的帧才会转发到其他广播域。因此,VLAN 可限制流经整个 LAN 的流量,从而减少 LAN 内可能发生的冲突和数据包重新传输次数。
您不能配置属于同一网桥域中同一物理接口的多个逻辑接口。
此示例介绍如何为 QFX 系列配置基本桥接和 VLAN:
要求
此示例使用以下软件和硬件组件:
适用于 QFX 系列的 Junos OS 11.1 或更高版本
已配置和调配的 QFX 系列产品
概述和拓扑
要使用交换机连接 LAN 上的网络设备,必须至少配置桥接和 VLAN。默认情况下,在所有交换机接口上启用桥接,所有接口都处于接入模式,并且所有接口都属于名为 的 employee-vlanVLAN,该 VLAN 会自动配置。当您插入接入设备(如台式计算机、文件服务器和打印机)时,这些设备会立即加入 employee-vlan VLAN,LAN 即可启动并运行。
此示例中使用的拓扑由单个 QFX3500 交换机组成,共有 48 个 10-Gbps 以太网端口。(就此示例而言,不包括 QSFP+ 端口 Q0-Q3,即端口 xe-0/1/0 到 xe-0/1/15。您可以使用端口连接具有自己的电源的设备。表 1 详细介绍了此配置示例中使用的拓扑。
属性 |
设置 |
---|---|
交换机硬件 |
QFX3500交换机,带 48 个 10-Gbps 以太网端口 |
VLAN 名称 |
employee-vlan |
虚拟帧 ID |
10 |
与文件服务器的连接 |
xe-0/0/17 和 xe-0/0/18 |
直接连接到台式电脑和笔记本电脑 |
xe-0/0/0 通过 xe-0/0/16 |
与集成打印机/传真机/复印机的连接 |
xe-0/0/19 通过 xe-0/0/40 |
未使用的端口 |
xe-0/0/41 通过 xe-0/0/47 |
拓扑学
配置
程序
CLI 快速配置
要快速配置 VLAN,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set vlans employee-vlan vlan-id 10 set interfaces xe-0/0/0 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/1 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/2 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/3 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/4 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/5 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/6 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/7 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/8 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/9 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/10 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/11 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/12 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/13 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/14 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/15 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/16 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/17 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/18 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/19 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/20 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/21 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/22 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/23 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/24 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/25 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/26 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/27 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/28 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/29 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/30 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/31 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/32 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/33 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/34 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/35 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/36 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/37 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/38 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/39 unit 0 family ethernet-switching vlan members employee-vlan set interfaces xe-0/0/40 unit 0 family ethernet-switching vlan members employee-vlan
分步过程
要设置基本桥接和 VLAN,请执行以下操作:
创建名为 employee-vlan 的 VLAN,并为其指定 VLAN ID 为 10:
[edit vlans] user@switch# set employee-vlan vlan-id 10
将接口 xe-0/0/0 到 xe-0/0/40 分配给员工 VLAN:
[edit interface] user@switch# set xe-0/0/0 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/1 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/2 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/3 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/4 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/5 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/6 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/7 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/8 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/9 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/10 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/11 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/12 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/13 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/14 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/15 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/16 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/17 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/18 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/19 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/20 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/21 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/22 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/23 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/24 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/25 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/26 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/27 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/28 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/29 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/30 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/31 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/32 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/33 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/34 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/35 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/36 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/37 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/38 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/39 unit 0 family ethernet-switching vlan members employee-vlan user@switch# set xe-0/0/40 unit 0 family ethernet-switching vlan members employee-vlan
将两个文件服务器连接到端口 xe-0/0/17 和 xe-0/0/18。
将台式电脑和笔记本电脑连接到端口 xe-0/0/0 到 xe-0/0/16。
将集成打印机/传真机/复印机连接到端口 xe-0/0/19 到 xe-0/0/40。
结果
检查配置结果:
user@switch> show configuration xe-0/0/0 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/1 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/2 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/3 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/4 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/5 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/6 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/7 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/8 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/9 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/10 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/11 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/12 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/13 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/14 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/15 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/16 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/17 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/18 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/19 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/20 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/21 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/22 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/23 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/24 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/25 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/26 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/27 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/28 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/29 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/30 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/31 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/32 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/33 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/34 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/35 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/36 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/37 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/38 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/39 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } } xe-0/0/40 { unit 0 { family ethernet-switching { vlan { members employee-vlan; } } } }
验证
要验证交换是否正常运行以及 employee-vlan
是否已创建交换,请执行以下任务:
验证是否已创建 VLAN
目的
验证是否已在交换机上创建名为 employee-vlan 的 VLAN。
操作
列出交换机上配置的所有 VLAN:
user@switch> show vlans Routing instance VLAN name Tag Interfaces default-switch employee-vlan 10 xe-0/0/0.0 xe-0/0/1.0 xe-0/0/2.0 xe-0/0/3.0 xe-0/0/4.0 xe-0/0/5.0 xe-0/0/6.0 xe-0/0/7.0 xe-0/0/8.0 xe-0/0/9.0 xe-0/0/10.0 xe-0/0/11.0 xe-0/0/12.0 xe-0/0/13.0 xe-0/0/14.0 xe-0/0/15.0 xe-0/0/16.0 xe-0/0/17.0 xe-0/0/18.0 xe-0/0/19.0 xe-0/0/20.0 xe-0/0/21.0 xe-0/0/22.0 xe-0/0/23.0 xe-0/0/24.0 xe-0/0/25.0 xe-0/0/26.0 xe-0/0/27.0 xe-0/0/28.0 xe-0/0/29.0 xe-0/0/30.0 xe-0/0/31.0 xe-0/0/32.0 xe-0/0/33.0 xe-0/0/34.0 xe-0/0/35.0 xe-0/0/36.0 xe-0/0/37.0 xe-0/0/38.0 xe-0/0/39.0 xe-0/0/40.0 ...
意义
命令将 show vlans
列出交换机上配置的 VLAN。此输出显示 VLAN employee-vlan 已创建。
验证接口是否与正确的 VLAN 相关联
目的
验证交换机接口上是否启用了以太网交换,以及 VLAN 中是否包含所有接口。
操作
列出启用了交换的所有接口:
user@switch> show ethernet-switching interfaces Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/0.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/1.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/2.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/3.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/4.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/5.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/6.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/7.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/8.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/9.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/10.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/11.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/12.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/13.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/14.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/15.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/16.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/17.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/18.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/19.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/20.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/21.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/22.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/23.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/24.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/25.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/26.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/27.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/28.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/29.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/30.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/31.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/32.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/33.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/34.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/35.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/36.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/37.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/38.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/39.0 65535 untagged employee-vlan 10 65535 Discarding Routing Instance Name : default-switch Logical Interface flags (DL - disable learning, AD - packet action drop, LH - MAC limit hit, DN - interface down ) Logical Vlan TAG MAC STP Logical Tagging interface members limit state interface flags xe-0/0/40.0 65535 untagged employee-vlan 10 65535 Discarding ...
意义
命令将 show ethernet-switching interfaces
列出启用了交换的所有接口(在列中 Logical interface ),以及接口上处于活动状态的 VLAN(在列中 VLAN members )。此示例中的输出显示所有连接的接口(xe-0/0/0 到 xe-0/0/40)都是 VLAN employee-vlan的一部分。请注意,列出的接口是逻辑接口,而不是物理接口。例如,输出显示 xe-0/0/0.0 而不是 xe-0/0/0。这是因为 Junos OS 在逻辑接口上创建 VLAN,而不是直接在物理接口上创建 VLAN。
示例:为 EX 系列交换机设置基本桥接和 VLAN
此示例将 Junos OS 用于不支持增强型第 2 层软件 (ELS) 配置样式的 EX 系列交换机。如果您的交换机运行支持 ELS 的软件,请参阅 示例:为支持 ELS 的 EX 系列交换机设置基本桥接和 VLAN。有关 ELS 的详细信息,请参阅 使用增强型第 2 层软件 CLI
EX 系列交换机使用桥接和虚拟 LAN (VLAN) 连接 LAN 中的网络设备(台式计算机、IP 电话、打印机、文件服务器、无线接入点等),并将 LAN 分段为较小的桥接域。交换机的默认配置提供桥接和单个 VLAN 的快速设置。
此示例介绍如何为 EX 系列交换机配置基本桥接和 VLAN:
要求
此示例使用以下软件和硬件组件:
适用于 EX 系列交换机的 Junos OS 9.0 或更高版本
一台 EX4200 虚拟机箱交换机
在设置桥接和 VLAN 之前,请确保您已:
已执行初始交换机配置。请参阅连接和配置 EX 系列交换机(J-Web 过程)。
概述和拓扑
EX 系列交换机连接办公室 LAN 或数据中心 LAN 中的网络设备,以实现打印机和文件服务器等公共资源的共享,并使无线设备能够通过无线接入点连接到 LAN。如果没有桥接和 VLAN,以太网 LAN 上的所有设备均会处于一个广播域中,并且将检测到 LAN 上的全部数据包。桥接可在 LAN 上创建单独的广播域,从而搭建 VLAN 网络,该网络是一种独立的逻辑网络,可将相关设备分组到不同的网段中。VLAN 上的设备分组与设备在 LAN 中的物理位置无关。
要使用 EX 系列交换机连接 LAN 上的网络设备,至少必须配置桥接和 VLAN。如果只是打开交换机电源并使用出厂默认设置执行初始交换机配置,则会在交换机的所有接口上启用桥接,所有接口都处于接入模式,并且所有接口都属于名为 的 defaultVLAN,该 VLAN 会自动配置。当您将台式计算机、Avaya IP 电话、文件服务器、打印机和无线接入点等接入设备插入交换机时,这些设备会立即加入 default VLAN,LAN 即可启动并运行。
此示例中使用的拓扑由一台 EX4200-24T 交换机组成,该交换机共有 24 个端口。其中 8 个端口支持以太网供电 (PoE),这意味着它们为连接到端口的设备提供网络连接和电力。对于这些端口,您可以插入需要 PoE 的设备,例如 Avaya VoIP 电话、无线接入点和一些 IP 摄像机。(Avaya手机具有内置集线器,可让您将台式PC连接到手机,因此单个办公室中的台式机和电话只需要交换机上的一个端口。其余 16 个端口仅提供网络连接。您可以使用它们来连接具有自己的电源的设备,例如台式机和笔记本电脑、打印机和服务器。 表 3 详细说明此配置示例中使用的拓扑。
属性 | 设置 |
---|---|
交换机硬件 |
EX4200-24T 交换机,带 24 个千兆以太网端口:8 个 PoE 端口(ge-0/0/0 到 ge-0/0/7)和 16 个非 PoE 端口(ge-0/0/8 到 ge-0/0/23) |
VLAN 名称 |
default |
连接到无线接入点(需要 PoE) |
ge-0/0/0 |
连接至 Avaya IP 电话 — 通过集成集线器,将电话和台式电脑连接至单个端口(需要 PoE) |
ge-0/0/1 通过 ge-0/0/7 |
直接连接到台式电脑(无需 PoE) |
ge-0/0/8 通过 ge-0/0/12 |
连接到文件服务器(无需 PoE) |
ge-0/0/17 和 ge-0/0/18 |
连接到集成打印机/传真机/复印机(无需 PoE) |
ge-0/0/19 通过 ge-0/0/20 |
未使用的端口(用于将来扩展) |
ge-0/0/13 通过 ge-0/0/16,再 ge-0/0/21 通过 ge-0/0/23 |
拓扑学
配置
程序
CLI 快速配置
默认情况下,在 EX4200 交换机上执行初始配置后,将在所有接口上启用交换,创建一个名为 default 的 VLAN,并将所有接口放入此 VLAN。您无需在交换机上执行任何其他配置即可设置桥接和 VLAN。要使用交换机,只需通过 将 Avaya IP 电话插入支持 PoE 的端口ge-0/0/1,然后将 PC、文件服务器和打印机完全插入非 PoE 端口ge-0/0/20ge-0/0/17ge-0/0/12ge-0/0/8即可。ge-0/0/7
分步过程
要配置桥接和 VLAN:
确保交换机已通电。
将无线接入点连接到交换机端口 ge-0/0/0。
连接七部 Avaya 手机,通过 切换ge-0/0/7端口ge-0/0/1。
通过 将ge-0/0/12五台 PC 连接到端口ge-0/0/8。
将两个文件服务器连接到端口 ge-0/0/17 和 ge-0/0/18。
将两台打印机连接到端口 ge-0/0/19 和 ge-0/0/20。
结果
检查配置结果:
user@switch> show configuration ## Last commit: 2008-03-06 00:11:22 UTC by triumph version 9.0; system { root-authentication { encrypted-password "$1$urmA7AFM$x5SaGEUOdSI3u1K/iITGh1"; ## SECRET-DATA } syslog { user * { any emergency; } file messages { any notice; authorization info; } file interactive-commands { interactive-commands any; } } commit { factory-settings { reset-chassis-lcd-menu; reset-virtual-chassis-configuration; } } } interfaces { ge-0/0/0 { unit 0 { family ethernet-switching; } } ge-0/0/1 { unit 0 { family ethernet-switching; } } ge-0/0/2 { unit 0 { family ethernet-switching; } } ge-0/0/3 { unit 0 { family ethernet-switching; } } ge-0/0/4 { unit 0 { family ethernet-switching; } } ge-0/0/5 { unit 0 { family ethernet-switching; } } ge-0/0/6 { unit 0 { family ethernet-switching; } } ge-0/0/7 { unit 0 { family ethernet-switching; } } ge-0/0/8 { unit 0 { family ethernet-switching; } } ge-0/0/9 { unit 0 { family ethernet-switching; } } ge-0/0/10 { unit 0 { family ethernet-switching; } } ge-0/0/11 { unit 0 { family ethernet-switching; } } ge-0/0/12 { unit 0 { family ethernet-switching; } } ge-0/0/13 { unit 0 { family ethernet-switching; } } ge-0/0/14 { unit 0 { family ethernet-switching; } } ge-0/0/15 { unit 0 { family ethernet-switching; } } ge-0/0/16 { unit 0 { family ethernet-switching; } } ge-0/0/17 { unit 0 { family ethernet-switching; } } ge-0/0/18 { unit 0 { family ethernet-switching; } } ge-0/0/19 { unit 0 { family ethernet-switching; } } ge-0/0/20 { unit 0 { family ethernet-switching; } } ge-0/0/21 { unit 0 { family ethernet-switching; } } ge-0/0/22 { unit 0 { family ethernet-switching; } } ge-0/0/23 { unit 0 { family ethernet-switching; } } ge-0/1/0 { unit 0 { family ethernet-switching; } } xe-0/1/0 { unit 0 { family ethernet-switching; } } ge-0/1/1 { unit 0 { family ethernet-switching; } } xe-0/1/1 { unit 0 { family ethernet-switching; } } ge-0/1/2 { unit 0 { family ethernet-switching; } } ge-0/1/3 { unit 0 { family ethernet-switching; } } } protocols { lldp { interface all; } rstp; } poe { interface all; }
验证
要验证交换是否正常运行以及是否已创建 VLAN,请执行以下操作:
验证是否已创建 VLAN
目的
验证是否已在交换机上创建名为 default 的 VLAN。
操作
列出交换机上配置的所有 VLAN:
user@switch> show vlans Name Tag Interfaces default ge-0/0/0.0*, ge-0/0/1.0, ge-0/0/2.0, ge-0/0/3.0, ge-0/0/4.0, ge-0/0/5.0, ge-0/0/6.0, ge-0/0/7.0, ge-0/0/8.0*, ge-0/0/9.0, ge-0/0/10.0, ge-0/0/11.0*, ge-0/0/12.0, ge-0/0/13.0, ge-0/0/14.0, ge-0/0/15.0, ge-0/0/16.0, ge-0/0/17.0, ge-0/0/18.0, ge-0/0/19.0*, ge-0/0/20.0, ge-0/0/21.0, ge-0/0/22.0, ge-0/0/23.0, ge-0/1/0.0*, ge-0/1/1.0*, ge-0/1/2.0*, ge-0/1/3.0* mgmt me0.0*
意义
命令将 show vlans
列出交换机上配置的 VLAN。此输出显示 VLAN default 已创建。
验证接口是否与正确的 VLAN 相关联
目的
验证交换机接口上是否启用了以太网交换,以及 VLAN 中是否包含所有接口。
操作
列出启用了交换的所有接口:
user@switch> show ethernet-switching interfaces Interface State VLAN members Blocking ge-0/0/0.0 up default unblocked ge-0/0/1.0 down default blocked - blocked by STP/RTG ge-0/0/2.0 down default blocked - blocked by STP/RTG ge-0/0/3.0 down default blocked - blocked by STP/RTG ge-0/0/4.0 down default blocked - blocked by STP/RTG ge-0/0/5.0 down default blocked - blocked by STP/RTG ge-0/0/6.0 down default blocked - blocked by STP/RTG ge-0/0/7.0 down default blocked - blocked by STP/RTG ge-0/0/8.0 up default unblocked ge-0/0/9.0 down default blocked - blocked by STP/RTG ge-0/0/10.0 down default blocked - blocked by STP/RTG ge-0/0/11.0 up default unblocked ge-0/0/12.0 down default blocked - blocked by STP/RTG ge-0/0/13.0 down default blocked - blocked by STP/RTG ge-0/0/14.0 down default blocked - blocked by STP/RTG ge-0/0/15.0 down default blocked - blocked by STP/RTG ge-0/0/16.0 down default blocked - blocked by STP/RTG ge-0/0/17.0 down default blocked - blocked by STP/RTG ge-0/0/18.0 down default blocked - blocked by STP/RTG ge-0/0/19.0 up default unblocked ge-0/0/20.0 down default blocked - blocked by STP/RTG ge-0/0/21.0 down default blocked - blocked by STP/RTG ge-0/0/22.0 down default blocked - blocked by STP/RTG ge-0/0/23.0 down default blocked - blocked by STP/RTG ge-0/1/0.0 up default unblocked ge-0/1/1.0 up default unblocked ge-0/1/2.0 up default unblocked ge-0/1/3.0 up default unblocked me0.0 up mgmt unblocked
意义
命令将 show ethernet-switching interfaces
列出启用了交换的所有接口(在列中 Interfaces ),以及接口上处于活动状态的 VLAN(在列中 VLAN members )。此示例中的输出显示所有连接的接口, ge-0/0/0ge-0/0/12 通过和 ge-0/0/17 通过 ge-0/0/20 ,并且它们都是 VLAN default的一部分。请注意,列出的接口是逻辑接口,而不是物理接口。例如,输出显示ge-0/0/0.0ge-0/0/0而不是 。这是因为 Junos OS 在逻辑接口上创建 VLAN,而不是直接在物理接口上创建 VLAN。
示例:设置与多个 VLAN 的桥接
QFX 系列产品使用桥接和虚拟 LAN (VLAN) 连接 LAN 中的网络设备(存储设备、文件服务器和其他网络组件),并将 LAN 分段为较小的桥接域。
要将 LAN 上的流量分段到单独的广播域中,请在交换机上创建单独的虚拟 LAN (VLAN)。每个 VLAN 都是网络节点的集合。使用 VLAN 时,源帧和目的地址在同一 VLAN 中的帧仅在本地 VLAN 中转发,只有不发往本地 VLAN 的帧才会转发到其他广播域。因此,VLAN 可限制流经整个 LAN 的流量,从而减少 LAN 内可能发生的冲突和数据包重新传输次数。
此任务将 Junos OS 用于 QFX3500,QFX3600交换机不支持增强型第 2 层软件 (ELS) 配置样式。如果交换机运行的软件支持 ELS,请参阅 示例:设置与交换机上的多个 VLAN 的桥接。
此示例介绍如何为 QFX 系列配置桥接,以及如何创建两个 VLAN 来对 LAN 进行分段:
要求
此示例使用以下硬件和软件组件:
已配置和调配的 QFX3500 交换机
适用于 QFX 系列的 Junos OS 11.1 或更高版本
概述和拓扑
交换机将办公室或数据中心中的所有设备连接到单个 LAN 中,以实现文件服务器等公共资源的共享。默认配置创建一个 VLAN,交换机上的所有流量都是该广播域的一部分。创建单独的网段可缩小广播域的跨度,使您能够对相关用户和网络资源进行分组,而不受物理布线或网络设备在建筑物或 LAN 中的位置的限制。
此示例显示一个简单的配置,说明了在单个交换机上创建两个 VLAN 的基本步骤。被称为 sales 的 VLAN 用于销售和市场营销团队,另一个被称为 support 的 VLAN 用于客户支持团队。每个销售和支持组都有自己的专用文件服务器和其他资源。要跨两个 VLAN 对交换机端口进行分段,每个 VLAN 都必须有自己的广播域,由唯一的名称和标记 (VLAN ID) 标识。此外,每个 VLAN 必须位于其自己的不同 IP 子网上。
拓扑学
此示例中使用的拓扑由单个 QFX3500 交换机组成,共有 48 个 10-Gbps 以太网端口。(就此示例而言,不包括 QSFP+ 端口 Q0-Q3,即端口 xe-0/1/0 到 xe-0/1/15。
属性 |
设置 |
---|---|
交换机硬件 |
QFX3500交换机配置了 48 个 10-Gbps 以太网端口(xe-0/0/0xe-0/0/47到 ) |
VLAN 名称和标记 ID |
sales标记 100 support标记 200 |
VLAN 子网 |
sales:192.0.2.0/25(地址 192.0.2.1 到 192.0.2.126) support:192.0.2.128/25(地址 192.0.2.129 到 192.0.2.254) |
VLAN 中的接口 sales |
文件服务器:xe-0/0/20 和 xe-0/0/21 |
VLAN 中的接口 support |
文件服务器:xe-0/0/46 和 xe-0/0/47 |
未使用的接口 |
xe-0/0/2 和 xe-0/0/25 |
此配置示例创建两个 IP 子网,一个用于销售 VLAN,另一个用于支持 VLAN。交换机在 VLAN 内桥接流量。对于在两个 VLAN 之间传输的流量,交换机使用您配置了 IP 子网地址的第 3 层路由接口路由流量。
为了使示例简单易懂,配置步骤仅显示每个 VLAN 中的几个设备。使用相同的配置过程添加更多 LAN 设备。
配置
程序
CLI 快速配置
要为两个 VLAN(sales 和 support)快速配置第 2 层交换并快速配置这两个 VLAN 之间的第 3 层流量路由,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set interfaces xe-0/0/0 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/3 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/22 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/20 unit 0 description “Sales file server port” set interfaces xe-0/0/20 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/24 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/26 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/44 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/46 unit 0 description “Support file server port” set interfaces xe-0/0/46 unit 0 family ethernet-switching vlan members support set interfaces vlan unit 0 family inet address 192.0.2.0/25 set interfaces vlan unit 1 family inet address 192.0.2.128/25 set vlans sales l3–interface vlan.0 set vlans sales vlan-id 100 set vlans support vlan-id 200 set vlans support l3-interface vlan.1
分步过程
配置交换机接口及其所属的 VLAN。默认情况下,所有接口都处于接入模式,因此您无需配置端口模式。
配置 VLAN 中 sales 文件服务器的接口:
[edit interfaces xe-0/0/20 unit 0] user@switch# set description “Sales file server port” user@switch# set family ethernet-switching vlan members sales
配置 VLAN 中 support 文件服务器的接口:
[edit interfaces xe-0/0/46 unit 0] user@switch# set description “Support file server port” user@switch# set family ethernet-switching vlan members support
为 sales 广播域创建子网:
[edit interfaces] user@switch# set vlan unit 0 family inet address 192.0.2.1/25
为 support 广播域创建子网:
[edit interfaces] user@switch# set vlan unit 1 family inet address 192.0.2.129/25
为 和 salessupport VLAN 配置 VLAN 标记 ID:
[edit vlans] user@switch# set sales vlan-id 100 user@switch# set support vlan-id 200
要在 和 salessupport VLAN 之间路由流量,请定义作为每个 VLAN 成员的接口并关联第 3 层接口:
[edit vlans] user@switch# set sales l3-interface vlan.0 user@switch# set support l3-interface vlan.1
结果
显示配置结果:
user@switch> show configuration interfaces { xe-0/0/20 { unit 0 { description “Sales file server port”; family ethernet-switching { vlan members sales; } } } xe-0/0/46 { unit 0 { description “Support file server port”; family ethernet-switching { vlan members support; } } vlans { unit 0 { family inet address 192.0.2.1/25; } unit 1 { family inet address 192.0.2.129/25; } } } } vlans { sales { vlan-id 100; interface xe-0/0/0.0: interface xe-0/0/3/0; interface xe-0/0/20.0; interface xe-0/0/22.0; l3-interface vlan 0; } support { vlan-id 200; interface xe-0/0/24.0: interface xe-0/0/26.0; interface xe-0/0/44.0; interface xe-0/0/46.0; l3-interface vlan 1; } }
要快速配置销售和支持 VLAN 接口,请发出 load merge terminal
命令。然后复制层次结构并将其粘贴到交换机终端窗口中。
验证
salessupport验证是否已创建和 VLAN 且运行正常,请执行以下任务:
验证是否已创建 VLAN,以及是否已与正确的接口关联
目的
验证是否已在交换机上创建 和 salessupport VLAN,以及交换机上所有连接的接口是否都是正确 VLAN 的成员。
操作
要列出交换机上配置的所有 VLAN,请使用 show vlans
以下命令:
user@switch> show vlans Name Tag Interfaces default xe-0/0/1.0, xe-0/0/2.0, xe-0/0/4.0, xe-0/0/5.0, xe-0/0/6.0, xe-0/0/7.0, xe-0/0/8.0, xe-0/0/9.0, xe-0/0/10.0*, xe-0/0/11.0, xe-0/0/12.0, xe-0/0/13.0*, xe-0/0/14.0, xe-0/0/15.0, xe-0/0/16.0, xe-0/0/17.0, xe-0/0/18.0, xe-0/0/19.0, xe-0/0/21.0, xe-0/0/23.0*, xe-0/0/25.0, xe-0/0/27.0, xe-0/0/28.0, xe-0/0/29.0, xe-0/0/30.0, xe-0/0/31.0, xe-0/0/32.0, xe-0/0/33.0, xe-0/0/34.0, xe-0/0/35.0, xe-0/0/36.0, xe-0/0/37.0, xe-0/0/38.0, xe-0/0/39.0, xe-0/0/40.0, xe-0/0/41.0, xe-0/0/42.0, xe-0/0/43.0, xe-0/0/45.0, xe-0/0/47.0, xe-0/1/0.0*, xe-0/1/1.0*, xe-0/1/2.0*, xe-0/1/3.0* sales 100 xe-0/0/0.0*, xe-0/0/3.0, xe-0/0/20.0, xe-0/0/22.0 support 200 xe-0/0/0.24, xe-0/0/26.0, xe-0/0/44.0, xe-0/0/46.0* mgmt me0.0*
意义
show vlans
命令将列出交换机上配置的所有 VLAN 以及每个 VLAN 的成员接口。此命令输出显示已创建的 VLAN sales 和 support。VLAN sales 的标记 ID 为 100,并与接口 xe-0/0/0.0、 xe-0/0/3.0xe-0/0/20.0、 和 xe-0/0/22.0相关联。support VLAN 的标记 ID 为 200,并与接口 xe-0/0/24.0、 xe-0/0/26.0xe-0/0/44.0、 和 xe-0/0/46.0相关联。
验证流量是否在两个 VLAN 之间路由
目的
验证两个 VLAN 之间的路由。
操作
列出交换机地址解析协议 (ARP) 表中的第 3 层路由:
user@switch> show arp MAC Address Address Name Flags 00:00:0c:06:2c:0d 192.0.2.3 vlan.0 None 00:13:e2:50:62:e0 192.0.2.11 vlan.1 None
意义
在多路访问网络上发送 IP 数据包需要从 IP 地址映射到 MAC 地址(物理或硬件地址)。ARP 表显示(与 关联sales)和vlan.1(与 support关联)的 vlan.0 IP 地址和 MAC 地址之间的映射。这些 VLAN 可以相互路由流量。
验证流量是否在两个 VLAN 之间切换
目的
验证是否将学习的条目添加到以太网交换表中。
操作
列出以太网交换表的内容:
user@switch> show ethernet-switching table Ethernet-switching table: 8 entries, 5 learned VLAN MAC address Type Age Interfaces default * Flood - All-members default 00:00:05:00:00:01 Learn - xe-0/0/10.0 default 00:00:5e:00:01:09 Learn - xe-0/0/13.0 default 00:19:e2:50:63:e0 Learn - xe-0/0/23.0 sales * Flood - All-members sales 00:00:5e:00:07:09 Learn - xe-0/0/0.0 support * Flood – All–members support 00:00:5e:00:01:01 Learn – xe-0/0/46.0
意义
输出显示,和 salessupport VLAN 的获知条目已添加到以太网交换表中,并与接口 xe-0/0/0.0 和 xe-0/0/46.0相关联。即使 VLAN 与配置中的多个接口相关联,这些接口也是当前唯一正在运行的接口。
示例:设置与交换机上的多个 VLAN 的桥接
QFX 系列产品使用桥接和虚拟 LAN (VLAN) 连接 LAN 中的网络设备(存储设备、文件服务器和其他网络组件),并将 LAN 分段为较小的桥接域。
要将 LAN 上的流量分段到单独的广播域中,请在交换机上创建单独的虚拟 LAN (VLAN)。每个 VLAN 都是网络节点的集合。使用 VLAN 时,源帧和目的地址在同一 VLAN 中的帧仅在本地 VLAN 中转发,只有不发往本地 VLAN 的帧才会转发到其他广播域。因此,VLAN 可限制流经整个 LAN 的流量,从而减少 LAN 内可能发生的冲突和数据包重新传输次数。
此示例介绍如何为 QFX 系列配置桥接,以及如何创建两个 VLAN 来对 LAN 进行分段:
此任务支持增强型第 2 层软件 (ELS) 配置样式。有关 ELS 的详细信息,请参阅使用增强型第 2 层软件 CLI。如果您的交换机运行的软件不支持 ELS,请参阅 示例:设置与多个 VLAN 的桥接。
要求
此示例使用以下硬件和软件组件:
已配置和调配的 QFX3500 交换机
适用于 QFX 系列的 Junos OS 13.2X50-D15 或更高版本
概述和拓扑
交换机将办公室或数据中心中的所有设备连接到单个 LAN 中,以实现文件服务器等公共资源的共享。默认配置创建一个 VLAN,交换机上的所有流量都是该广播域的一部分。创建单独的网段可缩小广播域的跨度,使您能够对相关用户和网络资源进行分组,而不受物理布线或网络设备在建筑物或 LAN 中的位置的限制。
此示例显示一个简单的配置,说明了在单个交换机上创建两个 VLAN 的基本步骤。被称为 sales 的 VLAN 用于销售和市场营销团队,另一个被称为 support 的 VLAN 用于客户支持团队。每个销售和支持组都有自己的专用文件服务器和其他资源。要跨两个 VLAN 对交换机端口进行分段,每个 VLAN 都必须有自己的广播域,由唯一的名称和标记 (VLAN ID) 标识。此外,每个 VLAN 必须位于其自己的不同 IP 子网上。
拓扑学
此示例中使用的拓扑由单个 QFX3500 交换机组成,共有 48 个 10-Gbps 以太网端口。(就此示例而言,不包括 QSFP+ 端口 Q0-Q3,即端口 xe-0/1/0 到 xe-0/1/15。
属性 |
设置 |
---|---|
交换机硬件 |
QFX3500交换机配置了 48 个 10-Gbps 以太网端口(xe-0/0/0xe-0/0/47到 ) |
VLAN 名称和标记 ID |
sales标记 100 support标记 200 |
VLAN 子网 |
sales:192.0.2.0/25(地址 192.0.2.1 到 192.0.2.126) support:192.0.2.128/25(地址 192.0.2.129 到 192.0.2.254) |
VLAN 中的接口 sales |
文件服务器:xe-0/0/20 和 xe-0/0/21 |
VLAN 中的接口 support |
文件服务器:xe-0/0/46 和 xe-0/0/47 |
未使用的接口 |
xe-0/0/2 和 xe-0/0/25 |
此配置示例创建两个 IP 子网,一个用于销售 VLAN,另一个用于支持 VLAN。交换机在 VLAN 内桥接流量。对于在两个 VLAN 之间传输的流量,交换机使用您配置了 IP 子网地址的第 3 层路由接口路由流量。
为了使示例简单易懂,配置步骤仅显示每个 VLAN 中的几个设备。使用相同的配置过程添加更多 LAN 设备。
配置
程序
CLI 快速配置
要为两个 VLAN(sales 和 support)快速配置第 2 层交换并快速配置这两个 VLAN 之间的第 3 层流量路由,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set interfaces xe-0/0/0 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/3 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/22 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/20 unit 0 description “Sales file server port” set interfaces xe-0/0/20 unit 0 family ethernet-switching vlan members sales set interfaces xe-0/0/24 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/26 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/44 unit 0 family ethernet-switching vlan members support set interfaces xe-0/0/46 unit 0 description “Support file server port” set interfaces xe-0/0/46 unit 0 family ethernet-switching vlan members support set interfaces vlan unit 0 family inet address 192.0.2.0/25 set interfaces vlan unit 1 family inet address 192.0.2.128/25 set vlans sales l3–interface irb.0 set vlans sales vlan-id 100 set vlans support vlan-id 200 set vlans support l3-interface irb.1
分步过程
配置交换机接口及其所属的 VLAN。默认情况下,所有接口都处于接入模式,因此您无需配置端口模式。
配置 VLAN 中 sales 文件服务器的接口:
[edit interfaces xe-0/0/20 unit 0] user@switch# set description “Sales file server port” user@switch# set family ethernet-switching vlan members sales
配置 VLAN 中 support 文件服务器的接口:
[edit interfaces xe-0/0/46 unit 0] user@switch# set description “Support file server port” user@switch# set family ethernet-switching vlan members support
为 sales 广播域创建子网:
[edit interfaces] user@switch# set vlan unit 0 family inet address 192.0.2.1/25
为 support 广播域创建子网:
[edit interfaces] user@switch# set vlan unit 1 family inet address 192.0.2.129/25
为 和 salessupport VLAN 配置 VLAN 标记 ID:
[edit vlans] user@switch# set sales vlan-id 100 user@switch# set support vlan-id 200
要在 和 salessupport VLAN 之间路由流量,请定义作为每个 VLAN 成员的接口并关联第 3 层接口:
[edit vlans] user@switch# set sales l3-interface irb.0 user@switch# set support l3-interface irb.1
配置结果
显示配置结果:
user@switch> show configuration interfaces { xe-0/0/20 { unit 0 { description “Sales file server port”; family ethernet-switching { vlan members sales; } } } xe-0/0/46 { unit 0 { description “Support file server port”; family ethernet-switching { vlan members support; } } vlans { unit 0 { family inet address 192.0.2.1/25; } unit 1 { family inet address 192.0.2.129/25; } } } } vlans { sales { vlan-id 100; interface xe-0/0/0.0: interface xe-0/0/3/0; interface xe-0/0/20.0; interface xe-0/0/22.0; l3-interface irb0; } support { vlan-id 200; interface xe-0/0/24.0: interface xe-0/0/26.0; interface xe-0/0/44.0; interface xe-0/0/46.0; l3-interface irb1; } }
要快速配置销售和支持 VLAN 接口,请发出 load merge terminal
命令。然后复制层次结构并将其粘贴到交换机终端窗口中。
验证
salessupport验证是否已创建和 VLAN 且运行正常,请执行以下任务:
验证是否已创建 VLAN,以及是否已与正确的接口关联
目的
验证是否已在交换机上创建 和 salessupport VLAN,以及交换机上所有连接的接口是否都是正确 VLAN 的成员。
操作
要列出交换机上配置的所有 VLAN,请使用 show vlans
以下命令:
user@switch> show vlans Name Tag Interfaces default xe-0/0/1.0, xe-0/0/2.0, xe-0/0/4.0, xe-0/0/5.0, xe-0/0/6.0, xe-0/0/7.0, xe-0/0/8.0, xe-0/0/9.0, xe-0/0/10.0*, xe-0/0/11.0, xe-0/0/12.0, xe-0/0/13.0*, xe-0/0/14.0, xe-0/0/15.0, xe-0/0/16.0, xe-0/0/17.0, xe-0/0/18.0, xe-0/0/19.0, xe-0/0/21.0, xe-0/0/23.0*, xe-0/0/25.0, xe-0/0/27.0, xe-0/0/28.0, xe-0/0/29.0, xe-0/0/30.0, xe-0/0/31.0, xe-0/0/32.0, xe-0/0/33.0, xe-0/0/34.0, xe-0/0/35.0, xe-0/0/36.0, xe-0/0/37.0, xe-0/0/38.0, xe-0/0/39.0, xe-0/0/40.0, xe-0/0/41.0, xe-0/0/42.0, xe-0/0/43.0, xe-0/0/45.0, xe-0/0/47.0, xe-0/1/0.0*, xe-0/1/1.0*, xe-0/1/2.0*, xe-0/1/3.0* sales 100 xe-0/0/0.0*, xe-0/0/3.0, xe-0/0/20.0, xe-0/0/22.0 support 200 xe-0/0/0.24, xe-0/0/26.0, xe-0/0/44.0, xe-0/0/46.0* mgmt me0.0*
意义
show vlans
命令将列出交换机上配置的所有 VLAN 以及每个 VLAN 的成员接口。此命令输出显示已创建的 VLAN sales 和 support。VLAN sales 的标记 ID 为 100,并与接口 xe-0/0/0.0、 xe-0/0/3.0xe-0/0/20.0、 和 xe-0/0/22.0相关联。support VLAN 的标记 ID 为 200,并与接口 xe-0/0/24.0、 xe-0/0/26.0xe-0/0/44.0、 和 xe-0/0/46.0相关联。
验证流量是否在两个 VLAN 之间路由
目的
验证两个 VLAN 之间的路由。
操作
列出交换机地址解析协议 (ARP) 表中的第 3 层路由:
user@switch> show arp MAC Address Address Name Flags 00:00:0c:06:2c:0d 192.0.2.3 vlan.0 None 00:13:e2:50:62:e0 192.0.2.11 vlan.1 None
意义
在多路访问网络上发送 IP 数据包需要从 IP 地址映射到 MAC 地址(物理或硬件地址)。ARP 表显示(与 关联sales)和vlan.1(与 support关联)的 vlan.0 IP 地址和 MAC 地址之间的映射。这些 VLAN 可以相互路由流量。
验证流量是否在两个 VLAN 之间切换
目的
验证是否将学习的条目添加到以太网交换表中。
操作
列出以太网交换表的内容:
user@switch> show ethernet-switching table Ethernet-switching table: 8 entries, 5 learned VLAN MAC address Type Age Interfaces default * Flood - All-members default 00:00:05:00:00:01 Learn - xe-0/0/10.0 default 00:00:5e:00:01:09 Learn - xe-0/0/13.0 default 00:19:e2:50:63:e0 Learn - xe-0/0/23.0 sales * Flood - All-members sales 00:00:5e:00:07:09 Learn - xe-0/0/0.0 support * Flood – All–members support 00:00:5e:00:01:01 Learn – xe-0/0/46.0
意义
输出显示,和 salessupport VLAN 的获知条目已添加到以太网交换表中,并与接口 xe-0/0/0.0 和 xe-0/0/46.0相关联。即使 VLAN 与配置中的多个接口相关联,这些接口也是当前唯一正在运行的接口。
示例:将支持 ELS 的接入交换机连接到支持 ELS 的分布式交换机
此示例使用支持增强型第 2 层软件 (ELS) 配置样式的 EX 系列交换机的 Junos OS。有关 ELS 的详细信息,请参阅 使用增强型第 2 层软件 CLI。
在大型局域网 (LAN) 中,通常需要将来自多个接入交换机的流量聚合到一个分布交换机中。
此示例介绍如何将接入交换机连接到分布式交换机:
要求
此示例使用以下硬件和软件组件:
三台 EX 系列接入交换机。
一台 EX 系列分布式交换机。
注:在接入交换机-分布式交换机拓扑中,可以将运行支持 ELS 的 Junos OS 版本的 EX 系列交换机与不运行支持 ELS 的 Junos OS 版本的 EX 系列交换机连接起来。但是,此示例仅使用运行 ELS 的交换机来说明如何使用 ELS CLI 配置此拓扑。
Junos OS 12.3R2 或更高版本,支持 EX 系列交换机的 ELS。
在将接入交换机连接到分布式交换机之前,请确保您已:
已安装交换机。请参阅交换机的安装说明。
已在两台交换机上执行初始软件配置。有关除 EX9200 系列交换机之外的所有 EX 系列交换机的初始软件配置的信息,请参阅连接和配置 EX 系列交换机(CLI 过程)。有关 EX9200 系列交换机初始软件配置的信息,请参阅连接和配置 EX9200 交换机(CLI 过程)。
概述和拓扑
在分布在多个楼层或建筑物的大型办公室中,或者在数据中心中,您通常将来自多个接入交换机的流量聚合到一个分布交换机中。此配置示例显示了一个简单的拓扑,用于说明如何将三个接入交换机连接到一个分布式交换机。
在拓扑中,LAN 分为两个 VLAN,一个用于销售部门,另一个用于支持团队。接入交换机的一个上行链路模块上的一个 1 千兆以太网端口连接到分布式交换机,再连接到分布式交换机上的一个 1 千兆以太网端口。
图 1 显示了连接到三台 EX4300 接入交换机的 EX9200 分布交换机。

拓扑学
表 6 描述了示例拓扑的组件。该示例说明如何配置三个接入交换机之一。其他接入交换机也可以以相同的方式进行配置。
属性 | 设置 |
---|---|
接入交换机硬件 |
三台 EX4300 交换机,每台交换机都有一个带 1 千兆以太网端口的上行链路模块。 |
分布式交换机硬件 |
一台 EX9208 最多可安装 3 个 EX9200-40T 线卡,全双工时可提供多达 240 个 1 千兆端口。 |
VLAN 名称和标记 ID |
sales标记 100support标记 200 |
VLAN 子网 |
sales:192.0.2.0/25(地址 192.0.2.1 到 192.0.2.126)support:192.0.2.128/25(地址 192.0.2.129 到 192.0.2.254) |
中继端口接口 |
在接入交换机上:ge-0/2/0在分布式交换机上:ge-0/0/0 |
VLAN sales 中的接入端口接口(在接入交换机上) |
Avaya IP 电话:ge-0/0/3 到 ge-0/0/19无线接入点:ge-0/0/0 和 ge-0/0/1打印机:ge-0/0/22 和 ge-0/0/23文件服务器:ge-0/0/20 和 ge-0/0/21 |
VLAN support 中的接入端口接口(在接入交换机上) |
Avaya IP 电话:ge-0/0/25 到 ge-0/0/43无线接入点:ge-0/0/24打印机:ge-0/0/44 和 ge-0/0/45文件服务器:ge-0/0/46 和 ge-0/0/47 |
配置接入交换机
要配置接入交换机:
程序
CLI 快速配置
要快速配置接入交换机,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set interfaces ge-0/0/0 unit 0 description "Sales wireless access point port" set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/3 unit 0 description "Sales phone port" set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/22 unit 0 description "Sales printer port" set interfaces ge-0/0/22 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/20 unit 0 description "Sales file server port" set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/24 unit 0 description "Support wireless access point port" set interfaces ge-0/0/24 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/26 unit 0 description "Support phone port" set interfaces ge-0/0/26 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/44 unit 0 description "Support printer port" set interfaces ge-0/0/44 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/46 unit 0 description "Support file server port" set interfaces ge-0/0/46 unit 0 family ethernet-switching vlan members support set interfaces ge-0/2/0 unit 0 description "Uplink module port connection to distribution switch" set interfaces ge-0/2/0 unit 0 family ethernet-switching interface-mode trunk set interfaces ge-0/2/0 native-vlan-id 1 set interfaces ge-0/2/0 unit 0 family ethernet-switching vlan members [sales support] set interfaces ge-0/2/0 unit 0 family ethernet-switching vlan members 1 set interfaces irb unit 0 family inet address 192.0.2.1/25 set interfaces irb unit 1 family inet address 192.0.2.129/25 set vlans sales description “Sales VLAN” set vlans sales l3-interface irb.0 set vlans sales vlan-id 100 set vlans support description “Support VLAN” set vlans support vlan-id 200 set vlans support l3-interface irb.1
分步过程
要配置接入交换机:
将上行链路模块上的 1 千兆以太网接口配置为连接到分布式交换机的中继端口:
[edit interfaces] user@access-switch# set ge-0/2/0 unit 0 description "Uplink module port connection to distribution switch" user@access-switch# set ge-0/2/0 unit 0 family ethernet-switching interface-mode trunk
指定要在中继端口上聚合的 VLAN:
[edit interfaces] user@access-switch# set ge-0/2/0 unit 0 family ethernet-switching vlan members [ sales support ]
要处理在中继端口上收到的未标记数据包,请通过配置 VLAN ID 并指定中继端口是本机 VLAN 的成员来创建本机 VLAN:
[edit interfaces] user@access-switch# set ge-0/2/0 native-vlan-id 1 user@access-switch# set ge-0/2/0 unit 0 family ethernet-switching vlan members 1
配置销售 VLAN:
[edit vlans] user@access-switch# set sales description "Sales VLAN" user@access-switch# set sales vlan-id 100 user@access-switch# set sales l3-interface irb.0
配置支持 VLAN:
[edit vlans] user@access-switch# set support description "Support VLAN" user@access-switch# set support vlan-id 200 user@access-switch# set support l3-interface irb.1
为销售 VLAN 创建子网:
[edit interfaces] user@access-switch# set irb unit 0 family inet address 192.0.2.1/25
为支持 VLAN 创建子网:
[edit interfaces] user@access-switch# set irb unit 1 family inet address 192.0.2.129/25
在销售 VLAN 中配置接口:
[edit interfaces] user@access-switch# set ge-0/0/0 unit 0 description "Sales wireless access point port" user@access-switch# set ge-0/0/0 unit 0 family ethernet-switching vlan members sales user@access-switch# set ge-0/0/3 unit 0 description "Sales phone port" user@access-switch# set ge-0/0/3 unit 0 family ethernet-switching vlan members sales user@access-switch# set ge-0/0/20 unit 0 description "Sales file server port" user@access—switch# set ge-0/0/20 unit 0 family ethernet-switching vlan members sales user@access-switch# set ge-0/0/22 unit 0 description "Sales printer port" user@access-switch# set ge-0/0/22 unit 0 family ethernet-switching vlan members sales
在支持 VLAN 中配置接口:
[edit interfaces] user@access-switch# set ge-0/0/24 unit 0 description "Support wireless access point port" user@access-switch# set ge-0/0/24 unit 0 family ethernet-switching vlan members support user@access-switch# set ge-0/0/26 unit 0 description "Support phone port" user@access-switch# set ge-0/0/26 unit 0 family ethernet-switching vlan members support user@access-switch# set ge-0/0/44 unit 0 description "Support printer port" user@access-switch# set ge-0/0/44 unit 0 family ethernet-switching vlan members support user@access-switch# set ge-0/0/46 unit 0 description "Support file server port" user@access-switch# set ge-0/0/46 unit 0 family ethernet-switching vlan members support
结果
显示配置结果:
user@access-switch> show configuration interfaces { ge-0/0/0 { unit 0 { description "Sales wireless access point port"; family ethernet-switching { vlan { members sales; } } } } ge-0/0/3 { unit 0 { description "Sales phone port"; family ethernet-switching { vlan { members sales; } } } } ge-0/0/20 { unit 0 { description "Sales file server port"; family ethernet-switching { vlan { members sales; } } } } ge-0/0/22 { unit 0 { description "Sales printer port"; family ethernet-switching { vlan { members sales; } } } } ge-0/0/24 { unit 0 { description "Support wireless access point port"; family ethernet-switching { vlan { members support; } } } } ge-0/0/26 { unit 0 { description "Support phone port"; family ethernet-switching { vlan { members support; } } } } ge-0/0/44 { unit 0 { description "Support printer port"; family ethernet-switching { vlan { members support; } } } } ge-0/0/46 { unit 0 { description "Support file server port"; family ethernet-switching { vlan { members support; } } } } ge-0/2/0 { native-vlan-id 1; unit 0 { description "Uplinking module connection to distribution switch"; family ethernet-switching { interface-mode trunk; vlan { members [ 1 sales support ]; } } } } irb { unit 0 { family inet { address 192.0.2.1/25; } } unit 1 { family inet { address 192.0.2.129/25; } } } } vlans { sales { description "Sales VLAN"; vlan-id 100; l3-interface irb.0; } support { description "Support VLAN"; vlan-id 200; l3-interface irb.1; } }
要快速配置接入交换机,请发出 load merge terminal
命令,然后复制层次结构并将其粘贴到交换机终端窗口中。
配置分布式交换机
要配置分布式交换机:
程序
CLI 快速配置
要快速配置分布式交换机,请复制以下命令并将其粘贴到交换机终端窗口中:
set interfaces ge-0/0/0 unit 0 description "Connection to access switch" set interfaces ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members [ sales support ] set interfaces ge-0/0/0 native-vlan-id 1 set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members 1 set interfaces irb unit 0 family inet address 192.0.2.2/25 set interfaces irb unit 1 family inet address 192.0.2.130/25 set vlans sales description "Sales VLAN" set vlans sales vlan-id 100 set vlans sales l3-interface irb.0 set vlans support description "Support VLAN" set vlans support vlan-id 200 set vlans support l3-interface irb.1
分步过程
要配置分布式交换机:
将交换机上的接口配置为连接到接入交换机的中继端口:
[edit interfaces] user@distribution-switch# set ge-0/0/0 unit 0 description "Connection to access switch" user@distribution-switch# set ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk
指定要在中继端口上聚合的 VLAN:
[edit interfaces] user@distribution-switch# set ge-0/0/0 unit 0 family ethernet-switching vlan members [ sales support ]
要处理在中继端口上收到的未标记数据包,请通过配置 VLAN ID 并指定中继端口是本机 VLAN 的成员来创建本机 VLAN:
[edit interfaces] user@distribution-switch# set ge-0/0/0 native-vlan-id 1 user@distribution-switch# set ge-0/0/0 unit 0 family ethernet-switching vlan members 1
配置销售 VLAN:
[edit vlans] user@distribution-switch# set sales description "Sales VLAN" user@distribution-switch# set sales vlan-id 100 user@distribution-switch# set sales l3-interface irb.0
分布式交换机的 VLAN 配置包括在 set l3-interface irb.0 销售 VLAN 和支持 VLAN 之间路由流量的命令。接入交换机的 VLAN 配置不包括此语句,因为接入交换机未监控 IP 地址。相反,接入交换机会将 IP 地址传递给分布式交换机进行解释。
配置支持 VLAN:
[edit vlans] user@distribution-switch# set support description "Support VLAN" user@distribution-switch# set support vlan-id 200 user@distribution-switch# set support l3-interface irb.1
分布式交换机的 VLAN 配置包括在 set l3-interface irb.1 销售 VLAN 和支持 VLAN 之间路由流量的命令。接入交换机的 VLAN 配置不包括此语句,因为接入交换机未监控 IP 地址。相反,接入交换机会将 IP 地址传递给分布式交换机进行解释。
为销售 VLAN 创建子网:
[edit interfaces] user@distribution-switch# set irb unit 0 family inet address 192.0.2.2/25
为支持 VLAN 创建子网:
[edit interfaces] user@distribution-switch# set irb unit 1 family inet address 192.0.2.130/25
结果
显示配置结果:
user@distribution-switch> show configuration interfaces { ge-0/0/0 { native-vlan-id 1; unit 0 { description "Connection to access switch"; family ethernet-switching { interface-mode trunk; vlan { members [ 1 sales support ]; } } } } irb { unit 0 { family inet { address 192.0.2.2/25; } } unit 1 { family inet { address 192.0.2.130/25; } } } } vlans { sales { description "Sales VLAN"; vlan-id 100; l3-interface irb.0; } support { description "Support VLAN"; vlan-id 200; l3-interface irb.1; } }
要快速配置分布式交换机,请发出 load merge terminal
命令,然后复制层次结构并将其粘贴到交换机终端窗口中。
验证
要确认配置工作正常,请执行以下任务:
验证接入交换机上的 VLAN 成员和接口
目的
sales验证是否已在交换机上创建 和 support VLAN。
操作
列出交换机上配置的所有 VLAN:
user@access-switch> show vlans Routing instance VLAN name Tag Interfaces default-switch sales 100 ge-0/0/20.0 ge-0/0/22.0 ge-0/0/3.0* ge-0/0/0.0* ge-0/2/0.0* default-switch support 200 ge-0/0/24.0 ge-0/0/26.0 ge-0/0/44.0* ge-0/0/46.0* ge-0/2/0.0*
意义
输出显示配置为salessupport相应 VLAN 成员的 和 VLAN 和接口。
验证分布式交换机上的 VLAN 成员和接口
目的
sales验证是否已在交换机上创建 和 support VLAN。
操作
列出交换机上配置的所有 VLAN:
user@distribution-switch> show vlans Routing instance VLAN name Tag Interfaces default-switch sales 100 ge-0/0/0.0* default-switch support 200 ge-0/0/0.0*
意义
输出显示 sales 和 support VLAN 以及配置为两个 VLAN 成员的接口 (ge-0/0/0.0)。接口 ge-0/0/0.0 也是连接到接入交换机的中继接口。
示例:为 EX 系列交换机设置与多个 VLAN 的桥接
要将 LAN 上的流量分段到单独的广播域中,请在 EX 系列交换机上创建单独的虚拟 LAN (VLAN)。每个 VLAN 都是网络节点的集合。使用 VLAN 时,源帧和目的地址在同一 VLAN 中的帧仅在本地 VLAN 中转发,只有不发往本地 VLAN 的帧才会转发到其他广播域。因此,VLAN 可限制流经整个 LAN 的流量,从而减少 LAN 内可能发生的冲突和数据包重新传输次数。
此示例介绍如何为 EX 系列交换机配置桥接,以及如何创建两个 VLAN 来对 LAN 进行分段:
要求
此示例使用以下硬件和软件组件:
一台 EX4200-48P 虚拟机箱交换机
适用于 EX 系列交换机的 Junos OS 9.0 或更高版本
在设置桥接和 VLAN 之前,请确保您已:
已执行初始交换机配置。请参阅连接和配置 EX 系列交换机(J-Web 过程)。
概述和拓扑
EX 系列交换机将办公室或数据中心中的所有设备连接到单个 LAN 中,以实现打印机和文件服务器等公共资源的共享,并使无线设备能够通过无线接入点连接到 LAN。默认配置创建一个 VLAN,交换机上的所有流量都是该广播域的一部分。创建单独的网段可缩小广播域的跨度,并允许您对相关用户和网络资源进行分组,而不受物理布线或网络设备在建筑物或 LAN 中的位置的限制。
此示例显示一个简单的配置,说明了在单个交换机上创建两个 VLAN 的基本步骤。被称为 sales 的 VLAN 用于销售和市场营销团队,另一个被称为 support 的 VLAN 用于客户支持团队。每个销售和支持组都有自己的专用文件服务器、打印机和无线接入点。要跨两个 VLAN 对交换机端口进行分段,每个 VLAN 都必须有自己的广播域,由唯一的名称和标记 (VLAN ID) 标识。此外,每个 VLAN 必须位于其自己的不同 IP 子网上。
拓扑学
此示例的拓扑由一台 EX4200-48P 交换机组成,该交换机共有 48 个千兆以太网端口,所有端口都支持以太网供电 (PoE)。大多数交换机端口连接到 Avaya IP 电话。其余端口连接到无线接入点、文件服务器和打印机。 表 7 解释了示例拓扑的组成部分。
属性 | 设置 |
---|---|
交换机硬件 |
EX4200-48P,48 个千兆以太网端口,全部支持 PoE(ge-0/0/0 到 ge-0/0/47) |
VLAN 名称和标记 ID |
sales标记 100 support标记 200 |
VLAN 子网 |
sales:192.0.2.0/25(地址 192.0.2.1 到 192.0.2.126) support:192.0.2.128/25(地址 192.0.2.129 到 192.0.2.254) |
VLAN 中的接口 sales |
Avaya IP 电话:ge-0/0/3 通过 ge-0/0/19无线接入点:ge-0/0/0 和 ge-0/0/1打印机:ge-0/0/22 和 ge-0/0/23文件服务器:ge-0/0/20 和 ge-0/0/21 |
VLAN 中的接口 support |
Avaya IP 电话:ge-0/0/25 通过 ge-0/0/43无线接入点: ge-0/0/24打印机:ge-0/0/44 和 ge-0/0/45文件服务器:ge-0/0/46 和 ge-0/0/47 |
未使用的接口 |
ge-0/0/2 和 ge-0/0/25 |
此配置示例创建两个 IP 子网,一个用于销售 VLAN,另一个用于支持 VLAN。交换机在 VLAN 内桥接流量。对于在两个 VLAN 之间传输的流量,交换机使用您配置了 IP 子网地址的第 3 层路由接口路由流量。
为了使示例简单易懂,配置步骤仅显示每个 VLAN 中的几个设备。使用相同的配置过程添加更多 LAN 设备。
配置
为两个 VLAN 配置第 2 层交换:
程序
CLI 快速配置
要为两个 VLAN(sales 和 support)快速配置第 2 层交换并快速配置这两个 VLAN 之间的第 3 层流量路由,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set interfaces ge-0/0/0 unit 0 description “Sales wireless access point port” set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/3 unit 0 description “Sales phone port” set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/22 unit 0 description “Sales printer port” set interfaces ge-0/0/22 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/20 unit 0 description “Sales file server port” set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/24 unit 0 description “Support wireless access point port” set interfaces ge-0/0/24 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/26 unit 0 description “Support phone port” set interfaces ge-0/0/26 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/44 unit 0 description “Support printer port” set interfaces ge-0/0/44 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/46 unit 0 description “Support file server port” set interfaces ge-0/0/46 unit 0 family ethernet-switching vlan members support set interfaces vlan unit 0 family inet address 192.0.2.0/25 set interfaces vlan unit 1 family inet address 192.0.2.128/25 set vlans sales l3–interface vlan.0 set vlans sales vlan-id 100 set vlans support vlan-id 200 set vlans support l3-interface vlan.1
分步过程
配置交换机接口及其所属的 VLAN。默认情况下,所有接口都处于接入模式,因此您无需配置端口模式。
配置销售 VLAN 中无线接入点的接口:
[edit interfaces ge-0/0/0 unit 0] user@switch# set description “Sales wireless access point port” user@switch# set family ethernet-switching vlan members sales
在销售 VLAN 中配置 Avaya IP 电话的接口:
[edit interfaces ge-0/0/3 unit 0] user@switch# set description “Sales phone port” user@switch# set family ethernet-switching vlan members sales
在销售 VLAN 中配置打印机接口:
[edit interfaces ge-0/0/22 unit 0] user@switch# set description “Sales printer port” user@switch# set family ethernet-switching vlan members sales
在销售 VLAN 中配置文件服务器的接口:
[edit interfaces ge-0/0/20 unit 0] user@switch# set description “Sales file server port” user@switch# set family ethernet-switching vlan members sales
在支持 VLAN 中配置无线接入点的接口:
[edit interfaces ge-0/0/24 unit 0] user@switch# set description “Support wireless access point port” user@switch# set family ethernet-switching vlan members support
在支持 VLAN 中配置 Avaya IP 电话的接口:
[edit interfaces ge-0/0/26 unit 0] user@switch# set description “Support phone port” user@switch# set family ethernet-switching vlan members support
在支持 VLAN 中配置打印机的接口:
[edit interfaces ge-0/0/44 unit 0] user@switch# set description “Support printer port” user@switch# set family ethernet-switching vlan members support
在支持 VLAN 中配置文件服务器的接口:
[edit interfaces ge-0/0/46 unit 0] user@switch# set description “Support file server port” user@switch# set family ethernet-switching vlan members support
为销售广播域创建子网:
[edit interfaces] user@switch# set vlan unit 0 family inet address 192.0.2.1/25
为支持广播域创建子网:
[edit interfaces] user@switch# set vlan unit 1 family inet address 192.0.2.129/25
为销售和支持 VLAN 配置 VLAN 标记 ID:
[edit vlans] user@switch# set sales vlan-id 100 user@switch# set support vlan-id 200
要在销售 VLAN 和支持 VLAN 之间路由流量,请定义作为每个 VLAN 成员的接口并关联第 3 层接口:
[edit vlans] user@switch# set sales l3-interface user@switch# set support l3-interface vlan.1
结果
显示配置结果:
user@switch> show configuration interfaces { ge-0/0/0 { unit 0 { description “Sales wireless access point port”; family ethernet-switching { vlan members sales; } } } ge-0/0/3 { unit 0 { description “Sales phone port”; family ethernet-switching { vlan members sales; } } } ge-0/0/22 { unit 0 { description “Sales printer port”; family ethernet-switching { vlan members sales; } } } ge-0/0/20 { unit 0 { description “Sales file server port”; family ethernet-switching { vlan members sales; } } } ge-0/0/24 { unit 0 { description “Support wireless access point port”; family ethernet-switching { vlan members support; } } } ge-0/0/26 { unit 0 { description “Support phone port”; family ethernet-switching { vlan members support; } } } ge-0/0/44 { unit 0 { description “Support printer port”; family ethernet-switching { vlan members support; } } } ge-0/0/46 { unit 0 { description “Support file server port”; family ethernet-switching { vlan members support; } } vlans { unit 0 { family inet address 192.0.2.0/25; } unit 1 { family inet address 192.0.2.128/25; } } } } vlans { sales { vlan-id 100; interface ge-0/0/0.0: interface ge-0/0/3/0; interface ge-0/0/20.0; interface ge-0/0/22.0; l3-interface vlan 0; } support { vlan-id 200; interface ge-0/0/24.0: interface ge-0/0/26.0; interface ge-0/0/44.0; interface ge-0/0/46.0; l3-interface vlan 1; } }
要快速配置销售和支持 VLAN 接口,请发出 load merge terminal
命令,然后复制层次结构并将其粘贴到交换机终端窗口中。
验证
要验证“销售”和“支持”VLAN是否已创建且运行正常,请执行以下操作:
验证是否已创建 VLAN 并将其关联到正确的接口
目的
验证是否已在交换机上创建 VLAN sales 和 support,以及交换机上的所有已连接接口是否均为正确 VLAN 的成员。
操作
列出交换机上配置的所有 VLAN:
使用操作模式命令:
user@switch> show vlans Name Tag Interfaces default ge-0/0/1.0, ge-0/0/2.0, ge-0/0/4.0, ge-0/0/5.0, ge-0/0/6.0, ge-0/0/7.0, ge-0/0/8.0, ge-0/0/9.0, ge-0/0/10.0*, ge-0/0/11.0, ge-0/0/12.0, ge-0/0/13.0*, ge-0/0/14.0, ge-0/0/15.0, ge-0/0/16.0, ge-0/0/17.0, ge-0/0/18.0, ge-0/0/19.0, ge-0/0/21.0, ge-0/0/23.0*, ge-0/0/25.0, ge-0/0/27.0, ge-0/0/28.0, ge-0/0/29.0, ge-0/0/30.0, ge-0/0/31.0, ge-0/0/32.0, ge-0/0/33.0, ge-0/0/34.0, ge-0/0/35.0, ge-0/0/36.0, ge-0/0/37.0, ge-0/0/38.0, ge-0/0/39.0, ge-0/0/40.0, ge-0/0/41.0, ge-0/0/42.0, ge-0/0/43.0, ge-0/0/45.0, ge-0/0/47.0, ge-0/1/0.0*, ge-0/1/1.0*, ge-0/1/2.0*, ge-0/1/3.0* sales 100 ge-0/0/0.0*, ge-0/0/3.0, ge-0/0/20.0, ge-0/0/22.0 support 200 ge-0/0/24.0, ge-0/0/26.0, ge-0/0/44.0, ge-0/0/46.0* mgmt me0.0*
意义
show vlans
命令将列出交换机上配置的所有 VLAN 以及每个 VLAN 的成员接口。此命令输出显示已创建的 VLAN sales 和 support。VLAN sales 的标记 ID 为 100,并与接口 ge-0/0/0.0、 ge-0/0/3.0ge-0/0/20.0、 和 ge-0/0/22.0相关联。support VLAN 的标记 ID 为 200,并与接口 ge-0/0/24.0、 ge-0/0/26.0ge-0/0/44.0、 和 ge-0/0/46.0相关联。
验证流量是否在两个 VLAN 之间路由
目的
验证两个 VLAN 之间的路由。
操作
列出交换机地址解析协议 (ARP) 表中的第 3 层路由:
user@switch> show arp MAC Address Address Name Flags 00:00:0c:06:2c:0d 192.0.2.3 vlan.0 None 00:13:e2:50:62:e0 192.0.2.11 vlan.1 None
意义
在多路访问网络上发送 IP 数据包需要从 IP 地址映射到 MAC 地址(物理或硬件地址)。ARP 表显示(与 关联sales)和vlan.1(与 support关联)的 vlan.0 IP 地址和 MAC 地址之间的映射。这些 VLAN 可以相互路由流量。
验证流量是否在两个 VLAN 之间切换
目的
验证是否将学习的条目添加到以太网交换表中。
操作
列出以太网交换表的内容:
user@switch> show ethernet-switching table Ethernet-switching table: 8 entries, 5 learned VLAN MAC address Type Age Interfaces default * Flood - All-members default 00:00:05:00:00:01 Learn - ge-0/0/10.0 default 00:00:5e:00:01:09 Learn - ge-0/0/13.0 default 00:19:e2:50:63:e0 Learn - ge-0/0/23.0 sales * Flood - All-members sales 00:00:5e:00:07:09 Learn - ge-0/0/0.0 support * Flood – All–members support 00:00:5e:00:01:01 Learn – ge-0/0/46.0
意义
输出显示,和 salessupport VLAN 的获知条目已添加到以太网交换表中,并与接口 ge-0/0/0.0 和 ge-0/0/46.0相关联。即使 VLAN 与配置中的多个接口相关联,这些接口也是当前唯一正在运行的接口。
示例:将接入交换机连接到分布式交换机
在大型局域网 (LAN) 中,通常需要将来自多个接入交换机的流量聚合到一个分布交换机中。
此示例介绍如何将接入交换机连接到分布式交换机:
要求
此示例使用以下硬件和软件组件:
对于分布式交换机,一台 EX 4200-24F 交换机。该模型旨在用作聚合或折叠核心网络拓扑以及空间受限数据中心中的分布式交换机。它具有 24 个 1 千兆以太网光纤 SFP 端口和一个带有两个 10 千兆以太网 XFP 端口的 EX-UM-2XFP 上行链路模块。
对于接入交换机,一个 EX 3200-24P(具有 24 个 1 千兆以太网端口,所有端口都支持以太网供电 (PoE)和一个带有四个 1 千兆以太网端口的上行链路模块。
适用于 QFX 系列的 Junos OS 11.1 或更高版本
概述和拓扑
在分布在多个楼层或建筑物的大型办公室中,或者在数据中心中,您通常将来自多个接入交换机的流量聚合到一个分布交换机中。此配置示例显示了一个简单的拓扑,用于说明如何将单个接入交换机连接到分布式交换机。
在拓扑中,LAN 分为两个 VLAN,一个用于销售部门,另一个用于支持团队。接入交换机上行链路模块上的一个 1 千兆以太网端口连接到分布式交换机,再连接到分布式交换机上的一个 1 千兆以太网端口。
拓扑学
表 8 解释了示例拓扑的组成部分。该示例说明如何配置三个接入交换机之一。其他接入交换机也可以以相同的方式进行配置。
属性 | 设置 |
接入交换机硬件 |
EX 3200-24P,24 个 1 千兆以太网端口,全部支持 PoE(ge-0/0/0ge-0/0/23至);1 个 4 端口 1 千兆以太网上行链路模块 (EX-UM-4SFP) |
分布式交换机硬件 |
EX 4200-24F,24 个 1 千兆以太网光纤 SFP 端口(ge-0/0/0 至 ge-0/0/23);一个 2 端口 10 千兆以太网 XFP 上行链路模块 (EX-UM-4SFP) |
VLAN 名称和标记 ID |
sales、标签 100support、标签 200 |
VLAN 子网 |
sales:192.0.2.0/25(地址 192.0.2.1 到 192.0.2.126 )support:192.0.2.128/25(地址 192.0.2.129 到 192.0.2.254) |
中继端口接口 |
在接入交换机上:ge-0/1/0在分布式交换机上: ge-0/0/0 |
VLAN sales 中的接入端口接口(在接入交换机上) |
Avaya IP 电话:ge-0/0/3通过无线接入点:ge-0/0/19ge-0/0/0 和 ge-0/0/1打印机:ge-0/0/22 和 ge-0/0/23文件服务器:ge-0/0/20 和 ge-0/0/21 |
VLAN support 中的接入端口接口(在接入交换机上) |
Avaya IP 电话:ge-0/0/25通过无线接入点:ge-0/0/43ge-0/0/24打印机:ge-0/0/44 和 ge-0/0/45文件服务器:ge-0/0/46 和 ge-0/0/47 |
接入交换机上未使用的接口 |
ge-0/0/2 和 ge-0/0/25 |
配置接入交换机
要配置接入交换机:
程序
CLI 快速配置
要快速配置接入交换机,请复制以下命令并将其粘贴到交换机终端窗口中:
[edit] set interfaces ge-0/0/0 unit 0 description “Sales Wireless access point port” set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/3 unit 0 description “Sales phone port” set interfaces ge-0/0/3 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/22 unit 0 description “Sales printer port” set interfaces ge-0/0/22 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/20 unit 0 description “Sales file server port” set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members sales set interfaces ge-0/0/24 unit 0 description “Support wireless access point port” set interfaces ge-0/0/24 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/26 unit 0 description “Support phone port” set interfaces ge-0/0/26 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/44 unit 0 description “Support printer port” set interfaces ge-0/0/44 unit 0 family ethernet-switching vlan members support set interfaces ge-0/0/46 unit 0 description “Support file server port” set interfaces ge-0/0/46 unit 0 family ethernet-switching vlan members support set interfaces ge-0/1/0 unit 0 description “Uplink module port connection to distribution switch” set interfaces ge-0/1/0 unit 0 family ethernet-switching port-mode trunk set interfaces ge-0/1/0 unit 0 family ethernet-switching native-vlan-id 1 set interfaces ge-0/1/0 unit 0 family ethernet switching vlan members [sales support] set interfaces vlan unit 0 family inet address 192.0.2.1/25 set interfaces vlan unit 1 family inet address 192.0.2.129/25 set vlans sales interface ge-0/0/0.0 set vlans sales interface ge-0/0/3.0 set vlans sales interface ge-0/0/22.0 set vlans sales interface ge-0/0/20.0 set vlans sales l3-interface vlan.0 set vlans sales vlan-id 100 set vlans sales vlan-description “Sales VLAN” set vlans support interface ge-0/0/24.0 set vlans support interface ge-0/0/26.0 set vlans support interface ge-0/0/44.0 set vlans support interface ge-0/0/46.0 set vlans support vlan-id 200 set vlans support l3–interface vlan.1 set vlans support vlan-description “Support VLAN”
分步过程
要配置接入交换机:
将上行链路模块上的 1 千兆以太网接口配置为连接到分布式交换机的中继端口:
[edit interfaces ge-0/1/0 unit 0]user@access-switch# setdescription “Uplink module port connection to distribution switch”user@access-switch# set ethernet-switching port-mode trunk
指定要在中继端口上聚合的 VLAN:
[edit interfaces ge-0/1/0 unit 0]user@access-switch# set ethernet-switching vlanmembers [ sales support ]
配置 VLAN ID 以用于接收的不带 dot1q 标记的数据包(未标记数据包):
[edit interfaces ge-0/1/0 unit 0]user@access-switch# set ethernet-switching native-vlan-id 1
配置销售 VLAN:
[edit vlans sales]user@access-switch# set vlan-description “Sales VLAN”user@access-switch# set vlan-id 100user@access-switch# set l3-interface (VLAN) vlan.0
配置支持 VLAN:
[edit vlans support]user@access-switch# set vlan-description “Support VLAN”user@access-switch# set vlan-id 200user@access-switch# set l3-interface (VLAN) vlan.1
为销售广播域创建子网:
[edit interfaces]user@access-switch# set vlan unit 0 family inet address 192.0.2.1/25
为支持广播域创建子网:
[edit interfaces]user@access-switch# set vlan unit 1 family inet address 192.0.2.129/25
在销售 VLAN 中配置接口:
[edit interfaces]user@access-switch# set ge-0/0/0 unit 0 description “Sales wireless access point port”user@access-switch# set ge-0/0/0 unit 0 family ethernet-switching vlan members salesuser@access-switch# set ge-0/0/3 unit 0 description “Sales phone port”user@access-switch# set ge-0/0/3 unit 0 family ethernet-switching vlan members salesuser@access-switch# set ge-0/0/20 unit 0 description “Sales file server port”user@access—switch# set ge-0/0/20 unit 0 family ethernet-switching vlan members salesuser@access-switch# set ge-0/0/22 unit 0 description “Sales printer port”user@access-switch# set ge-0/0/22 unit 0 family ethernet-switching vlan members sales
在支持 VLAN 中配置接口:
[edit interfaces]user@access-switch# set ge-0/0/24 unit 0 description “Support wireless access point port”user@access-switch# set ge-0/0/24 unit 0 family ethernet-switching vlan members supportuser@access-switch# set ge-0/0/26 unit 0 description “Support phone port”user@access-switch# set ge-0/0/26 unit 0 family ethernet-switching vlan members supportuser@access-switch# set ge-0/0/44 unit 0 description “Support printer port”user@access-switch# set ge-0/0/44 unit 0 family ethernet-switching vlan members supportuser@access-switch# set ge-0/0/46 unit 0 description “Support file server port”user@access-switch# set ge-0/0/46 unit 0 family ethernet-switching vlan members support
为销售和支持 VLAN 配置说明和 VLAN 标记 ID:
[edit vlans]user@access-switch# set sales vlan-description “Sales VLAN”user@access-switch# set sales vlan-id 100user@access-switch# set support vlan-description “Support VLAN”user@access-switch# set support vlan-id 200
要在销售和支持 VLAN 之间路由流量并将第 3 层接口与每个 VLAN 关联:
[edit vlans]user@access-switch# set sales l3-interface vlan.0user@access-switch# set support l3-interface vlan.1
结果
显示配置结果:
user@access-switch> show interfaces { ge-0/0/0 { unit 0 { description “Sales wireless access point port”; family ethernet-switching { vlan members sales; } } } ge-0/0/3 { unit 0 { description “Sales phone port”; family ethernet-switching { vlan members sales; } } } ge-0/0/20 { unit 0 { description “Sales file server port”; family ethernet-switching { vlan members sales; } } } ge-0/0/22 { unit 0 { description “Sales printer port”; family ethernet-switching { vlan members sales; } } } ge-0/0/24 { unit 0 { description “Support wireless access point port”; family ethernet-switching { vlan members support; } } } ge-0/0/26 { unit 0 { description “Support phone port”; family ethernet-switching { vlan members support; } } } ge-0/0/44 { unit 0 { description “Support printer port”; family ethernet-switching { vlan members sales; } } } ge-0/0/46 { unit 0 { description “Support file server port”; family ethernet-switching { vlan members support; } } } ge-0/1/0 { unit 0 { description “Uplink module port connection to distribution switch”; family ethernet-switching { port-mode trunk; vlan members [ sales support ]; native-vlan-id 1; } } } vlan { unit 0 { family inet address 192.0.2.1/25; } unit 1 { family inet address 192.0.2.129/25; } } } vlans { sales { vlan-id 100; vlan-description “Sales VLAN”; l3-interface vlan.0; } support { vlan-id 200; vlan-description “Support VLAN”; l3-interface vlan.1; } }
要快速配置分布式交换机,请发出 load merge terminal
命令,然后复制层次结构并将其粘贴到交换机终端窗口中。
配置分布式交换机
要配置分布式交换机:
程序
CLI 快速配置
要快速配置分布式交换机,请复制以下命令并将其粘贴到交换机终端窗口中:
set interfaces ge-0/0/0 description “Connection to access switch” set interfaces ge-0/0/0 ethernet-switching port-mode trunk set interfaces ge-0/0/0 ethernet-switching vlan members [ sales support ] set interfaces ge-0/0/0 ethernet-switching native-vlan-id 1 set interfaces vlan unit 0 family inet address 192.0.2.2/25 set interfaces vlan unit 1 family inet address 192.0.2.130/25 set vlans sales vlan-description “Sales VLAN” set vlans sales vlan-id 100 set vlans sales l3-interface vlan.0 set vlans support vlan-description “Support VLAN” set vlans support vlan-id 200 set vlans support l3-interface vlan.1
分步过程
要配置分布式交换机:
将交换机上的接口配置为连接到接入交换机的中继端口:
[edit interfaces ge-0/0/0 unit 0]user@distribution-switch# set description “Connection to access switch”user@distribution-switch# set ethernet-switching port-mode trunk
指定要在中继端口上聚合的 VLAN:
[edit interfaces ge-0/0/0 unit 0]user@distribution-switch# set ethernet-switching vlanmembers [ sales support ]
配置 VLAN ID 以用于接收的不带 dot1q 标记的数据包(未标记数据包):
[edit interfaces]user@distribution-switch# set ge-0/0/0 ethernet-switching native-vlan-id 1
配置销售 VLAN:
[edit vlans sales]user@distribution-switch# set vlan-description “Sales VLAN”user@distribution-switch# set vlan-id 100user@distribution-switch# set l3-interface (VLAN) vlan.0
配置支持 VLAN:
[edit vlans support]user@distribution-switch# set vlan-description “Support VLAN”user@distribution-switch# set vlan-id 200user@distribution-switch# set l3-interface (VLAN) vlan.1
为销售广播域创建子网:
[edit interfaces]user@distribution-switch# set vlan unit 0 family inet address 192.0.2.2/25
为支持广播域创建子网:
[edit interfaces] user@distribution-switch# set vlan unit 1 family inet address 192.0.2.130/25
结果
显示配置结果:
user@distribution-switch> show interfaces { ge-0/0/0 { description “Connection to access switch”; unit 0 { family ethernet-switching { port-mode trunk; vlan members [ sales support ]; native-vlan-id 1; } } } vlan { unit 0 { family inet address 192.0.2.2/25; } unit 1 { family inet address 192.0.2.130/25; } } } vlans { sales { vlan-id 100; vlan-description “Sales VLAN”; l3-interface vlan.0; } support { vlan-id 200; vlan-description “Support VLAN”; l3-interface vlan.1; } }
要快速配置分布式交换机,请发出 load merge terminal
命令,然后复制层次结构并将其粘贴到交换机终端窗口中。
验证
要确认配置工作正常,请执行以下任务:
验证接入交换机上的 VLAN 成员和接口
目的
验证是否已 sales 在交换机上创建 和 support 。
操作
列出交换机上配置的所有 VLAN:
user@switch> show vlans Name Tag Interfaces default ge-0/0/1.0, ge-0/0/2.0, ge-0/0/4.0, ge-0/0/5.0, ge-0/0/6.0, ge-0/0/7.0, ge-0/0/8.0*, ge-0/0/9.0, ge-0/0/10.0, ge-0/0/11.0*, ge-0/0/12.0, ge-0/0/13.0, ge-0/0/14.0, ge-0/0/15.0, ge-0/0/16.0, ge-0/0/17.0, ge-0/0/18.0, ge-0/0/19.0*,ge-0/0/21.0, ge-0/0/23.0, ge-0/0/25.0, ge-0/0/27.0*,ge-0/0/28.0, ge-0/0/29.0, ge-0/0/30.0, ge-0/0/31.0*,ge-0/0/32.0, ge-0/0/33.0, ge-0/0/34.0, ge-0/0/35.0*,ge-0/0/36.0, ge-0/0/37.0, ge-0/0/38.0, ge-0/0/39.0*,ge-0/0/40.0, ge-0/0/41.0, ge-0/0/42.0, ge-0/0/43.0*,ge-0/0/45.0, ge-0/0/47.0, ge-0/1/1.0*, ge-0/1/2.0*, ge-0/1/3.0* sales 100 ge-0/0/0.0*, ge-0/0/3.0, ge-0/0/20.0, ge-0/0/22.0, ge-0/1/0.0*, support 200 ge-0/0/24.0*, ge-0/0/26.0, ge-0/0/44.0, ge-0/0/46.0, mgmt me0.0*
意义
输出显示和 salessupport VLAN 以及与之关联的接口。
验证分布式交换机上的 VLAN 成员和接口
目的
验证是否已 sales 在交换机上创建 和 support 。
操作
列出交换机上配置的所有 VLAN:
user@switch> show vlans Name Tag Interfaces default ge-0/0/1.0, ge-0/0/2.0, ge-0/0/3.0, ge-0/0/4.0, ge-0/0/5.0, ge-0/0/6.0, ge-0/0/7.0*, ge-0/0/8.0, ge-0/0/9.0, ge-0/0/10.0*, ge-0/0/11.0, ge-0/0/12.0, ge-0/0/13.0, ge-0/0/14.0, ge-0/0/15.0, ge-0/0/16.0, ge-0/0/17.0, ge-0/0/18.0*, ge-0/0/19.0, ge-0/0/20.0, ge-0/0/21.0, ge-0/0/22.0*, ge-0/0/23.0, ge-0/1/1.0*, ge-0/1/2.0*, ge-0/1/3.0* sales 100 ge-0/0/0.0* support 200 ge-0/0/0.0* mgmt me0.0*
意义
输出显示sales与接口 ge-0/0/0.0关联的 和 support VLAN。接口 ge-0/0/0.0 是连接到接入交换机的中继接口。
为访问模式配置逻辑接口
企业网络管理员可以配置单个逻辑接口来接受未标记的数据包,并在指定 VLAN 内转发数据包。配置为接受未标记数据包的逻辑接口称为 接入接口 或 接入端口。
interface-mode access;
您可以在以下层次结构级别包含此语句:
[edit interfaces interface-name unit logical-unit-number family ethernet-switching]
[edit logical-systems logical-system-name interfaces interface-name unit logical-unit-number family ethernet-switching]
当接入接口上收到未标记或已标记的数据包时,将接受该数据包,将 VLAN ID 添加到数据包中,并在配置了匹配 VLAN ID 的 VLAN 内转发数据包。
以下示例在支持增强型第 2 层软件的路由器和交换机上将逻辑接口配置为 VLAN ID 为 20 的接入端口:
[edit interfaces ge-1/2/0] unit 1 { family ethernet-switching { interface-mode access; vlan members 20; } }
另请参阅
配置本机 VLAN 标识符
此任务将 Junos OS 用于 EX 系列交换机,将 Junos OS 用于不支持增强型第 2 层软件 (ELS) 配置样式的 QFX3500 和 QFX3600 交换机。如果您的交换机运行支持 ELS 的软件,请参阅 在支持 ELS 的交换机上配置本机 VLAN 标识符。有关 ELS 的详细信息,请参阅使用增强型第 2 层软件 CLI。
EX 系列交换机支持接收和转发带有 802.1Q VLAN 标记的路由或桥接以太网帧。要接收未标记数据包的逻辑接口必须使用与物理接口上配置的 VLAN ID 相同的本地 VLAN ID 进行配置。
要使用 CLI 配置本机 VLAN ID,请执行以下操作:
在支持 ELS 的交换机上配置本机 VLAN 标识符
此任务将 Junos OS 用于 EX 系列交换机,将 Junos OS 用于支持增强型第 2 层软件 (ELS) 配置样式的 QFX3500 和QFX3600交换机。如果交换机运行的软件不支持 ELS,请参阅 配置本机 VLAN 标识符。有关 ELS 的详细信息,请参阅使用增强型第 2 层软件 CLI。
交换机可以接收和转发带有 802.1Q VLAN 标签的路由或桥接以太网帧。通常,将交换机相互连接的中继端口接受未标记的控制数据包,但不接受未标记的数据包。通过在要接收未标记数据包的接口上配置本机 VLAN ID,可以使中继端口接受未标记的数据包。要接收未标记数据包的逻辑接口必须使用与物理接口上配置的本机 VLAN ID 相同的 VLAN ID 进行配置。
要使用命令行界面 (CLI) 配置本机 VLAN ID,请执行以下操作:
配置 VLAN 封装
要在接口上配置封装,请在层次结构级别输入 encapsulation
语句 [edit interfaces interface-name]
:
[edit interfaces interface-name] encapsulation type;
以下列表包含有关封装的重要说明:
VLAN 模式下的以太网接口可以有多个逻辑接口。在 CCC 和 VPLS 模式下,从 1 到 511 的 VLAN ID 保留给普通 VLAN,VLAN ID 512 到 4094 保留给 CCC 或 VPLS VLAN。对于 4 端口快速以太网接口,您可以将 VLAN ID 512 到 1024 用于 CCC 或 VPLS VLAN。
对于封装类型 flexible-ethernet-services,所有 VLAN ID 均有效。
对于某些封装类型(包括灵活以太网服务、以太网 VLAN CCC 和 VLAN VPLS),您还可以配置 VLAN 电路本身内部使用的封装类型。为此,请包含以下
encapsulation
语句:encapsulation (vlan-ccc | vlan-tcc | vlan-vpls);
您可以在以下层次结构级别包含此语句:
[edit interfaces interface-name unit logical-unit-number]
[edit logical-systems logical-system-name interfaces interface-name unit logical-unit-number]
您无法使用 VLAN CCC 或 VLAN VPLS 封装配置逻辑接口,除非您还使用相同的封装或灵活的以太网服务封装配置物理设备。通常,逻辑接口的 VLAN ID 必须为 512 或更高;如果 VLAN ID 为 511 或更低,则除了源地址过滤外,还将对其进行正常的目标过滤器查找。但是,如果配置灵活以太网服务封装,则会删除此 VLAN ID 限制。
通常,您可以在层次结构级别配置接口的封装 [edit interfaces interface-name]
。
示例:在千兆以太网接口上配置 VLAN 封装
在千兆以太网接口上配置 VLAN CCC 封装:
interfaces ge-2/1/0 { vlan-tagging; encapsulation vlan-ccc; unit 0 { encapsulation vlan-ccc; vlan-id 600; } }
示例:在聚合以太网接口上配置 VLAN 封装
在聚合千兆以太网接口上配置 VLAN CCC 封装:
interfaces ae0 { vlan-tagging; encapsulation vlan-vpls; unit 0 { vlan-id 100; } }
另请参阅
变更历史表
是否支持某项功能取决于您使用的平台和版本。 使用 Feature Explorer 查看您使用的平台是否支持某项功能。
family ethernet-switching
和 的 flexible-vlan-tagging
接口。