LoginSignup
16
20

More than 5 years have passed since last update.

dhcpd.conf 覚書

Last updated at Posted at 2016-03-09

/etc/dhcp/dhcpd.conf の日本語訳。

dhcpd.conf

ISC dhcpd 用のサンプル設定ファイル

注意: /etc/ltsp/dhcpd.conf が存在する場合は、 /etc/dhcp/dhcpd.conf の代わりに /etc/ltsp/dhcpd.conf が設定ファイルとして使用されます。

全ネットワーク共通のオプションを定義します。

option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;

default-lease-time 600;
max-lease-time 7200;

ddns-updates-style パラメータは、リース確認時に
サーバが DNS 更新を試行するかどうかを制御します。
既定の動作はバージョン 2 パッケージの動作です。

# 'none' - DHCP v2 からは DDNS をサポートしていません。
ddns-update-style none;

当該 DHCP サーバーがローカルネットワークの公式 DHCP サーバーである場合
authoritative ディレクティブのコメントを解除してください。

authoritative;

DHCP ログメッセージを別のログファイルに送信します。
(リダイレクトを完了するために syslog.conf を調整する必要があります。)

log-facility local7;

下記のサブネットではサービスは提供されません。
しかし下記の宣言は、 DHCP サーバーが
ネットワークトポロジを理解するために役立てられます。

subnet 10.152.187.0 netmask 255.255.255.0 {
}

下記は基本的なサブネット宣言です。

subnet 10.254.239.0 netmask 255.255.255.224 {
  range 10.254.239.10 10.254.239.20;
  option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
}

下記の宣言により、 BOOTP クライアントは動的アドレスを取得できます。
しかし推奨しません。

subnet 10.254.239.32 netmask 255.255.255.224 {
  range dynamic-bootp 10.254.239.40 10.254.239.60;
  option broadcast-address 10.254.239.31;
  option routers rtr-239-32-1.example.org;
}

内部サブネットの設定が少し異なるネットワークです。

subnet 10.5.5.0 netmask 255.255.255.224 {
  range 10.5.5.26 10.5.5.30;
  option domain-name-servers ns1.internal.example.org;
  option domain-name "internal.example.org";
  option subnet-mask 255.255.255.224;
  option routers 10.5.5.1;
  option broadcast-address 10.5.5.31;
  default-lease-time 600;
  max-lease-time 7200;
}

特別な設定オプションを必要とするホストは、
host ステートメントに列記することができます。
アドレスが指定されていない場合、(可能な場合に限り)アドレスは動的に割り当てられます。
しかしホスト固有の情報は依然として host 宣言から取得されます。

host passacaglia {
  hardware ethernet 0:0:c0:5d:bd:95;
  filename "vmunix.passacaglia";
  server-name "toccata.example.com";
}

ホストに固定 IP アドレスを指定することもできます。
固定 IP アドレスは動的なアドレス割当てが可能なアドレスの範囲に含めないでください。

固定 IP アドレスが指定されているホストは、
BOOTP または DHCP を使用して起動することができます。
固定アドレスが指定されていないホストは、 DHCP でのみ起動することができます。
ただし、サブネット上に dynamic-bootp フラグを設定した
BOOTP クライアントが接続されている場合を除きます。

host fantasia {
  hardware ethernet 08:00:07:26:c0:a5;
  fixed-address fantasia.example.com;
}

クライアントのクラス宣言に基づいてアドレスの割り当てを実行することができます。
下記の例では、特定のクラスに属するすべてのクライアントが 10.17.224/24 サブネット上のアドレスを取得し、
クラスに属さないクライアントは 10.0.29/24 サブネット上のアドレスを取得します。

class "foo" {
  match if substring (option vendor-class-identifier, 0, 4) = "SUNW";
}

shared-network 224-29 {
  subnet 10.17.224.0 netmask 255.255.255.0 {
    option routers rtr-224.example.org;
  }
  subnet 10.0.29.0 netmask 255.255.255.0 {
    option routers rtr-29.example.org;
  }
  pool {
    allow members of "foo";
    range 10.17.224.10 10.17.224.250;
  }
  pool {
    deny members of "foo";
    range 10.0.29.10 10.0.29.230;
  }
}
16
20
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
20