I want resolve Windows' hostname (computer name) to another IP.
127.0.0.1 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.
The hosts file is used to map
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 192.168.0.2 is for the server test.server.com and another name for it is test.
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.