Skip to main content

Hello,



I am trying to use a script to change my DNS settings for the Thunderbolt Ethernet. I am using this script



#!/bin/sh
networksetup -setdnsservers Thunderbolt Ethernet DNS.Address.here


When I run it though I am getting an error saying that Thunderbolt is not a recognized network service. I used the same script for Wi-Fi and it worked without any issues. Is there other wording I need to use instead of Thunderbolt?



Thanks

Try this:



#!/bin/sh
networksetup -setdnsservers "Thunderbolt Ethernet" DNS.Address.here


Adding the quotes should make it realize your using that device.


I have a script I wrote for setting DNS search domains on Ethernet interfaces, which loops through all available Ethernet interfaces and writes the DNS search domain settings to each one. It's available via the link below:



https://github.com/rtrouton/rtrouton_scripts/tree/master/rtrouton_scripts/set_dns_search_domains_on_ethernet_interfaces


Try this:



!/bin/sh



networksetup -setdnsservers "Thunderbolt Ethernet" DNS.Address.here