Skip to main content
Question

Have standard DNS everywhere

  • February 20, 2020
  • 7 replies
  • 18 views

Forum|alt.badge.img+3

Hey Guys,

I'm using Jamf Now plus. To create profile I use profile creator. I want to create a profile where all the laptops in my company have 9.9.9.9 as their standard DNS. So when I go to home and I connect to my home Wi-fi the DNS will be 9.9.9.9. I don't want to do it manually is it possible to fix this?

7 replies

Forum|alt.badge.img+26
  • Valued Contributor
  • February 20, 2020

Is this for purposes of a web filter? If so may inquire which one?


Forum|alt.badge.img+26
  • Valued Contributor
  • February 20, 2020

Here is how Securly does it for their web filter using an MDM pushed script:

https://support.securly.com/hc/en-us/articles/217657128-How-to-filter-Mac-OS-X-devices-off-site-?mobile_site=true


mojo21221
Forum|alt.badge.img+12
  • Valued Contributor
  • February 20, 2020

There would be a couple ways you could approach this task. You could create a policy utilizing Files and Processes --> then Execute Command below
networksetup -setdnsservers Wi-Fi 9.9.9.9

You could take it one step further and create an Extension Attribute to report what their DNS is

#!/bin/sh
echo "<result>`/usr/sbin/networksetup -getdnsservers Wi-Fi`</result>"

Next create some smart groups to report on said dns (is 9.9.9.9) (is not 9.9.9.9)

Then scope smart group to report on said Extension Attribute to execute the policy on their device again if it were to no longer be using 9.9.9.9

I wrote all of this from off the top of my head, so I would recommend testing it before going live. Hope this helps and welcome to jamf :)


mojo21221
Forum|alt.badge.img+12
  • Valued Contributor
  • February 20, 2020

@blackholemac I like your method a little better, adds more functionality..

#!/bin/bash
servers="9.9.9.9"
networksetup -listallnetworkservices | sed 1d $file | while read adapter
do
    networksetup -setdnsservers "$adapter" $servers
    networksetup -setv6off "$adapter"
done
dscacheutil -flushcache
exit 0

Forum|alt.badge.img+3
  • Author
  • New Contributor
  • February 25, 2020

@mojo21221 Where do you add the script in Jamf NOW plus. Sorry for the question I'm not that good with JAMF. Should I add in into a package and thanks for the warm welcome :)


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • February 25, 2020

@blackholemac we are currently using quad 9 (https://www.quad9.net/)


Forum|alt.badge.img+2
  • New Contributor
  • September 9, 2020

Is it possible to use this kind of script on iOS? I need to get global DNS to work and i have absolutely no experience with jamf/iOS at all