MacBook – Wifi, DNS problem on MacBook Pro retina

dnsmacbook proNetworkwifi

On a Macbook Pro retina 13 2014 with El Capitan 10.11.5 I can't access websites through their domain name (google.com, bing.com, etc).

I can access the internet with Google Chrome, but with others applications I can't.

I can ping 8.8.8.8:

MacBook-Pro:~ alex$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=58 time=18.093 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=58 time=18.489 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 18.093/18.291/18.489/0.198 ms
MacBook-Pro:~ alex$

I can't ping google.com

MacBook-Pro:~ alex$ ping google.com
ping: cannot resolve google.com: Unknown host
MacBook-Pro:~ alex$

I tried to put DNS manually (8.8.8.8), reboot, but it doesn't work.

I tried to delete these files and reboot but it doesn't work:

  • com.apple.airport.preferences.plist`
  • com.apple.network.identification.plist`
  • NetworkInterfaces.plist`
  • preferences.plist`

tried:

MacBook-Pro:~ alex$ dig @8.8.8.8 www.google.com

; <<>> DiG 9.8.3-P1 <<>> @8.8.8.8 www.google.com
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9734
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;www.google.com.            IN  A

;; ANSWER SECTION:
www.google.com.     264 IN  A   172.217.16.68

;; Query time: 33 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Thu Jul 14 16:00:31 2016
;; MSG SIZE  rcvd: 48

MacBook-Pro:~ alex$

Could you help me please?

Best Answer

  1. Google Chrome uses its own DNS resolver, that's why it behaves differently.

  2. dig command also connects directly to DNS server.

  3. To verify your current DNS server settings on the Wi-Fi network interface use:

    networksetup -getdnsservers Wi-Fi
    
  4. To troubleshoot your problem try:

    1. clearing the DNS server settings (and rely on DHCP) with:

      sudo networksetup -setdnsservers Wi-Fi empty
      
    2. setting the DNS server manually with the command:

      sudo networksetup -setdnsservers Wi-Fi 8.8.8.8 8.8.4.4
      
    3. create a new location with separate DNS settings by:

      • clicking on the network icon in the menu bar
      • choosing Open Network Preferences...
      • selecting Edit Locations... from the top list box (you might need to unlock settings with administrator's password first) and creating new location
      • clicking on Advanced... button, selecting DNS tab and adding the DNS servers in the left pane