Click on the Apple icon on the top-left side of your desktop and select System Preferences.
In the following screen, please ensure your current Internet connection is selected. In this example, we’re connecting via Wi-Fi.
Once you’ve selected your current Internet connection, please click on Advanced.
In the Advanced menu, please select DNS.
Under DNS, you will see your default DNS server address, which will usually be your router IP address.
Click on the + sign at the bottom of the DNS Servers box and enter the following DNS addresses:
Once the DNS addresses have been added, click on OK.
Click on Apply to apply the saved settings.
Google DNS is now set on your Network settings in OS X.