Take the 2-minute tour ×
Server Fault is a question and answer site for professional 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 "example.example.com".

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 example.example.com?

share|improve this question

2 Answers 2

The dnsmasq manpage says:

--cname=<cname>,<target>

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

Try this in your /etc/hosts:

example.example.com         eg

Although most entries are in the form

1.2.3.4                     hostname.alias.example.com

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

 
discard

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.