I'd like to resolve a domain name somedomain.com
to a CNAME (AWS load balancer, e.g. some-balancer-1213231237.ap-southeast-2.elb.amazonaws.com
), but only locally.
What I mean to achieve is that whenever I try to visit somedomain.com
, I want to be served by the above mentioned load-balancer - this should only be limited to my own computer.
It's not possible to achieve this by editing /etc/hosts
as in there only A records (IP addresses) can be mapped. I read somewhere that dnsmasq
would be the most robust solution to achieve this. However, the documentation is very unclear about how this can be achieve. I'd appreciate your advice and perhaps a piece of config with an example. Thanks!
You can add the following to your configuration file in
dnsmasq
:as specified in the man page:
As the man page specifies, you will have to define the target in your /etc/hosts file though:
So I'm not sure this would be very useful to you.
You have to keep in mind, that the to be resolved hostname has to be added to the /etc/hosts file too ! E.g.: the right part in the hosts file:
dnsmasq.conf entry: cname=cname.example.com,ip1.example.com
Test:
That's all it takes ;-)