FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Gab_FTNT
Staff & Editor
Staff & Editor
Article Id 343966
Description This article describes displaying the DHCP-assigned IP address on a specific interface from CLI.
Scope FortiGate.
Solution

The following commands can be useful for displaying the IP address received from DHCP on a FortiGate interface from the CLI.
In this example, FortiGate port1 mode is set to DHCP.

editport1.PNG
The command fnsysctl ifconfig can be used to display the inet addr, which is the IP address received by the interface from DHCP in that case.
Syntax: fnsysctl ifconfig <interface name>.

fnsysctl.PNG
Alternatively, the command 'get' can also be used to display the IP address of the interface under 'config system interface'.
Syntax: get <interface name>.

getpoort11.PNG
By using these two commands, it is possible to successfully learn the IP address received from DHCP.
This method is especially useful in a situation where the GUI is inaccessible.

 

The following commands can also be used to fetch the dynamic IP assigned to the interface:

 

get system interface physical <interface name>

 

Number the output lines using -n for easier reference.

 

diagnose ip address  list  | grep -n port1

 

Example:

 

show system interface port1
    config system interface
        edit "port1"
            set vdom "root"
            set mode dhcp
            set allowaccess ping https ssh http
            set type physical
            set snmp-index 1
        next
end

 

get system interface physical port1
== [onboard]
==[port1]
mode: dhcp
ip: 192.168.181.136 255.255.255.0
ipv6: ::/0
status: up
speed: 10000Mbps (Duplex: full)
FEC: none
FEC_cap: none