CNAME record/alias in windows hosts file?

196,326

Solution 1

The windows hosts file supports only ip->name mappings, it does not support any other standard DNS record types. See here:

http://technet.microsoft.com/en-us/library/bb727005.aspx#EDAA

I would recommend running a simple dns server in order to do the redirect you are talking about. Try powerdns http://www.powerdns.com/

Solution 2

PowerDNS is not supported on Windows. I would recommend a tool such as "SimpleDNS" (14 day Trial) or "Technitium DNS Server" (free) which can be used to create a simple local DNS server.

Once you setup the program, you can create a zone and record for the CNAME you're trying to test and point your DNS server settings to 127.0.0.1 only to test.

DNS Settings

I was able to use this to test TrafficManager and this looks to be the easiest way to do it on a Windows computer.

Share:
196,326

Related videos on Youtube

user3647702
Author by

user3647702

Updated on September 17, 2022

Comments

  • user3647702
    user3647702 almost 2 years

    Is it possible to enter some sort of CNAME record or alias in the windows hosts file (C:\Windows\System32\drivers\etc\hosts)?

    Basically I want to forward all requests made to host A to host B, without having to hard code the IP address (which changes frequently).

  • eos
    eos almost 3 years
    Anyone found an alternative for Mac?
  • user3647702
    user3647702 over 2 years
    @eos I didn't try it out personally, but a googling gives me a number of alternatives. For example this one mamp.info/namo/en
  • Lonare
    Lonare over 2 years
    +1 for Technitium - very easy to set up