Category filter
Script to configure DNS settings for Wi-Fi on macOS
The Domain Name System (DNS) is the backbone of the internet, converting domain names into IP addresses that enable seamless communication between devices. It allows computers and servers to find and interact with each other over the internet.
Settings for the DNS server need to be changed on the device for various reasons. For instance, changing DNS settings can help load websites quicker, offer protection against malicious websites and phishing attempts, overcome region-based content restrictions, or prioritize user privacy by not logging DNS queries. Admins can execute the scripts below to set up a DNS server using Hexnode UEM’s Execute Custom Script action for Macs.
Scripting language- Bash
File extension-.sh
To configure a new DNS server
The following script can be deployed to configure the DNS server settings for Wi-Fi.
1 2 3 |
sudo networksetup -setdnsservers "Wi-Fi" 8.8.8.8 output=$(networksetup -getdnsservers "Wi-Fi") echo "Current DNS Servers: $output" |
The script provided configures DNS server settings for Wi-Fi on a macOS system and displays the current DNS settings.
You can follow the steps to access the output.
- Login to your Hexnode UEM portal.
- Navigate to the Manage tab.
- Select the device for which you want to set up the DNS server.
- Go to Action History.
- You can find the option Output corresponding to the policy applied.