dhcp服務器安裝和自定義option配置

1.編譯安裝

tar dhcp-4.4.1.tar.gz

cd dhcp-4.4.1

./configure --prefix=/usr/local --localstatedir=/usr/local/var/ --with-srv-lease-file=/usr/local/var/db/dhcpd.leases --with-srv-pid-file=/usr/local/var/run/dhcpd.pid

make

make install

2.新建需要的文件

mkdir -p   /usr/local/var/db

touch /usr/local/var/db/dhcpd.leases

mkdir -p   /usr/local/var/run

touch /usr/local/var/run/dhcpd.pid

3.創建dhcpd文件

touch /etc/dhcpd.conf

4.配置dhcpd.cnf
將以下內容拷貝進去:

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

option vendor code 43 = string;
option tftp      code 66 = string;
shared-network share
{
 option subnet-mask  255.255.255.0;
 option domain-name   "china.com";
 option domain-name-servers 8.8.8.8,114.114.114.114;
 option broadcast-address 173.31.2.255;
 default-lease-time 86400;
 max-lease-time 172800;
#configure subnet 1
 subnet 173.31.2.0  netmask  255.255.255.0
 {
     range 173.31.2.152  173.31.2.154;
     option routers 173.31.2.254;
     option vendor  "http://test.com/1.txt";
     option tftp  "http://test.com/2.txt";
 }
}

5.啓動dhcpd

dhcpd

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章