In the “real” world you simply add an entry to /etc/hosts like
1.2.3.4 myhost
The Mac OS X world is different. For version 10.5 and later you do the following
# Create the mapping
sudo dscl localhost -create /Local/Default/Hosts/x.y.z IPAddress 127.0.0.1
# flush the cache
sudo dscacheutil -flushcache
# Show the mappings
sudo dscl localhost -readall /Local/Default/Hosts
# Delete a mapping
sudo dscl localhost -delete /Local/Default/Hosts/x.y.z
sudo dscacheutil -flushcache
-
Pingback from Mac OS X Things · Flush DNS Cache on 8/8/2009 at 8:38 am
2 comments
Comments feed for this article
Trackback link: http://face.centosprime.com/macosxw/forcing-an-ip-address/trackback/