Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'd like to be able to set up a host, say "eg", to be an alias to some server on the internet, say "".

I just need this functionality to be available from my local machine. I'm running dnsmasq on that machine, which is running ubuntu 9.10.

Is there a way to configure dnsmasq or the resolver subsystem (including avahi) to resolve that alias hostname via the actual hostname, so that eg will resolve to the ip address of

share|improve this question

3 Answers 3

The dnsmasq manpage says:


Return a CNAME record which indicates that <cname> is really <target>. There are significant limitations on the target; it must be a DNS name which is known to dnsmasq from /etc/hosts (or additional hosts files) or from DHCP. If the target does not satisfy this criteria, the whole cname is ignored. The cname must be unique, but it is permissable to have more than one cname pointing to the same target.

I think the "known target" criteria will make it unsuitable for your requirements.

I do know that Unbound does support this feature, though.

share|improve this answer
Yeah, that won't work because the host that I want the alias to target isn't local. Thanks for the tip on Unbound, I'll check that out. Though I'd rather not have to learn a whole other way of doing what dnsmasq already does.. :( – intuited May 3 '10 at 9:33
+1 for unbound... and the pun on bind :) – chmeee May 3 '10 at 11:29

In your dnsmasq.conf add this line


This will allow you to create a name that can be used.

This was not asked but if you want to all devices to use it set up the dhcp options. Just for a guide here is my config.

expand-hosts # allows /etc/hosts to be used
dhcp-range=,,,24h #Range and lease time
dhcp-option=3, #gateway
dhcp-option=6, #dns server

I am runing this on a Raspberry pi that is also acting as a pi-hole and webserver.

share|improve this answer

Try this in your /etc/hosts:         eg

Although most entries are in the form           

a host-to-host alias should work too.

share|improve this answer
Does that work? If so it's not documented as such in man hosts under ubuntu. It mentions that I can give an alias in addition to an IP address and canonical hostname, but in this case that won't work because the IP address for that host is dynamic. – intuited May 3 '10 at 16:08
Confirmed that this doesn't seem to work. – intuited May 3 '10 at 16:14
Indeed it doesn't - I thought I'd seen a colleague using it but they couldn't get it to work either. – Alphax May 5 '10 at 10:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.