How do I set an alias name in the hosts file?

68,156

Solution 1

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.

For example:

127.0.0.1       localhost            test.server.com
192.168.0.2     test.server.com      test
192.168.0.3     another.server.com   another

Solution 2

Usually, the Syntax is:

<<IP>> hostname alias1 alias2

example:

127.0.0.1 localhost lo loopback

I hope it works the same under Windows XP

Share:
68,156

Related videos on Youtube

user11222
Author by

user11222

Updated on September 17, 2022

Comments

  • user11222
    user11222 almost 2 years

    I have a production server, on which three different application are running. I need to configure aliases for that server, according to which application needs to be accessed by the user.

    How do I set an alias name in the hosts file?

  • Christoph Rüegg
    Christoph Rüegg almost 15 years
    Default path to hosts file on Windows XP C:\WINDOWS\system32\drivers\etc\hosts
  • C.Schmalzgruber
    C.Schmalzgruber almost 15 years
    Based on the question I assumed that the threadstarter is knowing where the hosts-file is. Nevertheless thank you for the addendum :-)
  • brandstaetter
    brandstaetter almost 15 years
    uh, having two identical names 127.0.0.1 localhost test.server.com 192.168.0.2 test.server.com test for differnt IPs can cause headaches... I'll assume a copy&paste error there ;)
  • user11222
    user11222 almost 15 years
    thank u but others not able to connect to alias name.