news 2026/9/25 10:02:31

超详细华为防火墙旁挂案例(使用ospf对接,dhcp获取地址)

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
超详细华为防火墙旁挂案例(使用ospf对接,dhcp获取地址)
1.实验拓扑

2.基本配置
a.接入配置(创建VPN实例,获取地址等)

SW1:

#
vlan batch 10 20 30 40
#
ip vpn-instance a
ipv4-family
route-distinguisher 1:1
#
ip vpn-instance b
ipv4-family
route-distinguisher 1:2
#
interface Vlanif10
ip binding vpn-instance a
ip address 192.168.1.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.1.2
#
interface Vlanif20
ip binding vpn-instance b
ip address 192.168.2.254 255.255.255.0
dhcp select relay
dhcp relay server-ip 10.1.2.2
#
interface Vlanif30
ip binding vpn-instance a
ip address 10.1.1.1 255.255.255.0
#
interface Vlanif40
ip binding vpn-instance b
ip address 10.1.2.1 255.255.255.0
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 10 20 30 40
#

AR1:

#
ip vpn-instance a
ipv4-family
route-distinguisher 1:1
#
ip vpn-instance b
ipv4-family
route-distinguisher 1:2
#
ip pool a
vpn-instance a
gateway-list 192.168.1.254
network 192.168.1.0 mask 255.255.255.0
#
ip pool b
vpn-instance b
gateway-list 192.168.2.254
network 192.168.2.0 mask 255.255.255.0
#
interface GigabitEthernet0/0/0.10
dot1q termination vid 30
ip binding vpn-instance a
ip address 10.1.1.2 255.255.255.0
arp broadcast enable
dhcp select global
#
interface GigabitEthernet0/0/0.20
dot1q termination vid 40
ip binding vpn-instance b
ip address 10.1.2.2 255.255.255.0
arp broadcast enable
dhcp select global
#

AR2:

#
interface GigabitEthernet0/0/0
ip address 10.1.12.2 255.255.255.0
#

b.ospf和防火墙对接和出口对接

AR1:

#
interface GigabitEthernet0/0/1.1
dot1q termination vid 100
ip binding vpn-instance a
ip address 64.1.1.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/1.2
dot1q termination vid 101
ip binding vpn-instance b
ip address 64.1.2.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/2
#
interface GigabitEthernet0/0/2.1
dot1q termination vid 102
ip address 64.1.3.1 255.255.255.0
arp broadcast enable
#
interface GigabitEthernet0/0/2.2
dot1q termination vid 103
ip address 64.1.4.1 255.255.255.0
arp broadcast enable
#
#
ospf 1
area 0.0.0.0
network 10.1.12.0 0.0.0.255
network 64.1.3.0 0.0.0.255
network 64.1.4.0 0.0.0.255
#
ospf 2 vpn-instance a
vpn-instance-capability simple
area 0.0.0.2
network 10.1.1.0 0.0.0.255
network 64.1.1.0 0.0.0.255
#
ospf 3 vpn-instance b
vpn-instance-capability simple
area 0.0.0.3
network 10.1.2.0 0.0.0.255
network 64.1.2.0 0.0.0.255
#

FW1:
#
vsys name a 1
assign interface GigabitEthernet1/0/0.1
assign interface GigabitEthernet1/0/1.1
#
vsys name b 2
assign interface GigabitEthernet1/0/0.2
assign interface GigabitEthernet1/0/1.2
#
ip vpn-instance a
ipv4-family
ipv6-family
#
ip vpn-instance b
ipv4-family
ipv6-family

#
interface GigabitEthernet1/0/0.1
vlan-type dot1q 100
ip binding vpn-instance a
ip address 64.1.1.2 255.255.255.0
alias GE1/0/0.1
#
interface GigabitEthernet1/0/0.2
vlan-type dot1q 101
ip binding vpn-instance b
ip address 64.1.2.2 255.255.255.0
alias GE1/0/0.2
#
interface GigabitEthernet1/0/1
undo shutdown
#
interface GigabitEthernet1/0/1.1
vlan-type dot1q 102
ip binding vpn-instance a
ip address 64.1.3.2 255.255.255.0
alias GE1/0/1.1
#
interface GigabitEthernet1/0/1.2
vlan-type dot1q 103
ip binding vpn-instance b
ip address 64.1.4.2 255.255.255.0
alias GE1/0/1.2
#

interface Virtual-if0
ip address 172.16.1.1 255.255.255.0
#
interface Virtual-if1
ip address 172.16.1.2 255.255.255.0
#
interface Virtual-if2
ip address 172.16.1.3 255.255.255.0
#
ospf 2 vpn-instance a
vpn-instance-capability simple
area 0.0.0.0
network 64.1.3.0 0.0.0.255
area 0.0.0.2
network 64.1.1.0 0.0.0.255
#
ospf 3 vpn-instance b
vpn-instance-capability simple
area 0.0.0.0
network 64.1.4.0 0.0.0.255
area 0.0.0.3
network 64.1.2.0 0.0.0.255
#

AR2:

#
ospf 1
default-route-advertise always
area 0.0.0.0
network 10.1.12.0 0.0.0.255
#

3.结果验证
a.ospf邻居是否建立

b.是否能ping通外网

4.总结

a.使用vpn-instance隔离内网两个网段,使用dhcp(vpn-instance)来获取地址

b.使用ospf来让路由器AR1和防火墙进行对接,最后让路由器的area 0(public区域)和防火墙的area 0(vpn a和vpn b)进行邻居建立,让路由从vpn-instance实例表到路由器的public表,这样vpn a和vpn b也可以互访了,而且是需要经过防火墙的,这样可以对业务进行管控

c.此案例在园区网很常见,大家可以好好学习

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/9/22 16:19:27

嵌入式RTC抽象库:统一接口适配多款I²C时钟芯片

1. 项目概述bb_rtc是由 BitBank Software 开发的跨平台、设备无关型实时时钟(RTC)抽象库,专为嵌入式系统设计。其核心工程目标并非提供单一芯片的驱动,而是构建一个统一的 RTC 功能接口层,屏蔽 DS3231、RV-3032、PCF85…

作者头像 李华
网站建设 2026/9/22 17:05:11

Linux下大文件切割与合并实战:解决FAT32文件系统传输限制

在日常工作中,我们经常会遇到需要传输超过4GB的大文件(如ISO镜像、数据库备份、日志文件等)到FAT32文件系统的存储设备(如U盘、移动硬盘)上,但由于FAT32文件系统本身的设计限制,单个文件最大只能…

作者头像 李华
网站建设 2026/9/22 15:45:18

代购佣金计算系统的设计与实现

随着跨境代购业务规模化发展,人工核算佣金效率低、易出错、对账复杂,已成为制约业务扩张的核心痛点。构建一套自动化、可配置、高可靠的代购佣金计算系统,可实现订单佣金实时计算、多级分润自动分配、结算流程线上化与风险可控,显…

作者头像 李华
网站建设 2026/9/24 0:02:35

反向海淘平台开发踩坑经验总结

反向海淘平台看似是 “把国内商品卖给海外用户” 的简单链路,实则横跨供应链、跨境支付、国际物流、多语言合规、风控反欺诈五大复杂场景。从 0 到 1 搭建与迭代过程中,稍有疏忽就会引发超卖、拒付、清关卡关、资金冻结、用户投诉等致命问题。本文结合实…

作者头像 李华
网站建设 2026/9/22 17:35:36

PAW_Sensor嵌入式驱动:土壤水分与环境参数采集实战

1. PAW_Sensor库深度解析:面向嵌入式系统的土壤水分与环境参数采集驱动设计1.1 库定位与工程价值PAW_Sensor并非通用型传感器抽象层,而是一个高度垂直化的固件级驱动组件,专为特定型号的PAW(Plant Available Water)土壤…

作者头像 李华