はじめに
FortiGate にて DHCP サーバ機能を有効化して、FortiGate に接続している機器へ IP アドレス等のネットワーク情報を払い出すための設定方法について記載します。
作業環境
- 型番:FortiGate 60E
- バージョン:v6.2.6
DHCP サーバの基本設定
GUI で設定する場合
DHCP サーバ機能はインターフェース単位で有効化および設定します。
DHCP サーバ機能を有効化したいインターフェースの編集画面を表示します。
[DHCPサーバ] という項目があるため、ラジオボタンをクリックして有効化します。すると以下画像のように設定項目が表示されます。デフォルトで設定値が入っているため、必要に応じて設定変更します。
- アドレス範囲:DHCP クライアントに払い出すアドレスの範囲
- ネットマスク:払い出すアドレスのネットマスク
- デフォルトゲートウェイ:払い出すデフォルトゲートウェイ
- DNSサーバ:払い出す DNS サーバ
- Lease time:リースタイム(秒)
- 範囲:0, 300-8640000
- 0 は 無期限の意味
- デフォルト:604800(168時間)
- 範囲:0, 300-8640000
- 高度な設定:クリックすると高度な設定項目が表示されますがここでは省略
設定ができたら [OK] をクリックして確定します。
インターフェース一覧画面にて、以下のように [DHCP Range] 欄にアドレス範囲が表示されることを確認します。
以上で DHCP サーバ設定は完了です。
CLI で設定する場合
コンフィグにおける DHCP サーバに関する設定項目は config system dhcp server
です。
前述の GUI での設定を行った後のコンフィグは以下の通りです。
FW02 (server) # show
config system dhcp server
edit 1
set dns-service default
set default-gateway 192.168.1.100
set netmask 255.255.255.0
set interface "internal1"
config ip-range
edit 1
set start-ip 192.168.1.1
set end-ip 192.168.1.99
next
edit 2
set start-ip 192.168.1.101
set end-ip 192.168.1.254
next
end
next
end
FW02 (server) # show full-configuration
config system dhcp server
edit 1
set status enable
set lease-time 604800
set mac-acl-default-action assign
set forticlient-on-net-status enable
set dns-service default
set wifi-ac-service specify
set wifi-ac1 0.0.0.0
set wifi-ac2 0.0.0.0
set wifi-ac3 0.0.0.0
set ntp-service specify
set domain ''
set wins-server1 0.0.0.0
set wins-server2 0.0.0.0
set default-gateway 192.168.1.100
set next-server 0.0.0.0
set netmask 255.255.255.0
set interface "internal1"
config ip-range
edit 1
set start-ip 192.168.1.1
set end-ip 192.168.1.99
next
edit 2
set start-ip 192.168.1.101
set end-ip 192.168.1.254
next
end
set timezone-option disable
set filename ''
set server-type regular
set conflicted-ip-timeout 1800
set auto-configuration enable
set ddns-update disable
set vci-match disable
set ntp-server1 0.0.0.0
set ntp-server2 0.0.0.0
set ntp-server3 0.0.0.0
next
end
各設定項目のヘルプは以下の通りです。
FW02 (1) # set
status Enable/disable this DHCP configuration.
lease-time Lease time in seconds, 0 means unlimited.
mac-acl-default-action MAC access control default action (allow or block assigning IP settings).
forticlient-on-net-status Enable/disable FortiClient-On-Net service for this DHCP server.
dns-service Options for assigning DNS servers to DHCP clients.
wifi-ac-service Options for assigning WiFi Access Controllers to DHCP clients
wifi-ac1 WiFi Access Controller 1 IP address (DHCP option 138, RFC 5417).
wifi-ac2 WiFi Access Controller 2 IP address (DHCP option 138, RFC 5417).
wifi-ac3 WiFi Access Controller 3 IP address (DHCP option 138, RFC 5417).
ntp-service Options for assigning Network Time Protocol (NTP) servers to DHCP clients.
ntp-server1 NTP server 1.
ntp-server2 NTP server 2.
ntp-server3 NTP server 3.
domain Domain name suffix for the IP addresses that the DHCP server assigns to clients.
wins-server1 WINS server 1.
wins-server2 WINS server 2.
default-gateway Default gateway IP address assigned by the DHCP server.
next-server IP address of a server (for example, a TFTP sever) that DHCP clients can download a boot file from.
*netmask Netmask assigned by the DHCP server.
*interface DHCP server can assign IP configurations to clients connected to this interface.
timezone-option Options for the DHCP server to set the client's time zone.
tftp-server One or more hostnames or IP addresses of the TFTP servers in quotes separated by spaces.
filename Name of the boot file on the TFTP server.
server-type DHCP server can be a normal DHCP server or an IPsec DHCP server.
conflicted-ip-timeout Time in seconds to wait after a conflicted IP address is removed from the DHCP range before it can be reused.
auto-configuration Enable/disable auto configuration.
ddns-update Enable/disable DDNS update for DHCP.
vci-match Enable/disable vendor class identifier (VCI) matching. When enabled only DHCP requests with a matching VCI are served.
FW02 (1) # set dns-service
local IP address of the interface the DHCP server is added to becomes the client's DNS server IP address.
default Clients are assigned the FortiGate's configured DNS servers.
specify Specify up to 3 DNS servers in the DHCP server configuration.
DHCP 関連コマンド
DHCP リース情報を確認するコマンド
FortiGate のインターフェースで DHCP サーバ機能が有効になっている場合に、DHCP リース情報を確認するためには CLI で execute dhcp lease-list
コマンドを実行します。
FW # execute dhcp lease-list
internal
IP MAC-Address Hostname VCI Expiry
192.168.1.110 1c:c0:35:03:54:68 hogePC MSFT 5.0 Sun Sep 13 08:10:40 2020
DHCP リース情報をクリアするコマンド
execute dhcp lease-clear
コマンドを実行します。
execute dhcp lease-clear all
- すべてのリース情報をクリアする場合は
all
を付けます
- すべてのリース情報をクリアする場合は
FW # execute dhcp lease-clear all
execute dhcp lease-clear <IPアドレス>
- 特定の IP アドレスについての情報をクリアする場合は
IP アドレス
を指定します
- 特定の IP アドレスについての情報をクリアする場合は
FW # execute dhcp lease-clear 192.168.1.110
複数の DNS サーバ情報を払い出す
複数の DNS サーバ情報を払い出す場合は、以下のように DNS サーバ設定で [指定] を選択した上で、DNS サーバの IP アドレスをコンマ「,」区切りで指定します。
CLI で設定する場合は、set dns-service specify
と設定した上で、set dns-server1
~ set dns-server4
で DNS サーバの IP アドレスを指定します。
config system dhcp server
edit N
set dns-service specify
set dns-server1 10.1.10.1
set dns-server2 10.1.10.2
set dns-server3 10.1.10.3
set dns-server4 0.0.0.0
next
end
DHCP サーバの高度な設定
DHCP サーバ設定欄中の [高度な設定] をクリックすると以下のような設定項目が表示されます。
■ [その他のDHCPオプション] → [新規作成] 画面
■ [IPアドレスの割り当てルール] → [新規作成] 画面
参考資料
- 【Fortinet Docs Library, Cookbook】DHCP server
- 【Fortinet Docs Library, CLI Reference】dhcp-lease-list
- 【Fortinet Docs Library, CLI Reference】dhcp-lease-clear
―――――――――――――