While public and ISP DNS providers typically give you two servers, that's to handle a transient failure or temporary overloading. Each "server" is actually a collection of hundreds or thousands of pieces of hardware that answer on some round robin basis to queries to the main IP address. One server is fine, but two provide more resiliency.
Mac OS X
In all recent versions of OS X, follow these steps:
Open System Preferences and click Network.
Select your active adapter, such as Wi-Fi or ethernet.
Click the DNS tab.
Click the + sign at the bottom and paste in the first DNS server. Then click + again to paste in the second.
Click OK and then Apply.
The new settings are immediately available. If you want to be able to switch back and forth between your ISP's DNS and a public DNS server, follow these steps:
Select your adapter.
From the settings (gear) menu at the bottom of the adapters list, choose Duplicate Service.
Name the duplicate something descriptive, like "Wi-Fi Google DNS."
Now use the steps above to set the DNS values.
For clarity's sake, select the original service, then the gear icon, then Rename Service to call it something distinct from Step 3.
Select the service you're not using and choose settings > Make Service Inactive to disable it. Choose settings > Make Service Active to turn on the other, if it's not already. Click Apply.
Unfortunately, Apple doesn't offer global DNS settings in iOS. Instead, you have to change the DNS server addresses for each network you join. For a single home network, that's not much of a burden, but it's more of a problem when you roam, if you want to use alternate DNS.
Tap the information i icon to the right of your active network.
Tap the DNS field to erase and enter your own server values, separated by a comma.
Tap Wi-Fi and the settings are applied.
If you're using one or more Apple Wi-Fi base stations on your network and also use your only base station or your main one to hand out network assignments via DHCP, you can change what DNS values all connected devices use unless they're overridden with local settings as with the instructions above.
Launch AirPort Utility.
Select your base station or the main base station in a network of more than one.
Click the Edit button. (Enter the base station's password if prompted.)
Click the Internet tab.
In the DNS Servers fields, enter the server IP addresses. (You can separately set IPv6 DNS servers if needed, but IPv4 DNS servers can provide IPv6 addresses and vice versa.
Sign up for CIO Asia eNewsletters.