Using Hosts File to Register DNS C-Name

Many of us are using the HOSTS file for ages. However, not many people know about this “feature”.

So let’s see how it works. Often we use the hosts file to test new implementations, changes to an existing system and so on. During Office 365 implementations we need to have some C-Name record, so how do we test that by using just hosts files before we do any real DNS changes?

Apparently, it’s very simple. I am sure, you know the location of the host file :), so open it in your favourite editor and edit it according to the following example:

So, now, when we will run the following command:

We will see the following result:
C-NAME in The HOSTS File-1

Now, for let’s say test Autodiscover, we can put the following line in the host file:

And here is an expected result:
C-NAME_in_HOSTS_File-2

I hope that you learned something new and that you benefit from this post. Feel free to contact me if you want to discuss anything else.

Written by Misha Hanin

Trusted Business & Technology Advisor, Solutions Managing Director & Senior Solutions Architect at iRangers International Inc. with more than 25 years of experience in the field of information technology, infrastructure analysis and design, implementing innovative and leading technologies for International companies around the globe in public and private sectors.

Over the years I was able to develop very strong technical and engineering skills which helped me to earn trusted advisor status with our clients. As one of the nearly 500 trained Microsoft Certified Masters (MCM) in The World (during 10 years existence of MCM program, just about 500 people in The World participated in this very intensive training), I have a winning track record in building and bringing projects to operational and measurable success.

I am honored to have been awarded Microsoft Most Valuable Professional (MVP). This award is given to "exceptional, independent community leaders who share their passion, technical expertise, and real-world knowledge of Microsoft products with others."