Created
April 20, 2011 17:11
-
-
Save tomoconnor/931988 to your computer and use it in GitHub Desktop.
snippet to show usage of dhcp-event (don't forget to set apparmor to allowing (complain) mode)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subnet 192.168.0.0 netmask 255.255.255.0 { | |
range 192.168.0.100 192.168.0.200; | |
option broadcast-address 192.168.0.255; | |
option routers 192.168.0.1; | |
on commit { | |
set ClientIP = binary-to-ascii(10, 8, ".", leased-address); | |
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); | |
log(concat("Commit: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name)); | |
execute("/usr/local/bin/dhcp-event", "commit", ClientIP, ClientMac, host-decl-name); | |
} | |
on release { | |
set ClientIP = binary-to-ascii(10, 8, ".", leased-address); | |
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); | |
log(concat("Release: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name)); | |
execute("/usr/local/bin/dhcp-event", "release", ClientIP, ClientMac, host-decl-name); | |
} | |
on expiry { | |
set ClientIP = binary-to-ascii(10, 8, ".", leased-address); | |
set ClientMac = binary-to-ascii(16, 8, ":", substring(hardware, 1, 6)); | |
log(concat("Expiry: IP: ", ClientIP, " Mac: ", ClientMac, "Hostname: ", host-decl-name)); | |
execute("/usr/local/bin/dhcp-event", "expiry", ClientIP, ClientMac, host-decl-name); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment