DHCP Server安裝:FreeBSD 9.1-release

 

參考網頁:

1. http://www.twbsd.org/cht/book/ch18.htm

2. http://blog.weithenn.org/2009/05/freebsddhcp-ip-lan-user.html

 

安裝程序:

root@test:/usr/local/etc/mpd5 # cd /usr/ports/net/isc-dhcp42-server/
root@test:/usr/ports/net/isc-dhcp42-server # make install clean
使用default選項。

https://www.isc.org/products/DHCP/
===>  Cleaning for isc-dhcp42-server-4.2.5

 

設定:

root@test:/usr/ports/net/isc-dhcp42-server # vi /usr/local/etc/dhcpd.conf
option domain-name "test.com";
option domain-name-servers test.test.com;

# --- Additional Setting --- #
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.0.255;
option time-offset 28800;
default-lease-time 86400;
max-lease-time 86400;
ddns-update-style none;
# --- End of Setting --- #

subnet 192.168.0.0 netmask 255.255.255.0 {
}

# This is a very basic subnet declaration.

subnet 192.168.0.0 netmask 255.255.255.0 {
  range 192.168.0.190 192.168.0.195;          //dhcp要給的ip範圍。
  option routers 192.168.0.254;
}

dhcpd.conf: new file: 23 lines, 587 characters.

如果沒加rc.conf,啟動指令:

# /usr/local/etc/rc.d/isc-dhcpd onestart
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.2.5-P1
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.
.........................

更改/etc/rc.conf:
root@test:/usr/local/etc # vi /etc/rc.conf
# -- DHCP Settings --#
dhcpd_enable="YES"
dhcpd_ifaces="fxp0"      //對內的那張網卡

啟動:

root@test:/usr/local/etc # /usr/local/etc/rc.d/isc-dhcpd start
Starting dhcpd.
Internet Systems Consortium DHCP Server 4.2.5-P1
Copyright 2004-2013 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Warning: subnet 192.168.0.0/24 overlaps subnet 192.168.0.0/24
Wrote 0 leases to leases file.
Multiple interfaces match the same subnet: fxp0 fxp1
Multiple interfaces match the same shared network: fxp0 fxp1
Listening on BPF/fxp0/00:d0:b7:5a:73:b9/192.9.100.0/24
Sending on   BPF/fxp0/00:d0:b7:5a:73:b9/192.9.100.0/24
Sending on   Socket/fallback/fallback-net
 

查看用戶租用狀況:

# less /var/db/dhcpd/dhcpd.leases

空著的時候:
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5-P1

server-duid "\000\001\000\001\031@B\012\000\033!\200\206/";

/var/db/dhcpd/dhcpd.leases (END)

 

如果有租IP的時候:可以從下面的資料看到哪一個號碼是誰在用從幾點到幾點,還可以看到mac和hostname。

# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5-P1

server-duid "\000\001\000\001\031@B\012\000\033!\200\206/";

lease 192.168.0.190 {
  starts 2 2013/06/04 06:31:34;
  ends 3 2013/06/05 06:31:34;
  cltt 2 2013/06/04 06:31:34;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 54:04:a6:7f:13:93;
  uid "\001T\004\246\177\023\223";
  client-hostname "aaa";
}
lease 192.168.0.190 {
  starts 2 2013/06/04 07:00:56;
  ends 3 2013/06/05 07:00:56;
  cltt 2 2013/06/04 07:00:56;
  binding state active;
  next binding state free;
  rewind binding state free;
  hardware ethernet 54:04:a6:7f:13:93;
  uid "\001T\004\246\177\023\223";
  client-hostname "aaa";
}
(END)

按q 退出。

全部完成。

,

貓熊麗麗 發表在 痞客邦 PIXNET 留言(0) 人氣()