Wednesday, 8 August 2012

How to Edit host file on Mac to resolve hostname

If you are a new mac user, and you want to edit your host file to resolve hostname, you can follow this tips below. 
 
For example : i will resolve www.its-berry.com to ip 10.0.1.1
  1. Open Terminal (Using Spotlight, type Terminal and press the enter key).
  2. In the terminal window, type:
    sudo nano /private/etc/hosts
  3. Enter your administrator password when prompted.
  4. The HOSTS file will appear in the Terminal window. Comments will be preceded by #. Following the comments, by default, it should start with the following:
    10.0.1.1     its-berry.com 
    255.255.255.255 broadcasthost
  5. Use the arrow keys on the keyboard to navigate through the HOSTS file and make any changes.
  6. Press Control O and then press the enter key to save changes. Press Control X to exit the HOSTS file.
  7. If you want the HOSTS changes to take immediate effect, type:
    dscacheutil -flushcache
  8. Type exit to logout of Terminal. To quit Terminal, right click the Terminal icon and choose Quit.

No comments:

Post a comment

Popular Posts