ISC DHCPD on commit

user-pic
Vote 0 Votes

ISC DHCP on commit 可以做到在 Client 取得 IP 後執行特定 script/program

在 /etc/dhcpd.conf 加入(加在 subnet 或 global 均可)
on commit {
   set ClientIP = binary-to-ascii(10, 8, ".", leased-address);
   set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6));
   execute("/usr/local/bin/dhcpd_on_commit", ClientIP, ClientMac);
}

ClientIP, ClientMac 就會以參數 $1, $2 帶給 script/program

若 Log 中看到 execute: no such function. 表示不支援, 這個功能似乎是 4.x 才有的, 預設 enable
./configure
--enable-execute enable support for execute() in config (default is yes)

Leave a comment

About this Entry

This page contains a single entry by Pank published on March 26, 2012 3:10 PM.

Build Apache 2.4.x was the previous entry in this blog.

EZLINK BLACK HAWK SLC 16G USB 3.0 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives