|
|
|
|
|
by selvakn
3260 days ago
|
|
If it is for executing some script on successful connection of any device to wifi (and thus an IP is assigned), with dhcpd, it can be achieved with the following config: subnet 192.168.1.0 netmask 255.255.255.0 {
on commit {
set ip = binary-to-ascii (10, 8, ".", leased-address);
execute ("/usr/local/bin/on-device-connect", "commit", ip);
}
}
I have setup exactly this to automate stuff unlocking the door in my office (in the morning, whenever some one arrives and phone connects to wifi).My original source: http://jpmens.net/2011/07/06/execute-a-script-when-isc-dhcp-... Edit: Fix code formatting. |
|
More seriously, part of the reason I did the project was to see if I could have things react to the dhcp server, and not have the dhcpserver run things for me. No good reason, other than wanting all the components in my home network to run in their own VMs, and so having everything talking via etcd is convenient.
That said, if I didn't have copious amounts of free time, I definitely should have done that.