设为首页收藏本站language 语言切换
查看: 3503|回复: 6
收起左侧

[分享] 华为防火墙配置VLAN间通过VLANIF接口通信

[复制链接]
 成长值: 63400
发表于 2019-10-24 16:19:47 | 显示全部楼层 |阅读模式
为了实现VLAN之间的互通,可以在设备上配置Vlanif接口,并在设备上启用路由功能。
组网需求
如图1所示,USG通过二层以太网接口下挂PC1和PC2,交接机通过二层以太网接口下挂PC3和PC4,USG通过三层接口Ethernet 0/0/0和交换机的二层接口Ethernet 0/0/1互联。要求PC1、PC2、PC3、PC4能够相互通信。
111.png
配置思路
1在USG上创建VLAN2,将接口Ethernet 1/0/1和Ethernet 1/0/2加入VLAN2,并配置接口Vlanif2的IP地址。
2在USG上配置Ethernet 0/0/0的IP地址为1.1.1.1,并配置到PC3和PC4所在网段130.1.1.0/24的路由,下一跳指向1.1.1.2。
3在交换机上创建VLAN3,将接口Ethernet 0/0/2和Ethernet 0/0/3加入VLAN3,并配置接口Vlanif3的IP地址。
4在交换机上创建VLAN100,将接口Ethernet 0/0/1加入VLAN100,并配置接口Vlanif100的IP地址为1.1.1.2。并配置到PC1和PC2所在网段120.1.1.0/24的路由,下一跳指向1.1.1.1。
5将PC1和PC2的默认网关配置为120.1.1.1,将PC3和PC4的默认网关配置为130.1.1.1。

操作步骤
配置USG。
# 创建VLAN2,向VLAN2中加入二层以太网接口Ethernet 1/0/1和Ethernet 1/0/2。
<USG> system-view
[USG] vlan 2
[USG-vlan-2] port interface Ethernet 1/0/1
[USG-vlan-2] port interface Ethernet 1/0/2
[USG-vlan-2] quit
# 创建Vlanif2接口,并配置Vlanif2的IP地址。
[USG] interface vlanif 2[USG-Vlanif2] ip address 120.1.1.1 24[USG-Vlanif2] quit
# 将Vlanif2接口加入Trust区域。
[USG] firewall zone trust
[USG-zone-trust] add interface Vlanif2
[USG-zone-trust] quit
# 配置和交换机互联的三层以太网接口Ethernet 0/0/0的IP地址。
[USG] interface Ethernet 0/0/0[USG-Ethernet0/0/0] ip address 1.1.1.1 24[USG-Ethernet0/0/0] quit
# 将接口Ethernet 0/0/0加入Trust区域。
[USG] firewall zone trust
[USG-zone-trust] add interface Ethernet 0/0/0
[USG-zone-trust] quit
# 配置到PC3和PC4所在网段130.1.1.0/24的路由,下一跳指向1.1.1.2。
[USG]  ip route-static 130.1.1.0 255.255.255.0 1.1.1.2
配置交换机。
说明:
以下配置以Quidway S2300为例进行说明,实际应用中请参考对应交换机的相关文档。
# 创建VLAN3,将Ethernet 0/0/2和将Ethernet 0/0/3加入VLAN3。
[Switch] vlan 3
[Switch-Vlan3] quit
[Switch] interface ethernet 0/0/2
[Switch-Ethernet0/0/2] port link-type access
[Switch-Ethernet0/0/2] port default vlan 3
[Switch-Ethernet0/0/2] quit
[Switch] interface ethernet 0/0/3
[Switch-Ethernet0/0/3] port link-type access
[Switch-Ethernet0/0/3] port default vlan 3
[Switch-Ethernet0/0/3] quit
# 创建Vlanif3接口,并配置Vlanif3的IP地址。
[Switch] interface vlanif 3[Switch-Vlanif3] ip address 130.1.1.1 24[Switch-Vlanif3] quit
# 创建VLAN100,将Ethernet 0/0/1加入VLAN100。
[Switch] vlan 100
[Switch-Vlan100] quit
[Switch] interface ethernet 0/0/1
[Switch-Ethernet0/0/1] port link-type access
[Switch-Ethernet0/0/1] port default vlan 100
[Switch-Ethernet0/0/1] quit
# 创建Vlanif100接口,并配置Vlanif100的IP地址。
[Switch] interface vlanif 100[Switch-Vlanif100] ip address 1.1.1.2 24[Switch-Vlanif100] quit
# 配置到PC1和PC2所在网段120.1.1.0/24的路由,下一跳指向1.1.1.1。
[Switch]  ip route-static 120.1.1.0 255.255.255.0 1.1.1.1
配置PC的IP地址和网关,PC1和PC2的默认网关为120.1.1.1,PC3和PC4的默认网关为130.1.1.1。

结果验证
配置完成后,检查VLAN2内的主机是否能够同VLAN3内的主机相互通信。
假设PC1的地址为120.1.1.2/24,PC3的地址为130.1.1.2/24,查看PC1能否ping通PC3。
C:\>ping 130.1.1.2
Pinging 130.1.1.2 with 32 bytes of data:
Reply from 130.1.1.2: bytes=32 time<1ms TTL=128
Reply from 130.1.1.2: bytes=32 time<1ms TTL=128
Reply from 130.1.1.2: bytes=32 time<1ms TTL=128
Reply from 130.1.1.2: bytes=32 time<1ms TTL=128
Ping statistics for 130.1.1.2  :
     Packets: Sent = 4,Received =4,Lost = 0 <0% loss>,
Approximates round trip times in milli-seconds:
     Minimum =0ms,Maximum =0ms,Average =0ms

发表于 2019-10-25 14:07:20 | 显示全部楼层
感谢楼主分享,好资源!
沙发 2019-10-25 14:07:20 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2019-10-25 14:07:30 | 显示全部楼层
感谢楼主分享,好资源!
板凳 2019-10-25 14:07:30 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2019-11-12 09:33:23 | 显示全部楼层
感谢楼主分享,好资源!谢谢!!!!!!!
5# 2019-11-12 09:33:23 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2020-1-27 20:00:06 | 显示全部楼层
ddddddddddddd
6# 2020-1-27 20:00:06 回复 收起回复
回复 支持 反对

使用道具 举报

发表于 2020-3-3 02:48:18 | 显示全部楼层
这个是什么防火墙?我用ensp5500模拟不行哦,希望能指导一下
7# 2020-3-3 02:48:18 回复 收起回复
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 论坛注册

本版积分规则

QQ|Archiver|手机版|小黑屋|sitemap|鸿鹄论坛 ( 京ICP备14027439号 )  

GMT+8, 2025-2-2 14:22 , Processed in 0.060370 second(s), 12 queries , Redis On.  

  Powered by Discuz!

  © 2001-2025 HH010.COM

快速回复 返回顶部 返回列表