Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

m3coolpix

macrumors 6502a
Original poster
Dec 24, 2007
721
3
Working on migrating to new web server. For temporary access to the new server, editing the hosts file (MacOS Monterey) in terminal.

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
22.22.22.22 mywebserver.com
::1 localhost


Saved and exit. Test ping in Terminal works to the new box, see the correct IP address, new hosting company.

However, any browser always go to the old site, say 11.11.11.11 of mywebserver.com (current hosting company) Same for FTP software.

I've tried clearing browser caches/history, rebooting....hosts file never seems to be resolved correctly outside of the terminal UI.

Any ideas? Thanks in advance!
 

splifingate

macrumors 65816
Nov 27, 2013
1,249
1,048
ATL
[edit: -ra/-er]

Inter-Server DNS propagation takes time . . . report back in 72h with the same diag, if you will ;)
 

Bigwaff

Contributor
Sep 20, 2013
1,880
1,251
First, make sure you are editing /private/etc/hosts

Second, flush DNS cache -

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
 
  • Like
Reactions: m3coolpix

m3coolpix

macrumors 6502a
Original poster
Dec 24, 2007
721
3
First, make sure you are editing /private/etc/hosts

Second, flush DNS cache -

sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
It is the /private/etc/hosts file I'm editing. Just quadrillion checked :p

And have done the sudo killall -HUP mDNSResponder process. Again, it works resolving correctly inside Terminal for the ping both ways. No edit, I get the old server ping address. With edit, I get the new server ping address. Added the sudo dscacheutil -flushcache option just now....same result.

Just really odd that it's working inside terminal as I would expect, but not with any apps or browsers (after clearing cache/history/etc).

And....@splifingate, the hosts file (at least when it's working correctly), over rides DNS for direct connection. The DNS swap over hasn't happened yet.

Here's the hosting company directions:

https://www.knownhost.com/kb/how-can-i-test-my-migrated-website-before-changing-the-dns/
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.