ねもぷらす

ふぁいんでぃんぐねもの日記。プログラミングとか育児とか

DHCPサーバが起動できない

なにか間違ってる?iptables コマンドが無かったので、Mac のポート解放方法もまだわかってない。

MacPotrs で DHCPサーバをインストール

$ port search dhcp
dhcp                           net/dhcp       3.1.1        ISC dhcpd server
dhcping                        net/dhcping    1.2          Send DHCP request to DHCP server for monitoring purposes

$ sudo port install dhcp +darwin_8
...
-The dhcpd .conf and .leases files must be named and located as shown for dhcpd to find them:
	/opt/local/etc/dhcp/dhcpd.conf (there is a sample file)
	/opt/local/var/db/dhcpd/dhcpd.leases (use the touch command to create a blank one)
--->  Cleaning dhcp


設定ファイルを編集。PXE Boot をさせるつもりだったので filename を指定。

  • /opt/local/etc/dhcp/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
        option routers                  192.168.1.1;
        option subnet-mask              255.255.255.0;
        option domain-name-servers      192.168.1.1;
        option domain-name              "macbook";
        option time-offset              -18000; # Eastern Standard Time
        range dynamic-bootp 192.168.1.2 192.168.1.3;
        default-lease-time 21600;
        max-lease-time 43200;
        filename "pxelinux.0";
}


有線LAN に接続する PC を DHCP の対象にするため、
システム環境設定 > ネットワーク から内蔵Ethernetを選択して、
IPアドレスを「192.168.1.10」
サブネットマスクを「255.255.255.0」
に設定。設定内容をコマンドラインから確認しておく。

$ ifconfig en0 | grep inet
	inet 192.168.2.1 netmask 0xffffff00 broadcast 192.168.2.255

あれ、なんかアドレスが違う…LANケーブル繋がないとダメ??


とりあえずDHCPサービスを起動させてみる…

$ sudo dhcpd en0
Password:
Internet Systems Consortium DHCP Server V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 leases to leases file.

No subnet declaration for en0 (192.168.2.1).
** Ignoring requests on en0.  If this is not what
   you want, please write a subnet declaration
   in your dhcpd.conf file for the network segment
   to which interface en0 is attached. **


Not configured to listen on any interfaces!

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.

怒られた…
すでに割り振られたアドレスが変更できない。
マシンを再起動してリトライするか…

再起動したけど

LANケーブルさしてない NIC に意図しないIPアドレスが設定されている。
えー…
仕方ないから dhcpd.conf を 192.168.1 -> 192.168.2 にしてみる。

$ cd /opt/local/etc/dhcp
$ sudo sed -i -e "s/192\.168\.1\./192.168.2./g" dhcpd.conf


さぁ、今度こそ

$ sudo dhcpd en0
Internet Systems Consortium DHCP Server V3.1.1
Copyright 2004-2008 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Wrote 0 leases to leases file.
Listening on BPF/en0/00:**************/192.168.2/24
Sending on   BPF/en0/00:**************/192.168.2/24
Can't bind to dhcp address: Address already in use
Please make sure there is no other dhcp server
running and that there's no entry for dhcp or
bootp in /etc/inetd.conf.   Also make sure you
are not running HP JetAdmin software, which
includes a bootp server.

If you did not get this software from ftp.isc.org, please
get the latest from ftp.isc.org and install that before
requesting help.

If you did get this software from ftp.isc.org and have not
yet read the README, please read it before requesting help.
If you intend to request help from the dhcp-server@isc.org
mailing list, please read the section on the README about
submitting bug reports and requests for help.

Please do not under any circumstances send requests for
help directly to the authors of this software - please
send them to the appropriate mailing list as described in
the README file.

exiting.

HP JetAdminが動いてるからダメなの?コレが勝手にIP割り振ってるのかな…