I am trying to redirect an existing web address to a remote machine on my subnet. To do this, I put the following in / etc / hosts
192.168.1.249 holub.com
and clear the DNS cache with
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
However, when I ping holub.com (the most reliable way I know to see how the address is actually resolved), I see the real web address (204.13.10.74), and not the one listed in / etc / hosts ( 192.168.1.249). Interestingly, the mysqladmin utility does not resolve the address correctly, but the Chrome browser resolves the address correctly. I assume that Chrome has a peculiar internal solution.
In general, it seems that / etc / hosts are used after the actual DNS lookup, and not earlier, as it should be, so the external address is not redefined.
I tried using different IPv6 equivalents for my local address (0: 0: 0: 0: 0: ffff: c0a8: 01f9 :: ffff: 192.168.1.249 :: 192.168.1.249), but that doesnโt help. Rebooting (rather than clearing the cache) does not help either.
I found one unsatisfactory workaround. If I turn off DNS Review with
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist
then / etc / hosts is used, but then I canโt access the Internet.
If anyone has encountered this problem, I would like to know if there is a workaround.
source share