Hi Folks,
i investigated the DHCP PNP process and had the idea of using arpwatch for pnp detection. It produces log entries like this:
Oct 11 13:38:18 dcerouter arpwatch: new station 10.1.1.17 de:ad:be:ef:0:4 eth0
derive from Dhcpd-Plugin-Parser.sh:
dcerouter_37298:~# diff -u /usr/pluto/bin/Dhcpd-Plugin-Parser.sh /usr/pluto/bin/Arpwatch-Plugin-Parser.sh
--- /usr/pluto/bin/Dhcpd-Plugin-Parser.sh 2007-03-01 04:15:34.000000000 +0100
+++ /usr/pluto/bin/Arpwatch-Plugin-Parser.sh 2007-10-11 13:40:04.000000000 +0200
@@ -23,7 +23,7 @@
log) Type="00" ;;
esac
- printf "%s\n" "$Type $(date -R) $Data" >>/var/log/pluto/dhcp_pnp.log
+ printf "%s\n" "$Type $(date -R) $Data" >>/var/log/pluto/arpwatch_pnp.log
}
parse()
@@ -57,16 +57,16 @@
line=$(parse "$inline")
tag=$(extract_field 5 "$line")
op=$(extract_field 6 "$line")
- mac_found=$(extract_field 10 "$line")
+ mac_found=$(extract_field 9 "$line")
ip_sent=$(extract_field 8 "$line")
- if [[ "$tag" != "dhcpd:" || -z "$mac_found" ]]; then
+ if [[ "$tag" != "arpwatch:" || -z "$mac_found" ]]; then
continue
fi
case "$op" in
- "DHCPACK")
- log_plugin log "DHCP : MAC '$mac_found' IP '$ip_sent'"
+ "new")
+ log_plugin log "ARPWATCH : MAC '$mac_found' IP '$ip_sent'"
Q="SELECT PK_Device FROM Device WHERE MACaddress='$mac_found' AND IPaddress='$ip_sent'"
R=$(RunSQL "$Q")
seems to work:
+ read mac ip garbage
+ RetrySend de:ad:be:ef:0:4 10.1.1.17
+ local MAC=de:ad:be:ef:0:4 IP=10.1.1.17
+ /usr/pluto/bin/MessageSend localhost 1 -1001 2 65 52 3 53 2 5 de:ad:be:ef:0:4 28 10.1.1.17
Caveats: boot options for media directors and stuff have to be specified in the standalone DHCP server.
I think this would be a nice fallback for PNP when the internal dhcp server is deactivated. What do you think about it?
regards,
Hari