华为交换机实现不同VLAN内的互通配置(汇聚层设备作为网关)
创作时间:
作者:
@小白创作中心
华为交换机实现不同VLAN内的互通配置(汇聚层设备作为网关)
引用
CSDN
1.
https://blog.csdn.net/qq_43127132/article/details/143625402
在企业网络环境中,VLAN(虚拟局域网)的配置是实现网络隔离和管理的重要手段。本文将通过一个具体的网络拓扑案例,详细介绍如何在华为交换机上配置不同VLAN间的互通,包括创建VLAN、配置接口类型和VLANIF接口作为网关等关键步骤。
背景如下:
如下图所示,PC1和PC2分别属于VLAN 2和VLAN 3,通过接入层设备DeviceB接入汇聚层设备DeviceA。PC3属于VLAN 4,通过接入层设备DeviceC接入汇聚层设备DeviceA。DeviceC不做任何配置,当做HUB即插即用。汇聚层设备DeviceA作为PC1、PC2和PC3的网关,实现用户PC间的互访以及和上层设备的互连。
操作步骤
- 配置接入层设备DeviceB。
#创建VLAN。
<HUAWEI> system-view
[HUAWEI] sysname DeviceB
[DeviceB] vlan batch 2 3
#将接口加入相应VLAN。
[DeviceB] interface 10ge 1/0/2
[DeviceB-10GE1/0/2] portswitch
[DeviceB-10GE1/0/2] port link-type access
[DeviceB-10GE1/0/2] port default vlan 2
[DeviceB-10GE1/0/2] quit
[DeviceB] interface 10ge 1/0/3
[DeviceB-10GE1/0/3] portswitch
[DeviceB-10GE1/0/3] port link-type access
[DeviceB-10GE1/0/3] port default vlan 3
[DeviceB-10GE1/0/3] quit
[DeviceB] interface 10ge 1/0/1
[DeviceB-10GE1/0/1] portswitch
[DeviceB-10GE1/0/1] port link-type trunk
[DeviceB-10GE1/0/1] port trunk allow-pass vlan 2 3
[DeviceB-10GE1/0/1] quit
- 配置汇聚层设备DeviceA。
#创建VLAN。
<HUAWEI> system-view
[HUAWEI] sysname DeviceA
[DeviceA] vlan batch 2 to 5
#将连接DeviceB、DeviceC的接口加入相应VLAN。
[DeviceA] interface 10ge 1/0/2
[DeviceA-10GE1/0/2] portswitch
[DeviceA-10GE1/0/2] port link-type trunk
[DeviceA-10GE1/0/2] port trunk allow-pass vlan 2 3
[DeviceA-10GE1/0/2] quit
[DeviceA] interface 10ge 1/0/3
[DeviceA-10GE1/0/3] portswitch
[DeviceA-10GE1/0/3] port link-type access
[DeviceA-10GE1/0/3] port default vlan 4
[DeviceA-10GE1/0/3] quit
#配置VLANIF接口,作为用户PC的网关。
[DeviceA] interface vlanif 2
[DeviceA-Vlanif5] ip address 192.168.2.1 24
[DeviceA-Vlanif5] quit
[DeviceA] interface vlanif 3
[DeviceA-Vlanif5] ip address 192.168.3.1 24
[DeviceA-Vlanif5] quit
[DeviceA] interface vlanif 4
[DeviceA-Vlanif5] ip address 192.168.4.1 24
[DeviceA-Vlanif5] quit
将连接上层设备的接口加入相应VLAN。
[DeviceA] interface 10ge 1/0/1
[DeviceA-10GE1/0/1] portswitch
[DeviceA-10GE1/0/1] port link-type access
[DeviceA-10GE1/0/1] port default vlan 5
[DeviceA-10GE1/0/1] quit
#配置
VLANIF
接口,实现内网网段到上层设备的访问。
[DeviceA] interface vlanif 5
[DeviceA-Vlanif5] ip address 192.168.5.1 24
[DeviceA-Vlanif5] quit
检查配置结果
执行命令
display vlan
可以查看VLAN状态,
以DeviceB为例:
[DeviceB] display vlan 2
--------------------------------------------------------------------------------
U: Up; D: Down; TG: Tagged; UT: Untagged;
MP: Vlan-mapping; ST: Vlan-stacking;
#: ProtocolTransparent-vlan; *: Management-vlan;
MAC-LRN: MAC-address learning; STAT: Statistic;
BC: Broadcast; MC: Multicast; UC: Unknown-unicast;
FWD: Forward; DSD: Discard;
--------------------------------------------------------------------------------
VID Ports
--------------------------------------------------------------------------------
2 UT:10GE1/0/2(U) 10GE1/0/3(U)
TG:10GE1/0/1(U)
VID Type Status Property MAC-LRN STAT BC MC UC Description
--------------------------------------------------------------------------------
2 common enable default enable disable FWD FWD FWD VLAN 0002
#执行命令
display port vlan
,查看接口上可以通过的VLAN信息,以DeviceB的接口10GE1/0/1为例:
[DeviceB] display port vlan 10ge 1/0/1
Port Link Type PVID Trunk VLAN List Port Description
---------------------------------------------------------------------------------------------------------------
10GE1/0/1 trunk 1 2-3
配置脚本
• DeviceA
sysname DeviceA
vlan batch 2 to 5
interface Vlanif2
ip address 192.168.2.1 255.255.255.0
interface Vlanif3
ip address 192.168.3.1 255.255.255.0
interface Vlanif4
ip address 192.168.4.1 255.255.255.0
interface Vlanif5
ip address 192.168.5.1 255.255.255.0 //上行出口
interface 10GE1/0/1
port link-type access
port default vlan 5
interface 10GE1/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface 10GE1/0/3
port link-type access
port default vlan 4
return
• DeviceB
sysname DeviceB
vlan batch 2 to 3
interface 10GE1/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 3
interface 10GE1/0/2
port link-type access
port default vlan 2
interface 10GE1/0/3
port link-type access
port default vlan 3
return
• DeviceC
sysname DeviceC
vlan batch 4
interface 10GE1/0/1
port link-type access
port default vlan 4
interface 10GE1/0/2
port link-type access
port default vlan 4
return
日常学习总结
热门推荐
探寻茶文化新风尚:网上喝茶群的魅力与拓展策略
十种适合表演的乐器推荐 演出一般用什么乐器
如何安全使用微波炉?常见误区与注意事项
关于登革热12个你最关心的问题,一次说清
Excel中获取本月天数的多种方法
公积金转移需要提供什么资料
怎么能引起肠炎的发生
薪酬沟通的艺术:如何专业处理加薪被拒的沟通难题
我国一级亲属范围解析:亲缘关系的界定与运用
榕树盆景养护全攻略:从种植到冬季落叶应对
哪吒2部分角色深度剖析,细节满满
劳动法新规定旷工如何处理
古代武打剧中绝技“飞扑”的实际效能与练法要点
岳麓书院:探秘千年学府的文化与历史
“智能化+个性化”,一文解读:基于人工智能的慢病健康管理
全球超10000枚核弹,如果全引爆,会发生什么后果?超乎你想象
特殊的修辞手法之六一:讽刺
真正有心机的人,才会拥有的4大特征
小托福阅读高分攻略:提升效率与准确性的实用技巧
哺乳期能吃小柴胡颗粒然后喂奶吗
十大超好吃的饺子吃法分享 10种受欢迎的家常饺子吃法
业务中台架构怎么与前台和后台协作
竹粉制板工艺:从传统竹编到现代环保板材
种植牙是否可以使用美白牙贴?了解相关注意事项与建议
高等级浮息信用债发展现状及建议
減肥必看指南!燕麥片真的健康嗎?燕麥片3個減重優勢、熱量真相
多声部音乐在声乐教学中的实践与思考
离婚后如何让孩子过得快乐?全职家庭离婚补偿与财产分割指南
葡萄酒蒸馏发法
胃原位癌切除术后一年应如何进行复查