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.

solution?

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.

--

--