Cisco、Fortinet、Juniper、MikroTik での DHCP サーバ設定例をメモしておきます。
検証環境
以下の OS バージョンで検証を実施しました。
OS | Version |
---|---|
IOSv | 15.6(2)T |
ASAv | 9.7(1) |
RouterOS | 6.41rc18 |
Junos | 17.2R1.13 |
NX-OSv 9000 | 7.0(3)I6(1) |
FortiGate | 5.4.4,build7605 |
いずれも以下の設定とします。
項目 | 値 |
---|---|
ネットワークアドレス | 10.0.0.0/24 |
サブネットマスク | 255.255.255.0 (/24) |
ゲートウェイ | ( 機器毎の設定を参照 ) |
DNS サーバ | 8.8.8.8, 8.8.4.4 |
IOSv での設定例
IOSv での設定例は以下の通りです。
ip dhcp excluded-address 10.0.0.0 10.0.0.99
ip dhcp excluded-address 10.0.0.200 10.0.0.255
!
ip dhcp pool DHCP-10.0.0.0_24
network 10.0.0.0 255.255.255.0
default-router 10.0.0.1
dns-server 8.8.8.8 8.8.4.4
lease 0 8
!
interface GigabitEthernet0/1
ip address 10.0.0.201 255.255.255.0
no shutdown
!
end
DHCP の割当て状態は show ip dhcp binding
で確認出来ます。
IOSv# show ip dhcp binding
Bindings from all pools not associated with VRF:
IP address Client-ID/ Lease expiration Type
Hardware address/
User name
10.0.0.100 0063.6973.636f.2d66. Sep 03 2017 07:31 PM Automatic
6131.362e.3365.6363.
2e64.6535.342d.4769.
302f.31
ASAv での設定例
ASAv での設定は以下の通りです。 今回の検証環境ですとリース時間は 300 〜 1,048,575 秒の間で設定可能でした。
interface GigabitEthernet0/0
nameif inside
security-level 100
ip address 10.0.0.202 255.255.255.0
no shutdown
!
dhcpd dns 8.8.8.8 8.8.4.4
dhcpd lease 28800
dhcpd option 3 ip 10.0.0.202
!
dhcpd address 10.0.0.100-10.0.0.199 inside
dhcpd enable inside
DHCP の割当て状態は show dhcpd binding
で確認出来ます。
ASAv# show dhcpd binding
IP address Client Identifier Lease expiration Type
10.0.0.103 0039.5348.4743.3547. 191 seconds Automatic
4145.4c5a
10.0.0.104 0063.6973.636f.2d66. 28664 seconds Automatic
6131.362e.3365.6363.
2e64.6535.342d.4769.
302f.31
RouterOS (MikroTik) での設定例
RouterOS での設定は以下の通りです。
/ip pool
add name=DHCP-10.0.0.0_24 ranges=10.0.0.100-10.0.0.199
/ip dhcp-server
add address-pool=DHCP-10.0.0.0_24 disabled=no interface=ether2 lease-time=8h name=DHCP-Server
/ip address
add address=10.0.0.203/24 interface=ether2 network=10.0.0.0
/ip dhcp-client
add dhcp-options=hostname,clientid disabled=no interface=ether1
/ip dhcp-server network
add address=10.0.0.0/24 gateway=10.0.0.203
DHCP の割当て状態は /ip dhcp-server lease print
で確認出来ます。 MikroTik の場合、Pool から降順でアドレスを割り当てるようです(少なくても今回の検証環境では、降順で割当てていました)。
[admin@MikroTik] > /ip dhcp-server lease print
Flags: X - disabled, R - radius, D - dynamic, B - blocked
# ADDRESS MAC-ADDRESS HOST-NAME SERVER RATE-LIMIT STATUS
0 D 10.0.0.199 FA:16:3E:CC:DE:54 Router DHCP-S... bound
vMX (Junos) での設定例
Junos での設定は以下の通りです。 root ユーザのパスワードは password1
としました。
set system root-authentication encrypted-password "$1$.XUnmGul$NIzsUzi.ytBlGuddwf.Ib0"
set system services dhcp-local-server group DhcpGroup interface em1.0
set interfaces em1 unit 0 family inet address 10.0.0.204/24
set access address-assignment pool DHCP-10_0_0_0_24 family inet network 10.0.0.0/24
set access address-assignment pool DHCP-10_0_0_0_24 family inet range PoolRange low 10.0.0.100
set access address-assignment pool DHCP-10_0_0_0_24 family inet range PoolRange high 10.0.0.199
set access address-assignment pool DHCP-10_0_0_0_24 family inet dhcp-attributes maximum-lease-time 28800
set access address-assignment pool DHCP-10_0_0_0_24 family inet dhcp-attributes name-server 8.8.8.8
set access address-assignment pool DHCP-10_0_0_0_24 family inet dhcp-attributes name-server 8.8.4.4
set access address-assignment pool DHCP-10_0_0_0_24 family inet dhcp-attributes router 10.0.0.204
commit and-quit
Pool は文字、数字、ダッシュ、アンダースコアしか使えないようで、例えば「ピリオド」は使えないようです。 ピリオドを使うと以下のようなエラーになりました。
error: name: 'DHCP-10.0.0.0_24': Must be a string beginning with a number or letter and consisting of no more than 63 total letters, numbers, dashes and underscores.
error: statement creation failed: pool
set system services dhcp-local-server
が設定されていない場合は以下のエラーになります。
root@vmx-01> show dhcp server binding
warning: dhcp-service subsystem not running - not needed by configuration.
FORTiOS (FortiGate) での設定例
FORTiOS での設定は以下の通りです。 リース時間は 300 〜 8,640,000 秒 (5 分 〜 100 日) の間で設定出来るようです。 GUI のインターフェイス設定からも DHCP サーバ設定は可能ですが、リース時間や 2 つ目の DNS サーバ設定等、細かい部分が設定出来ないようです。
config system interface
edit "port2"
set ip 10.0.0.205 255.255.255.0
set allowaccess ping
next
end
config system dhcp server
edit 1
set lease-time 28800
set default-gateway 10.0.0.205
set netmask 255.255.255.0
set interface "port2"
config ip-range
edit 1
set start-ip 10.0.0.100
set end-ip 10.0.0.199
next
end
set timezone-option default
set dns-server2 8.8.4.4
set dns-server1 8.8.8.8
next
end
DHCP の割当て状態は execute dhcp lease-list
で確認出来ます。
FortiGate-VM64-KVM # execute dhcp lease-list
port2
IP MAC-Address Hostname VCI Expiry
10.0.0.100 fa:16:3e:17:b4:e7 Router ciscopnp Sun Sep 10 05:54:07 2017
NX-OSv
Nexus 7000 FAQ に以下の記載があります。 Nexus 7000 は DHCP サーバ機能をサポートしないそうです。
Q. Can a Nexus 7000 be a DHCP server and can it relay DHCP requests to different DHCP servers per VLAN?
A. The Nexus 7000 does not support a DHCP server, but it does support DHCP relay. For relay, use the ip dhcp relay address x.x.x.x interface command.
See Cisco Nexus 7000 Series NX-OS Security Configuration Guide, Release 5.x for more information on Dynamic Host Configuration Protocol (DHCP) on a Cisco NX-OS device.
コメント