Sometimes infections can change your system's DNS settings. A bad DNS server setting can cause a number of problems, including unwanted ads.
To check your DNS settings:
- Open System Preferences
- Click Networking
- Select the network adapter that you're having problems with
- Click Advanced
- Click the DNS tab
The DNS Servers box will contain at least one IP address.. If the addresses can be selected within the list, they are set by your computer. Remove those addresses (select them and click the '-' button below the list). Your computer will now be set to obtain its DNS server settings from the network. If the problem you are experiencing goes away at this point, you may stop here; otherwise continue reading.
If the addresses shown are displayed in gray text, they being assigned by the network. In this case, you will need to change the settings in your network hardware, most likely your wireless router. Refer to KB article, How can I troubleshoot my wireless router or modem with my Mac?
If you are not in control of the network, or wish to verify that the network is the source of the problem, you may try adding custom DNS servers to this list, which will replace the settings provided by the network. You may insert either the OpenDNS server addresses (18.104.22.168 and 22.214.171.124) or the Google DNS server addresses (126.96.36.199 and 188.8.131.52). (Click the '+' button to add each server address.)
If the problem persists after changing your DNS settings to use the OpenDNS or Google DNS servers, it is not the result of a DNS problem.