André Amorim

Crafting Web Experiences


//

How to test CNAME on local machine, without having a DNS server

You cannot test a CNAME URL on your local machine without having a DNS server installed. To be able to test that like IP addresses on “hosts” file, you need to get its current assigned IP address by just pinging it.

1. Ping and get the IP

ping cname.domain.com

You’ll see the IP address there.

2. Then you can add it to the “/etc/hosts” file on your computer.

xxx.xxx.xx.x   www.testdomain.com

This is useful for testing load balancers or any other services which provide CNAME to point.


Published date:

Modified date: