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
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
/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.
/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
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.
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?
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?
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.
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.
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.
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
@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"
@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.
-deleted this post-
@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.
I'll be honest, that only occurs for me if the $searchNetwork variable is blank.
This works for me.
@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/modifyNetworkServiceOrder
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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.