Posted on 04-29-2016 10:04 AM
Hello Jamf Community,
I am looking for a script, to change the DNS "Search Domain" to .local on Wi-Fi and Thunderbolt Ethernet.
I try a few comands but no one works...
Hope everyone can help me.
Many Thanks
Christian
Solved! Go to Solution.
Posted on 04-29-2016 10:50 AM
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local
And networksetup -listallnetworkservices can give you a list of network interfaces to tackle. Just put it into an array and loop through them.
Posted on 04-30-2016 04:30 AM
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local And networksetup -listallnetworkservices can give you a list of network interfaces to tackle. Just put it into an array and loop through them.
Hello thoule,
many Thanks for your help! This script works great! With this script, the login is in the AD is 80% faster.
I enter the following script in Casper Suite:
#!/bin/bash
/usr/sbin/networksetup -setsearchdomains "Thunderbolt Ethernet" .local
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local
Many Thanks,
Christian
Posted on 04-29-2016 10:50 AM
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local
And networksetup -listallnetworkservices can give you a list of network interfaces to tackle. Just put it into an array and loop through them.
Posted on 04-30-2016 04:30 AM
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local And networksetup -listallnetworkservices can give you a list of network interfaces to tackle. Just put it into an array and loop through them.
Hello thoule,
many Thanks for your help! This script works great! With this script, the login is in the AD is 80% faster.
I enter the following script in Casper Suite:
#!/bin/bash
/usr/sbin/networksetup -setsearchdomains "Thunderbolt Ethernet" .local
/usr/sbin/networksetup -setsearchdomains "Wi-Fi" .local
Many Thanks,
Christian
Posted on 05-02-2016 04:34 AM
Here's something I wrote a few years ago.
Set DNS Info
This has the benefit of you only specify "Ethernet" and it will do all forms of Ethernet service. e.g. Ethernet 1 and Ethernet 2 on Mac Pros. Thunderbolt Ethernet on tb displays. USB ethernet for laptops etc etc.
Posted on 07-14-2017 04:52 PM
Anyone else still using this Set DNS Info script that franton wrote? The new macbooks (dongles) are not being picked up. It look like these adapters are identified as LAN rather than Ethernet. Any Ideas on how to update the Set DNS Info script to pick up these new Lan interfaces?
Posted on 02-02-2018 03:54 PM
I'm having issues adding the new USB-C adapters. They show up in the hardware ports as USB 10/100/1000 LAN, my script doesn't seem to recognize them and skips over. It adds WI-FI and Thunderbolt just fine. Any ideas?
Posted on 02-03-2018 06:09 AM
I can alter the scripts to cope. I need @burdett and @ChadL3 to provide screen grabs of Network pane showing the exact name of the adaptors.
Posted on 02-04-2018 08:00 AM
Here's a list of common adapter ID's we've seen.
USB 10/100/1000 LAN
(covers a few Startech, Kanex, and HP adapters)
Belkin USB-C LAN
(covers the White Belkin adapter sold by Apple)
USB Gigabit Ethernet
USB Ethernet
Apple USB Ethernet Adapter
Thunderbolt Ethernet
Display Ethernet
I include these in a Self Service script that helps add network ports for times when the user does not have admin rights.
Posted on 02-04-2018 10:20 AM
Ok so what you would do with my script is two policies. One that you call the script with "Ethernet" and another to call with "LAN". The script is looking for key names to process, so that's the easiest way forward.
Posted on 02-05-2018 10:17 AM
Here is my script.. That doesn't work!
else if [ ${dev} == "USB 10/100/1000 LAN" ]; then echo "USB 10/100/1000 LAN has been configured with Domain suffixes" networksetup -setsearchdomains "USB 10/100/1000" mydomains.com
USB-10/100/1000-LAN has been configured with Domain suffixes
USB-10/100/1000-LAN is not a recognized network service.
** Error: The parameters were not valid.
Wi-Fi has been configured with Domain suffixes
Posted on 02-12-2018 01:39 PM
@franton I tried your new script but I'm getting the following errors;
line 66: syntax error near unexpected token `<'
line 66: `done < <( networksetup -listallnetworkservices | grep -E "$searchNetwork" )'
For testing I'm not running these form JAMF so I modified the following;
searchNetwork="Ethernet"
searchDomain1="my.1search.domain.edu"
searchDomain2="my.2search.domain.edu"
PrimaryDNS="xxx.xxx.xxx.xxx"
SecondaryDNS="xxx.xxx.xxx.xxx"
Posted on 02-12-2018 01:44 PM
@burdett The script on my Github is working for me. I'm not sure what you are doing wrong. Please make sure your Jamf policy is calling it with the correct info and the script has been properly copied into your Jamf system.
Posted on 02-13-2018 05:42 AM
-deleted this post-
Posted on 02-13-2018 06:10 AM
@franton I am also seeing an error with line 66.
syntax error near unexpected token `<'
line 67: `done < <( networksetup -listallnetworkservices | grep -E "$searchNetwork" )'
done < <( networksetup -listallnetworkservices | grep -E "$searchNetwork" )
Like @burdett, I am setting the variables within the script and not using Jamf when testing out the script.
Posted on 02-13-2018 06:19 AM
I'll be honest, that only occurs for me if the $searchNetwork variable is blank.
This works for me.
Posted on 02-13-2018 09:49 AM
@jhalvorson, I did some digging around and I found Erik Berglund's script, "modifyNetworkServiceOrder" on github at;
https://github.com/erikberglund/Scripts/blob/master/random/modifyNetworkServiceOrder/modifyNetworkSe...
I noticed Erick's script started with #!/usr/bin/env bash rather then #!/bin/sh used in @franton script. It's not clear to me the difference but this resolved the error I was having with franton's script.