Created on 
    
	
		
		
		11-19-2023
	
		
		03:02 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
  Edited on 
    
	
		
		
		09-26-2025
	
		
		02:20 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 By  
				
		 Jean-Philippe_P
		
			Jean-Philippe_P
		
		
		
		
		
		
		
		
	
			 
		
| 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 
 
 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> 
 This is useful when the FortiGate is behind the NAT and the public IP of the WAN connection(s) is not known. 
 Related article: | 
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.