Created on
03-14-2020
08:48 AM
Edited on
09-19-2024
10:36 PM
By
Jean-Philippe_P
Description
This article describes how to let a FortiGate access an internal DNS through a site-to-site IPsec VPN.
Scope
FortiGate, IPsec VPN.
Solution
In some circumstances, it is necessary to point the FortiGate to an internal DNS server.
If that internal DNS server is in a different location connected through an IPsec tunnel originating on the FortiGate, some configuration is required to let the FortiGate send DNS traffic through the tunnel properly.
This is necessary as by default, FortiGate uses an outgoing interface IP for traffic, and VPN interfaces do not usually have an IP.
Prerequisites:
Site-to-Site VPN fully configured with routing and policies.
There are two options to let a FortiGate access a DNS through a site-to-site VPN:
This allows the FortiGate to send traffic through the VPN utilizing source IP 10.0.0.17.
No further configuration for phase2 selectors, policies, or routing is required, as FortiGate can rely on the existing setup.
If a different source-IP is selected, then:
A downside to this setup is that should the VPN go down, the FortiGate will lose access to the DNS server entirely.
No public DNS server can be configured as a secondary server, as the FortiGate is using the configured source-IP to send traffic out its WAN interface.
Only a local, internal DNS server works as backup.
In cases where FortiGate primarily uses an internal DNS, but have the option to fall back to a public DNS server, source IPs usually cannot be configured, as otherwise the FortiGate is using the (private) source IP to reach out to the public DNS server.
Under such circumstances, a transit network needs to be configured on the VPN directly, similarly to requirements for dynamic routing through a VPN tunnel.
The following needs to be configured:
DNS servers with primary internal and secondary public DNS server, as an example:
config sys dns
set primary 172.16.0.250
set secondary 8.8.8.8
end
A transit network for the tunnel, not in use anywhere else (as an example, 192.168.255.0/30).
Then IPs need to be configured on the tunnel interface:
config sys interface
edit test2
set ip 192.168.255.1/32
set remote-ip 192.168.255.2/32
end
Add the configured subnet to the phase2 selectors on both ends.
Also add the configured IPs to any required policies on the remote side.
With the tunnel IPs configured, that means the FortiGate will use the tunnel-IP (192.168.255.1 in the example) to attempt to contact the internal DNS server.
For the public DNS server, use its WAN IP.
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.