Fortinet white logo
Fortinet white logo

CLI Reference

config system dhcpserver

config system dhcpserver

Description: Configure DHCP servers.

config system dhcpserver

edit <name>

set status [enable | disable | backup]

set lease-time [300 – 8640000]

set dns-service [default | specify | wan-dns | local]

set dns-server1 {ipv4-address} *available when dns-service is set to specify

set dns-server2 {ipv4-address} *available when dns-service is set to specify

set dns-server3 {ipv4-address} *available when dns-service is set to specify

set ntp-service [local | default| specify]

set ntp-server1 {ipv4-address}

set ntp-server2 {ipv4-address}

set ntp-server3 {ipv4-address}

set *default-gateway {ipv4-address}

set *netmask {netmask}

set *interface <name1>

set *start-ip {ipv4-address}

set *end-ip {ipv4-address}

set mtu [512 – 9000]

set reserved-address [enable | disable]

unset

Sample command:
config system dhcpserver
    edit 1
        set status enable
        set lease-time 86400
        set dns-service default
        set ntp-service specify
        set ntp-server1
        set ntp-server2
        set ntp-server3
        set default-gateway 192.168.200.99
        set netmask 255.255.255.0
        set interface port4
        set start-ip 192.168.200.110
        set end-ip 192.168.200.210
        set mtu 1500
        set reserved-address disable
    next
end
Parameter

Description

Type

Size

Default

status Status of the DHCP configuration. option - enable

Option Description
enable Enable the DHCP server.
disable Disable the DHCP server.

backup

Enable in VRRP backup mode. (Note: The DHCP server is launched only when the VRRP primary goes down.)

lease-time Lease time in seconds. 0 means unlimited. integer 300 - 8640000 86400
dns-service Options for assigning DNS servers to DHCP clients. Option - default

Option Description
local
  • The IP address of the interface of the DHCP server that is added becomes the clients' DNS server IP address.
  • default Clients are assigned the FortiExtender configured DNS server.

    specify

  • Specify up to three DNS servers in the DHCP server configuration.
  • wan-dns

  • Use the WAN port DNS server.
  • The DNS of the WAN interface that is added becomes clients' DNS server IP address.
  • dns-server1

    Specify the IP address of DNS Server 1.

    Available when dns-service is set to specify.

    IPv4 address - none
    dns-server2

    Specify the IP address of DNS Server 2.

    Available when dns-service is set to specify.

    IPv4 address - none
    dns-server3

    Specify the IP address of DNS Server 3.

    Available when dns-service is set to specify.

    IPv4 address - none

    ntp-service

    Options for assigning Network Time Protocol (NTP) servers to DHCP clients.

    option

    Option Description
    local
  • The IP address of the interface of the DHCP server that is added becomes clients' NTP server IP address.
  • default Clients are assigned the FortiExtender configured NTP servers.

    specify

    Specify up to three NTP servers.

    ntp-server1

    Specify the IP address of NTP Server 1.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    none

    ntp-server2

    Specify the IP address of NTP Server 2.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    ntp-server3

    Specify the IP address of NTP Server 3.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    default-gateway

    Default gateway IP address assigned by the DHCP server.

    IPv4 address

    -

    none

    netmask

    Network mask assigned by the DHCP server.

    string

    -

    none

    interface

    DHCP server can assign IP configurations to clients connected to this interface.

    option

    -

    none

    Option Description
    lan LAN as the DHCP server interface.
    lo Loopback as the DHCP server interface.
    wan WAN as the DHCP server interface.
    port4 Port 4 as the DHCP server interface.

    start-ip

    Specify the start IP address of the DHCP IP address range. For example, 192.168.1.100.

    IPv4 address

    -

    none

    end-ip

    Specify the end IP address of the DHCP IP address range. For example, 192.168.1.120.

    IPv4 address

    -

    none

    mtu

    Sepcify the client's MTU size.

    integer

    512 - 9000

    1500

    reserved-address

    Status of reserved address and MAC mapping.

    Option

    -

    disable

    Option Description
    enable Enable the reserved address option by configuring the IP, MAC, and action as reserved or block.
    disable Disable the reserved address option.

    config system dhcpserver

    config system dhcpserver

    Description: Configure DHCP servers.

    config system dhcpserver

    edit <name>

    set status [enable | disable | backup]

    set lease-time [300 – 8640000]

    set dns-service [default | specify | wan-dns | local]

    set dns-server1 {ipv4-address} *available when dns-service is set to specify

    set dns-server2 {ipv4-address} *available when dns-service is set to specify

    set dns-server3 {ipv4-address} *available when dns-service is set to specify

    set ntp-service [local | default| specify]

    set ntp-server1 {ipv4-address}

    set ntp-server2 {ipv4-address}

    set ntp-server3 {ipv4-address}

    set *default-gateway {ipv4-address}

    set *netmask {netmask}

    set *interface <name1>

    set *start-ip {ipv4-address}

    set *end-ip {ipv4-address}

    set mtu [512 – 9000]

    set reserved-address [enable | disable]

    unset

    Sample command:
    config system dhcpserver
        edit 1
            set status enable
            set lease-time 86400
            set dns-service default
            set ntp-service specify
            set ntp-server1
            set ntp-server2
            set ntp-server3
            set default-gateway 192.168.200.99
            set netmask 255.255.255.0
            set interface port4
            set start-ip 192.168.200.110
            set end-ip 192.168.200.210
            set mtu 1500
            set reserved-address disable
        next
    end
    
    Parameter

    Description

    Type

    Size

    Default

    status Status of the DHCP configuration. option - enable

    Option Description
    enable Enable the DHCP server.
    disable Disable the DHCP server.

    backup

    Enable in VRRP backup mode. (Note: The DHCP server is launched only when the VRRP primary goes down.)

    lease-time Lease time in seconds. 0 means unlimited. integer 300 - 8640000 86400
    dns-service Options for assigning DNS servers to DHCP clients. Option - default

    Option Description
    local
  • The IP address of the interface of the DHCP server that is added becomes the clients' DNS server IP address.
  • default Clients are assigned the FortiExtender configured DNS server.

    specify

  • Specify up to three DNS servers in the DHCP server configuration.
  • wan-dns

  • Use the WAN port DNS server.
  • The DNS of the WAN interface that is added becomes clients' DNS server IP address.
  • dns-server1

    Specify the IP address of DNS Server 1.

    Available when dns-service is set to specify.

    IPv4 address - none
    dns-server2

    Specify the IP address of DNS Server 2.

    Available when dns-service is set to specify.

    IPv4 address - none
    dns-server3

    Specify the IP address of DNS Server 3.

    Available when dns-service is set to specify.

    IPv4 address - none

    ntp-service

    Options for assigning Network Time Protocol (NTP) servers to DHCP clients.

    option

    Option Description
    local
  • The IP address of the interface of the DHCP server that is added becomes clients' NTP server IP address.
  • default Clients are assigned the FortiExtender configured NTP servers.

    specify

    Specify up to three NTP servers.

    ntp-server1

    Specify the IP address of NTP Server 1.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    none

    ntp-server2

    Specify the IP address of NTP Server 2.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    ntp-server3

    Specify the IP address of NTP Server 3.

    Available when ntp-service is set to specify.

    IPv4 address

    -

    default-gateway

    Default gateway IP address assigned by the DHCP server.

    IPv4 address

    -

    none

    netmask

    Network mask assigned by the DHCP server.

    string

    -

    none

    interface

    DHCP server can assign IP configurations to clients connected to this interface.

    option

    -

    none

    Option Description
    lan LAN as the DHCP server interface.
    lo Loopback as the DHCP server interface.
    wan WAN as the DHCP server interface.
    port4 Port 4 as the DHCP server interface.

    start-ip

    Specify the start IP address of the DHCP IP address range. For example, 192.168.1.100.

    IPv4 address

    -

    none

    end-ip

    Specify the end IP address of the DHCP IP address range. For example, 192.168.1.120.

    IPv4 address

    -

    none

    mtu

    Sepcify the client's MTU size.

    integer

    512 - 9000

    1500

    reserved-address

    Status of reserved address and MAC mapping.

    Option

    -

    disable

    Option Description
    enable Enable the reserved address option by configuring the IP, MAC, and action as reserved or block.
    disable Disable the reserved address option.