DNS Issue

rorta
New Contributor

Hi, don't know if anyone can help, but we are experiencing an issue where all our students are having their DNS server info changed to a loopback 127.0.0.1 and causing them not to be able to connect to the internet. We have given them instructions to change this, but I need to create a script to push out to all student laptops to be able to do this so we can stop being inundated with calls and tickets. My knowledge of implementing scripts is elementary with Jamf. Anyone there that can help with a script and how to implement?
7b8f23f0236b4e21b8d34f99202c33e4

4 REPLIES 4

sharriston
Contributor III

This script will reset DNS back to default settings. Do you have any network config profiles setup or scripts with a place holder DNS setting? Just things to check.

#!/bin/bash

NetworkServices=`networksetup -listallnetworkservices`

if [[ $NetworkServices =~ "Wi-Fi" ]];then
    networksetup -setdnsservers Wi-Fi empty
    echo "Reset DNS Servers for Wi-Fi"
fi

if [[ $NetworkServices =~ "Ethernet" ]];then
    serviceName=`networksetup -listallnetworkservices | grep "Ethernet" -m 1`
    networksetup -setdnsservers "$serviceName" empty
    echo "Reset DNS Servers for $serviceName"
fi

if [[ $NetworkServices =~ "LAN" ]];then
    serviceName=`networksetup -listallnetworkservices | grep "LAN" -m 1`
    networksetup -setdnsservers "$serviceName" empty
    echo "Reset DNS Servers for $serviceName"
fi

rorta
New Contributor

No we don't. Thank you for this script. I'll give it a shot.

rhooper
Contributor III

We just had this occur, and cisco made an update to OpenDNS which rendered machines wifi brain dead.
A now cersion came out as well. Which still requires one to create a new location.
Once they do that i can see them again, but need this script to get rid of the loopback. Thanks for that.

vailster-cc
New Contributor

Hey @rhooper just wondering how you're. handling using this script for Umbrella issues. We are running into the same thing for the past few months.