Checking DHCP on Macs

We’re working on moving from static IP addressing to DHCP to support NetBooting OS X clients. To determine when clients are ready to NetBoot, we’ve created a task and analysis to report when a system has a DHCP address.

Use the following task and analysis with python3 (required) to report on client DHCP status:
Mac DHCP Checks (Task): https://bigfix.me/cdb/fixlet/20818
Mac Network Services (DHCP) Checks (Analysis): https://bigfix.me/cdb/analysis/2998169

We’d also like to create a similar tool for listing available NetBoot services, but requires modifying the python script to send a different type of broadcast packet. Please let me know if you’d like to help!

Thanks,
Rusty

1 Like

Can you provide a link to the script on github?

DHCP info can be found in files in this directory: /private/var/db/dhcpclient/leases

Q: dates "LeaseStartDate" of dictionaries of files of folders "/private/var/db/dhcpclient/leases"
A: Sun, 19 Jun 2016 16:16:10 -0700
A: Sat, 11 Jul 2015 08:43:44 -0700

This should give the same info but for only non-wifi devices: (I assume you are primarily interested in Ethernet)

dates "LeaseStartDate" of dictionaries whose(not exists string "SSID" of it) of files of folders "/private/var/db/dhcpclient/leases"

Reference: http://apple.stackexchange.com/questions/56745/client-side-dhcp-log

James,
Thanks for the additional relevance. Here’s a link to the script:

1 Like

Oh it is a Gist. No wonder I couldn’t find it when I went looking for it.

I do like the idea of Gists. Why make things so complicated for a single script?

Well then I started using them, and you can’t do pull requests on Gists, which makes them rather annoying to collaborate with. I really think Gists should only be used for minor code snippets or perhaps something that is never expected to change much, otherwise they become a problem.

I don’t think there is a good solution for this problem. One option is to make a new GitHub public repo for every single item unless it really fits in with an existing one, and even then that isn’t a clearly good option.

Another option, which I have been doing lately is I made a “tools” repo that contains many simple scripts. This is effectively my new Gist location, but because it is a proper GitHub repo, it supports all the features for collaboration. I don’t think this is a perfect solution either. See here: https://github.com/jgstew/tools

My goal is to create a repo for these tools at some point, specifically publicly. I’m hoping to add an additional call to determine available netboot servers. Ideally, these tools will be combined into a repo for our network tools.

Gists are ok for sharing a quick snippet or small script, but I’d rather have a repo for the reasons you’ve listed.

1 Like

Here is one that will just return the DHCP/Manual flag for all network connections. JG helped out a while ago and I never posted it back. This is one uses pure relevance.

https://bigfix.me/relevance/details/3016735

Nice! That’ll certainly be helpful. Thanks