Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want resolve Windows' hostname (computer name) to another IP. myhostname in hosts file doesn't work. ping myhostname shows that it have ethernet adapter IP (

It works in Windows 7, but not in Windows 8.

Any ideas?

share|improve this question
If drop ethernet connection, it resolves to But still doesn't want read hosts file (e.g myhostname doesn't work). – veg Mar 27 '13 at 0:24
What file (please provide the full path) are you editing? Can we see its contents? – ernie Mar 27 '13 at 0:33
I edit Windows hosts file. It works for any other name except windows hostname. – veg Mar 27 '13 at 0:34
Maybe you could tell us a little bit more of what you are trying to accomplish? – G Koe Mar 27 '13 at 1:54
It works in Windows 7, could someone confirm it works on Windows 8? – veg Mar 27 '13 at 2:39

The hosts file is used to map

hostnames to IP addresses.

It will NOT Map IP addresses to hostnames but it can be used to produce hostname "aliases".

The hosts file produces the internal equivalent of A and PTR records from the DNS, i.e. mapping of hostname to IP address .

For adding a alias name to a server in the hosts file you have to make the following structure:

In the first column you have to add the IP-Address, in the second column the host-name and in the third column you have to add the desired alias-name. Any subsequent columns are alias for that host. In the example's second line the IP-Address is for the server and another name for it is test.

For example:       localhost     test2   another

This uses the hosts file on your computer. You will need to edit the hosts file on each computer that will use the alias; if you want to make this a global change, you need to use a real DNS server.

share|improve this answer
Thank you @C.Schmalzgruber – G Koe Mar 27 '13 at 1:38
In the example's second line the IP-Address is for the server and another name for it is test. It's not true, if you try to access you will get On topic: it doesn't help me to change hostname IP. – veg Mar 27 '13 at 1:49
The Hosts file will NOT map IP-->Hostname. It goes the other way. You CAN setup a DNS server... – G Koe Mar 27 '13 at 1:53
Why should I use DNS server for SINGLE machine? – veg Mar 27 '13 at 1:55
Well, could you explain why works fine, but myhostname doesn't? – veg Mar 27 '13 at 2:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.