DHCP Cent-OS 5.3

2009/6/11


install

yum -y install dhcp

ポリシー

  1. MACアドレスとIPアドレスは1対1に対応する。
  2. MACアドレスを登録していないマシンは実験室内に限定して接続を認める。実験室外に接続することは認めない。

設定

DHCPサーバの設定は/etc/dhcpd.confに記述する。
MACアドレスとIPアドレスを対応させるため、すべてのマシンについて設定を記述している。設定ファイルが長くなるので、マシンの用途ごとに設定ファイルを分割し/etc/dhcpd.confでインクルードしている。
  1. /etc/dhcpd.conf
  2. /etc/dhcp/dhcp.xxxx

/etc/dhcpd.conf
ddns-update-style interim;
 ignore client-updates;
 
 subnet 192.168.70.0 netmask 255.255.255.0 {
 
 # --- default gateway
 option routers 192.168.70.2;
 option subnet-mask 255.255.255.0;
 
 option domain-name "takahashi.lab";
 option domain-name-servers 192.168.70.2;
 
 option time-offset 32400; # Japan Standard Time
 option ntp-servers 192.168.70.2;

 # 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.70.57 192.168.70.71;
 #range 192.168.70.57 192.168.70.71;

# 2008/5/13 : WLA-L11 Air Station
  #  192.168.70.4-5 : WLA-L11 Air Station
  #  192.168.70.6   :  Linkstation
# 2008/6/9 : Virtual Machines
  #  192.168.70.120-189 : vmware
  #  192.168.70.190-199 : unknown
  #  192.168.70.200-209 : debian on vmware
  #  192.168.70.210-219 : debian on Xen(SMM)(domain-0 = 192.168.70.230-239)
  #  192.168.70.220-229 : debian real machine(SMM)
  #  192.168.70.230-239 : temporary use
  
 default-lease-time 21600; # 21600 sec = 6h 00m 00sec
 max-lease-time 43200; # 43200sec = 12h 00m 00sec
 
 # 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;
 # }

  include "/etc/dhcp/dhcp.server";
  include "/etc/dhcp/dhcp.nt";
  include "/etc/dhcp/dhcp.pc";
  include "/etc/dhcp/dhcp.vmware";
  include "/etc/dhcp/dhcp.h8";

  include "/etc/dhcp/dhcp.smm";
  include "/etc/dhcp/dhcp.tmp";
 }
ノートパソコンに関する記述(/etc/dhcp/dhcp.pc)
#------------------------------------------
#    note PC, desktop PC

  host Cs {
        # NOTE 01 PC-koubou LESANCE CL401SN-M/340+256+40G
          hardware ethernet 00:90:f5:34:0f:39;
          fixed-address 192.168.xx.55;
          option routers 192.168.xx.1;
	}
#以下省略

動作確認

DHCPに関する設定を変更した後は、dhcpdを再起動する。
service dhcpd restart;service named status
chconfig dhcpd on