Description
This article describes how to resolve a hostname to the IP address from the FortiGate CLI.
Scope
For all supported Fortios versions from v6.2.x to v7.6.x.
Solution
To perform a hostname resolution from the FortiGate CLI, the following commands can be used:
execute ping
execute traceroute
Both should return the primary IP address for a given domain. It is assumed, that the FortiGate unit has a valid DNS configured.
Here is an example with mylabdomain.com, returning IP address 172.31.1.1
Here is an example with mylabdomain.com, returning IP address 172.31.1.1
FGT # execute ping mylabdomain.com
PING mylabdomain.com ( 172.31.1.1 ) : 56 data bytes
64 bytes from 172.31.1.1: icmp_seq=0 ttl=245 time=75.4 ms
FGT # execute traceroute mylabdomain.com
traceroute to mylabdomain.com ( 172.31.1.1 ), 32 hops max, 72 byte packets
1 172.31.1.1 0 ms 0 ms 0 ms
If the resolution does not work, refer to: