DHCP

提供: Wikinote
移動: 案内検索

サーバ

各種設定

{allow|deny} unknown-clients;
素性のわからないクライアントに動的にアドレスを割り当てるかどうか。デフォルトは allow。
{allow|deny} bootp;
bootp クエリに答えるかどうか。デフォルトは allow。
{allow|deny} booting;
特定のクライアントからのクエリに答えるかどうか。host 宣言の内部で使用する。デフォルトは allow。
default-lease-time time;
クライアントが特に期限を求められなかった場合の貸出時間。
max-lease-time time;
クライアントが期限を求めた場合の最大貸出時間。
hardware ethernet xx:xx:xx:xx:xx:xx;
クライアントを認識するためのハードウェアアドレス。host 宣言の内部で使用する。
filename "filename";
クライアントにロードさせる初期ブートファイルを指定する。
server-name "name";
クライアントに接続中のサーバ名を伝える。
next-server server-name;
初期ブートファイルをロードするサーバのアドレスを指定する。
fixed-address address;
特定のクライアントに IP アドレスを割り当てる。host 宣言の内部で使用する。
{authoritative|not authoritative};
そのスコープに権威を持たせるかどうか。

サンプル

設定ファイルは、/etc/dhcpd.conf である。 man dhcpd.conf でかなり詳しいマニュアルが読める。 が、相変わらず man ページはわかりにくい…。

とりあえず動く設定は以下。

#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample  
#
ddns-update-style interim; ★このあたりはよくわからないので、そのうち調査する。
ignore client-updates;
not authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
   option routers          192.168.1.1;
   option subnet-mask      255.255.255.0;

#  option nis-domain       "domain.org";
   option domain-name      "hagio.org";
   option domain-name-servers  eagle.asahi-net.or.jp,falcon.asahi-net.or.jp;

#  option time-offset      -18000; # Eastern Standard Time
#  option ntp-servers      192.168.1.1;
#  option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#  option netbios-node-type 2;

   range dynamic-bootp 192.168.1.11 192.168.1.20; ★リースする範囲を指定
   default-lease-time 21600;
   max-lease-time 43200;

   # we want the nameserver to appear at a fixed address
   #host ns {
   #   next-server marvin.redhat.com;
   #   hardware ethernet 12:34:56:78:AB:CD;
   #   fixed-address 207.175.42.254;
   #}
   host hostname { ★MAC アドレスで IP アドレスを固定する場合
       hardware ethernet xx:xx:xx:xx:xx:xx;
       fixed-address 192.168.1.10;
   }
}

クライアント

設定

/etc/sysconfig/network-scripts/ifcfg-*

BOOTPROTO=dhcp
ネットワーク起動時に DHCP クライアントを起動する。
DHCP_HOSTNAME=hostname
DHCP サーバがホスト名を必要とした場合に用いられる。
PEER_DNS=yes|no
DHCP サーバからの情報で /etc/resolv.conf を自動更新するかどうか。

その他のパラメータは Linux/ネットワーク を参照されたい。