DHCPサーバ構築

<<Linjuxシステム設定 トップページに戻る

   DHCPサーバはパソコンに自動でIPアドレスを割り振ってくれる便利なサービスです。
   ここではDHCPサーバの設定方法を紹介しています。



  • DHCPサーバの設定ファイルを作成する

    なぜかデフォルトで /etc/dhcpd.conf ファイルが存在しないので、以下をコピーして作成します。

       # vi /etc/dhcpd.conf

    ddns-update-style interim;
    ignore client-updates;
    not authoritative;

    subnet 192.168.11.0 netmask 255.255.255.0 {   
    #ご自分の環境に設定する

    # --- default gateway
    option routers 192.168.11.1;   
    #デフォルトゲートウェイ指定
    option subnet-mask 255.255.255.0;   
    #ネットマスク指定

    #option nis-domain "domain.org";
    option domain-name "mizugame.info";
    option domain-name-servers 192.168.11.1;   
    #ネームサーバ指定

    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.11.30 192.168.11.70;   
    #DHCPの有効範囲指定
    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;
    #}
    }

    以上をコピーして /etc/dhcpd.conf ファイルに貼り付けて、ご自分の環境にあったアドレスに編集してください。
    range dynamic-bootp 192.168.11.30 192.168.70 のところはDHCPで割り振るIPアドレスの範囲です。

  • DHCPサービスを起動する

       # service dhcpd start

  • パソコン起動時に DHCPサーバが起動するようにする

       # chkconfig dhcpd on