[FREEBSD10] 安裝 dhcp 伺服器

URL Link //n.sfs.tw/11614

2017-08-13 00:59:48 By 張○○

安裝

# cd /usr/ports/net/dhcpd
# make install clean

設定 dhcpd.conf

$ vi /usr/local/etc/dhcpd.conf

# 全域設定

option domain-name "example.com";
option domain-name-servers 168.95.1.1;

option subnet-mask 255.255.255.0;

# 租期 12 小時

default-lease-time 43200;

# 最大租期 30天
max-lease-time 1300000;


# 派送網段設定
subnet 10.200.0.0 netmask 255.255.0.0 {
  range 10.200.100.1 10.200.100.254;
  option domain-name-servers 10.200.0.254;
  option domain-name "example.com";
  option routers 10.200.0.254;
  option broadcast-address 10.200.255.255;
#  default-lease-time 600;
#  max-lease-time 7200;

}

設定 /etc/rc.conf

# DHCPD
dhcpd_enable="YES"                          # dhcpd enabled?

#dhcpd_flags="-cf"                          # command option(s),若需要額外參數的話,此例不需要
dhcpd_conf="/usr/local/etc/dhcpd.conf"      # configuration file
dhcpd_ifaces="bge0"                         # 派送 DHCP的介面
dhcpd_withumask="022"                       # file creation mask

操作指令

啟動

# dhcpd -c /usr/local/etc/dhcpd.conf bge0

查看派送情形

# cat /var/db/dhcpd/dhcpd.lease

延伸閱讀

[Freebsd] 查看dhcp客戶端

 


原文 2010-01-21 15:56:21