Cant connect to google intermittently
To isolate a DNS issue, you might try using google DNS by setting your Mac to use 8.8.8.8 instead of the DNS server it assigned or received from your router. 

From there you can use nslookup and ping to test network connectivity and DNS resolution.