Skip to main content
lgupta
Staff
Staff
November 19, 2023

Technical Tip: Get the public IP of the WAN connection from the CLI

  • November 19, 2023
  • 0 replies
  • 27849 views
Description This article describes how to obtain the WAN IP from the FortiGate CLI.
Scope FortiGate.
Solution

Run the following command in the CLI:

 

diagnose sys waninfo ipify

 

TEST.png

 

This will grab the public IP of the default connection from https://api.ipify.org.

 

If multiple WAN connections are in place and it is necessary to obtain the public IP for a specific one, run the following:

 

diagnose sys waninfo ipify <interface_name>

 

If multi-VDOM is used, the command must be run on global VDOM:

config global
diagnose sys waninfo ipify

 

This is useful when the FortiGate is behind NAT and the public IP of the WAN connection(s) is not known.

Related article:

Technical Tip: How does 'diagnose sys waninfo ipify' command identify the WAN ip address of the FortiGate