Let dnsmasq do it for you.
Configure your host machine's dnsmasq instance to query lxc's dnsmasq instance for the .lxc top-level domain.
In /etc/default/lxc-net, uncomment this line:
If your host's dnsmasq instance is launched by NetworkManager (as is the case with most current Ubuntu desktop installations) create a file called /etc/NetworkManager/dnsmasq.d/lxc.conf with this line inside:
If your host's dnsmasq is launched by something other than NetworkManager, add that line to /etc/dnsmasq.d-available/lxc instead:
Then restart things so they pick up the changes:
service lxc-net stop
service lxc-net start
service network-manager restart
You might have to restart your lxc containers or make them request new DHCP leases before they appear in DNS. (I don't remember whether it was necessary when I did this.) It's also worth mentioning that I saw a bug report about lxc-net not picking up dnsmasq changes when it was restarted, so you might want to reboot your host system just to be sure.
Then try it:
$ host mycontainer.lxc
mycontainer.lxc has address 10.0.3.21
$ ssh firstname.lastname@example.org
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-39-generic x86_64)