Normally when you want to access a server on the Internet, you specify its name, like “www.google.com”. What actually happens behind the scenes is that your computer finds out the “IP address” of where you want to go. The IP address is like the “telephone number” of a server. The IP address for Google is 64.233.181.104 .
Go ahead and try it, you’ll end up at Google.
If the IP address is a “telephone number”, then the name (like the name you enter for a number in your cell phone) is called a host name. “Host” is just another word for server or computer.
Anyway, normally all of this works automagically, and you don’t even notice it. Once in a while it may not, for example, in a home network, thus forcing you to type in numbers instead of names.
There’s a way to set hostnames to IP addresses manually.
The hosts file
It’s called a “hosts” file, and it works generally the same on Windows, Linux/Unix, and Mac OS/X.
The hosts file is a list of IP addresses followed by hostnames, separated by a space, like this:
64.233.181.104 www.google.com 192.168.0.4 myhomecomputer
By the way, there’s a neat little trick you can use to block ads by setting the address of adservers, like Double Click’s, to your local computer:
127.0.0.1 ad.doubleclick.net
Note: 127.0.0.1 is a special address that always refers to your own computer.
The hosts file’s location differs from system to system:
Setting hosts/IP address on Windows
On Windows 95, 98, and ME, the host file is at c:\windows\hosts .
On Windows NT, 2000, XP, Vista, and 7, it’s at C:\windows\system32\drivers\etc\hosts .
You can modify it with Notepad (Accessories menu).
Setting hosts/IP address on Mac OS/X
In Mac OS X 10.2 or later, hosts is at /private/etc/hosts
To edit it, type this into a terminal (Applications > Utilities > Terminal)
sudo nano
Enter your own password if prompted, add a hostname entry, then press Ctrl+x to exit the editor, and save the modified file by pressing “y”.
You have to then flush the DNS cache (OS/X doesn’t do that automatically):
sudo dscacheutil -flushcache
More info: http://support.apple.com/kb/TA27291
http://www.leftcolumn.net/2009/07/04/adding-an-entry-to-etchosts-on-os-x/
Setting hosts/IP address on Linux/Ubuntu/Unix
On Linux and all other Unixes, hosts is at
/etc/hosts .
You have to have either sudo or root privileges to edit it.
If you liked this article
If you liked this article, don’t forget to subscribe for updates!
Get updates by RSS (What’s RSS?)
Follow me on Twitter
Top Incoming Search Terms
add dreamhost hostname os x add host entry linux add host to terminal osx add ip addresses to /private/etc/hosts mac add ips hosts osx adding host addresses osx apple ip youtube terminal hosts cache:http://digitivity.org/964/how-to-manually-add-etc-host-ip-address-in-windows-linux-and-osx commentluv enabled comments in /etc/hosts linux finding /etc/hosts macos manually hosts on linux similar to hosts file on windows how do i manually add a ip address how do you check what is the dns for 64.233.181.104 how to add hostname in terminal how to check the dns for 64.233.181.104 how to create ip address manually how to manually add a host ip address in windows 7 how to manually add hosts how to manually add hosts to windows 7 how to manually set ip address in hosts file of windows operating system how to manually specify dns for mail how-to add hostname in linux http://digitivity.org/964/how-to-manually-add-etc-host-ip-address-in-windows-linux-and-osx http://digitivity.org/964/how-to-manually-add-etc-host-ip-address-in-windows-linux-and-osx#comment-4927 ip address manually linunx hostnames os x linux add hosts linux facebok hosts linux howto add hosts linux ip address windows hosts locate lucid add to hosts lucid linux hostname etc/host mac "os x" howto edit etc hosts mac os x manually specify the ip of a hostname manual add host to dns manual add ip and host file manuall setting host address on os x manually add host manually add host ip ubuntu manually add windows hosts manually adding an entry into my hosts file for windows 7 os x add hostnames osx dns manual setting terminal sudo nano add hosts ubuntu manually add domain name youtube host file on linux youtube ip etc hosts mac os xRelated posts:
- Frozen Bubble: A Fun and Addictive Marbles Game for Windows, Linux, and Mac Frozen Bubble is a fun game for wasting time while...
- How to Add an E-mail to a Gravatar Account Your Gravatar account can have more than one e-mail associated...
- How to Install Google Skipfish on Ubuntu Linux Skipfish is a new security scanning tool from Google that...
- Install Free Software on Mac OS/X with Darwin Ports In case you didn't know, Mac OS/X is a complete...
- Keep Notes and Stay Organized with Zim Desktop Wiki Someone complemented me the other day that I'm pretty organized....
Explore related content: etc/hosts, hostname, hosts, IP address, Linux, OS/X, Windows


![[del.icio.us]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/delicious.png)
![[Digg]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/digg.png)
![[dzone]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/dzone.png)
![[Facebook]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/facebook.png)
![[LinkedIn]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/linkedin.png)
![[Reddit]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/reddit.png)
![[Slashdot]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/slashdot.png)
![[StumbleUpon]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/stumbleupon.png)
![[Technorati]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/technorati.png)
![[Twitter]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/twitter.png)
![[Yahoo!]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/yahoo.png)
![[Email]](http://digitivity.org/blog/wp-content/plugins/bookmarkify/email.png)
Really thanks for sharing this information.
Thanks for the info on Windows 7. I just switched over and could not find it or anywhere online that would let me know it was in the same location as my old XP box.
Step-by-step info really helps us kinda impaired folks thanks.
It is well worth taking a quick look through your hosts file and seeing what is there. Many spyware / antivirus software programs use it to prevent you from going to bad sites, but there are also viruses that will redirect you from favourite search engines to a bad site through a hack on this file. So, knowing where it is and what it looks like is very useful.
Thanks!
Keith´s last blog ..The 3 Month Challenge
It work. Thank you.
This is also helpful when you’re developing websites and you want to use the full domain name. Just set the domain to a local IP in your hosts file and you should be able to view the local copy instead of the live one.
Matthew´s last blog ..Binero
An informative post. Thanks for sharing. Good research work for all three operating systems.
wow its awsome blog, i learn so much by reading your blog especially this article, thanks for share
andi´s last blog ..Gambar Modifikasi Nissan 2003 Type 350Z
Well most of the people in the it field already knew this the name helps normal user to use intrenet more.
jimmy41687´s last blog ..Make Money Online
Great step by step tutorial.
linux is truly a very complicated os for such beginners…
good tutorial
is there a tool for speed up this process in windows?
it really takes me lot of time to modify this file
Giochi Super Mario´s last blog ..Mario vs Boo
Thanks for sharing is very helpful for me.God bless you.
videos cristianos´s last blog ..¡Tenga cuidado-
Thanks for sharing this, I recently switched to Windows 7 and couldn’t find how to do this, after finding your blog post here you’ve just given me the information I needed.
Well structured and informative, thanks again.
Personalised Wedding Banners´s last blog ..Personalized Birthday Banner
great article, you tols us the actuals that happen when we search for some name please do tell us what happens when we search in google or yaaho what these spider do that will be an add on for our dictionary
I did not get this to work before reading this. Now I found how to do it. Thanks
This is also helpful when you’re developing websites and you want to use the full domain name.I recently switched to Windows 7 and couldn’t find how to do this, after finding your blog post here you’ve just given me the information I needed.Thanks for sharing this.
Thanks for such informative post. i was looking for it from last 2-3 months. You make my task easy, I’m so happy to have your blog. Thanks a lot, keep on like that. From now I’m a regular user of your blog.
thank you for this very informative post. this is so helpful.
Hi,
This is very good info. Can I add one more thing?
You can give a servermultiple names in your host file.
For example:
132.10.10.1 aamyserveraa.com bbmyserverbb.com
So when you ping/call aamyserveraa.com or bbmyserverbb.com both point to the same server.
VMS commands:
To add a host entry
$ucx set host SERVER-B /ADDRESS=132.10.10.1
To remove a host entry
$ucx set nohost SERVER-A /noconfirm
To check your host entires
$ucx sho host
Great Article…now I clear my problem with Setting hosts on Linux…Thanks
Golf Swing Mechanics´s last blog ..5 Fundamentals for Mechanics Golf Swing
Been looking everywhere for info on this so I can switchover. Alot easier to do than I thought it would be. Thanks for the info.
thanks for sharing.. i like reading this posting..
bestregards
I was searching for this information because I needed to make some changes here at work, and found your site through google. Thanks for giving step-by-step instructions. It saved me calling the IT department, which here is a good thing. Thanks again!
It’s amazing how alot of people don’t even know that you can type an ip address to reach the same url address. I gave a link in the past to a friend of mine but I gave as the ip address with the http in front of it, he got freaked out and thought I was trying to hack him! lol.
Till then,
Jean
used tires´s last blog ..Places to buy used tires
Thanks for the tips they are very helpful.

Regim´s last blog ..IN REGIM HOTELIER
I know how to add hosts manually in windows but not in Linus and OS/x. This post will surely help a lot of geeks out there.
Thanks for posting this. Saved me a lot of headaches.
Very handy. Cant’ think of when I’d ever need this, but it’s always good to have for if the situation arises.
Thanks. Very handy to have.
very cool thanks.
thanks for sharing
And is also important to know that it also override the dns settings. Aniway… a good article.
Great Article…now I clear my problem with Setting hosts on Linux…Thanks
juicy couture´s last undefined ..Response cached until Wed 28 @ 10:53 GMT (Refreshes in 23.99 Hours)
Hello friend thank you today for me is still a major difficulty in setting up Linux, I have no knowledge of this “catch” a bit lol … Thanks!
I too have many friends that had no idea that an ip address could be used instead of an URL. They thought that ip addresses were simply temporary till a URL was produced for a site!
Excellent tips and advice. When it comes to this type of stuff I am clueless, but your explanation has shed some insight to me and should be very helpful
Thanks for your information, taht’s nice. however, I am not good at computer program, hope I won’t make my computer worse..
rosetta stone´s last blog ..Rosetta Stone Version 3 Chinese Mandarin- Level 1-2 & 3
Thanks, very informative post and I would like to share with you how to speed up mac osx
I mean speed up mac os x
wow its awsome blog, i learn so much by reading your blog especially this article, thanks for share…..
david walker´s last blog ..Lowa AL S 451 GTX Boot
Great Blog Entry!
thanks for tutorial, its helpful…
I needed this since Im developing websites and I want a full domain name. Thanks for sharing
Jonas´s last blog ..Husgrund – marken spelar roll
it’s complicated..thx for share
it a good and helping info. it really help me. thanx