转换DNS解析结果
2025/10/29大约 2 分钟
转换DNS解析结果
DNS Translation功能用于将穿越FortiGate的DNS解析结果替换为指定的结果。
具体适用场景请见如下网络拓扑与说明。
网络拓扑

- DNS服务器位于Internet,内网PC填写的DNS服务器均为公网DNS服务器的IP 223.5.5.5。
- FortiGate通过VIP将Server的端口映射到WAN1(port1)的202.103.12.2。
- Server的域名为
www.fortitest.com,通过公网DNS服务器解析的结果为202.103.12.2。 - 需要实现的效果:
- 外网客户端访问Server时,直接通过
www.fortitest.com解析到公网IP 202.103.12.2,通过FortiGate的VIP映射访问即可。 - 内网客户端访问Server时,首先通过公网的DNS服务器223.5.5.5解析
www.fortitest.com的IP地址,DNS Server会回复解析结果为202.103.12.2,FortiGate需要将解析结果修改为Server的内网IP 10.10.2.100,然后转发给内网客户端,内网客户端直接通过解析到的Server内网IP访问服务器。
- 外网客户端访问Server时,直接通过
配置步骤
基础网络配置、上网策略、与Server的VIP配置(略)。
在FortiGate上配置DNS Translation,将DNS请求结果为202.103.12.2的DNS响应报文中的IP地址修改为Server的内网IP 10.10.2.100。
config firewall dnstranslation edit 1 set src 202.103.12.2 set dst 10.10.2.100 next end
结果验证
公网客户端PC使用DNS服务器223.5.5.5解析Server的域名(流量不经过FortiGate),得到结果为Server对应的VIP地址202.103.12.2。
C:\Users\Administrator.SUMMERICE2019>nslookup www.fortitest.com 服务器: public1.alidns.com Address: 223.5.5.5 非权威应答: 名称: www.fortitest.com Address: 202.103.12.2内网客户端PC使用DNS服务器223.5.5.5解析Server的域名(流量经过FortiGate),得到结果为Server内网IP 10.10.2.100。
C:\Users\Administrator.SUMMERICE2019>nslookup www.fortitest.com 服务器: public1.alidns.com Address: 223.5.5.5 非权威应答: 名称: www.fortitest.com Address: 10.10.2.100