dig and netstat works. but curl and browser don’t work.

if you are a Software Engineer especially if you are using VPN you may face this situation.

when you trying to browse the particular website in the browser it may give an error. also when you trying to use curl that may tell you can't resolve the hostname. however, your network diagnostic tools such as dig and netstat may find the right DNS resolution.

why is this?

this is because of DNS caching on your local machine.


flush the local DNS cache.

if it is Mac use the below command. if it not a mac then google like “how to flush local DNS cache + <your operating system>

sudo killall -HUP mDNSResponder;sudo killall mDNSResponderHelper;sudo dscacheutil -flushcache

if you do not have sudo access add yourself to the sudoers file or use an account which has sudo access.



Software Architect Virtusa https://youtube.com/krish

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store