<div dir="ltr"><div>Hi Mark, Idk if this will be of help to you, but LXC has some options to configure this.  Here is an example:<br><br></div><div>cat /etc/resolv.conf  (I use systemd-resolve but for this example I've commented out my systemd nameserver, I've added in the IP address of the LXC lxcbr0 bridge, and I've added "lxc" as the domain of the LXC container).  I created a container dnstest on the lxcbr0 bridge for this example.<br><br><font size="1"><span style="font-family:monospace,monospace">orabuntu@pasadena1:/etc/default$ cat /etc/resolv.conf<br><br># This file is managed by man:systemd-resolved(8). Do not edit.<br>#<br># 127.0.0.53 is the systemd-resolved stub resolver.<br># run "systemd-resolve --status" to see details about the actual nameservers.<br># nameserver 127.0.0.53<br><b>nameserver 10.0.3.1</b><br>search <a href="http://urdomain1.com">urdomain1.com</a> <a href="http://urdomain2.com">urdomain2.com</a> <a href="http://gns1.urdomain1.com">gns1.urdomain1.com</a> <b>lxc</b><br><br>orabuntu@pasadena1:/etc/default$ <b>ifconfig lxcbr0</b><br>lxcbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500<br>        inet 10.0.3.1  netmask 255.255.255.0  broadcast 0.0.0.0<br>        inet6 fe80::216:3eff:fe00:0  prefixlen 64  scopeid 0x20<link><br>        ether 00:16:3e:00:00:00  txqueuelen 1000  (Ethernet)<br>        RX packets 16  bytes 1780 (1.7 KB)<br>        RX errors 0  dropped 0  overruns 0  frame 0<br>        TX packets 130  bytes 16975 (16.9 KB)<br>        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0<br><br>orabuntu@pasadena1:/etc/default$ <b>cat lxc-net</b><br># This file is auto-generated by lxc.postinst if it does not<br># exist.  Customizations will not be overridden.<br># Leave USE_LXC_BRIDGE as "true" if you want to use lxcbr0 for your<br># containers.  Set to "false" if you'll use virbr0 or another existing<br># bridge, or mavlan to your host's NIC.<br>USE_LXC_BRIDGE="true"<br><br># If you change the LXC_BRIDGE to something other than lxcbr0, then<br># you will also need to update your /etc/lxc/default.conf as well as the<br># configuration (/var/lib/lxc/<container>/config) for any containers<br># already created using the default config to reflect the new bridge<br># name.<br># If you have the dnsmasq daemon installed, you'll also have to update<br># /etc/dnsmasq.d/lxc and restart the system wide dnsmasq daemon.<br>LXC_BRIDGE="lxcbr0"<br>LXC_ADDR="10.0.3.1"<br>LXC_NETMASK="255.255.255.0"<br>LXC_NETWORK="<a href="http://10.0.3.0/24">10.0.3.0/24</a>"<br>LXC_DHCP_RANGE="10.0.3.2,10.0.3.254"<br>LXC_DHCP_MAX="253"<br># Uncomment the next line if you'd like to use a conf-file for the lxcbr0<br># dnsmasq.  For instance, you can use 'dhcp-host=mail1,10.0.3.100' to have<br># container 'mail1' always get ip address 10.0.3.100.<br># LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf<br><br># Uncomment the next line if you want lxcbr0's dnsmasq to resolve the .lxc<br># domain.  You can then add "server=/lxc/<a href="http://10.0.3.1">10.0.3.1</a>' (or your actual $LXC_ADDR)<br># to your system dnsmasq configuration file (normally /etc/dnsmasq.conf,<br># or /etc/NetworkManager/dnsmasq.d/lxc.conf on systems that use NetworkManager).<br># Once these changes are made, restart the lxc-net and network-manager services.<br># 'container1.lxc' will then resolve on your host.<br><b>LXC_DOMAIN="lxc"</b><br><br>orabuntu@pasadena1:/etc/default$ <b>sudo lxc-ls -f</b><br>NAME       STATE   AUTOSTART GROUPS IPV4                      IPV6 <br>afns1      RUNNING 0         -      10.209.53.2, 172.29.108.2 -    <br>afns1-base STOPPED 0         -      -                         -    <br>dnstest    RUNNING 0         -      10.0.3.24                 -    <br>oel66c10   STOPPED 0         -      -                         -    <br>ora66c10   RUNNING 0         -      10.209.53.10              -    <br>ora66c11   RUNNING 0         -      10.209.53.11              -    <br>ora66c12   RUNNING 0         -      10.209.53.12              -    <br>orabuntu@pasadena1:/etc/default$ <b>nslookup dnstest.lxc</b><br>Server:        10.0.3.1<br>Address:    10.0.3.1#53<br><br>Name:    dnstest.lxc<br>Address: 10.0.3.24<br><br>orabuntu@pasadena1:/etc/default$ <br><br></span></font></div><div>My other containers on the <a href="http://10.209.53.0/24">10.209.53.0/24</a> network use a containerized DNS/DHCP bind9/isc-dhcp-server, that is forwarded to by systemd-resolved, so ignore those.  I added an Ubuntu 16.04 xenial container to my setup using the lxcbr0 bridge as the default, and as can see, by uncommenting <font size="1"><span style="font-family:monospace,monospace"><b>LXC_DOMAIN="lxc"</b></span></font> in /etc/default/lxc-net and then restarting lxc-net, dnsmasq not only provides DHCP addresses but also provides DNS lookup (has added the record), albeit you must use the FQDN to get the lookup (dnstest.lxc) in my example case so far.<br><br></div><div>If you want to be able to resolve shortnames, then the search has to be changed as shown below and then the shortname can be resolved by dnsmasq.<br><br><font size="1"><span style="font-family:monospace,monospace">orabuntu@pasadena1:/etc/default$ cat /etc/resolv.conf<br># This file is managed by man:systemd-resolved(8). Do not edit.<br>#<br># 127.0.0.53 is the systemd-resolved stub resolver.<br># run "systemd-resolve --status" to see details about the actual nameservers.<br># nameserver 127.0.0.53<br>nameserver 10.0.3.1<br># search <a href="http://urdomain1.com">urdomain1.com</a> <a href="http://urdomain2.com">urdomain2.com</a> <a href="http://gns1.urdomain1.com">gns1.urdomain1.com</a> lxc<br>search lxc<br>orabuntu@pasadena1:/etc/default$ <br><br>orabuntu@pasadena1:/etc/default$ nslookup dnstest<br>Server:        10.0.3.1<br>Address:    10.0.3.1#53<br><br>Name:    dnstest.lxc<br>Address: 10.0.3.24<br><br></span></font></div><div><font size="1"><span style="font-family:monospace,monospace"><font size="2"><font face="arial,helvetica,sans-serif">I guess that the LXC_DOMAIN is the functionality you are probably looking for.  As mentioned, I don't use dnsmasq directly in my Orabuntu-LXC project, I use dnsmasq to forward lookups to the LXC containerized isc-dhcp-server/bind9 setup, but I think you can probably setup what you need using only dnsmasq based on this LXC example.  HTH Gilber</font></font><br></span></font></div><div><br><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 16, 2018 at 9:18 AM, Mark Lehrer <span dir="ltr"><<a href="mailto:lehrer@gmail.com" target="_blank">lehrer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Does dnsmasq have the ability to automatically add DHCP clients to DNS<br>
based on the client-supplied host name?<br>
<br>
I see there is a dyndns type<br>
of script in contrib, but it would be easier to have the dhcp part of<br>
dnsmasq do it if possible.<br>
<br>
Thanks<br>
<br>
______________________________<wbr>_________________<br>
Dnsmasq-discuss mailing list<br>
<a href="mailto:Dnsmasq-discuss@lists.thekelleys.org.uk">Dnsmasq-discuss@lists.<wbr>thekelleys.org.uk</a><br>
<a href="http://lists.thekelleys.org.uk/mailman/listinfo/dnsmasq-discuss" rel="noreferrer" target="_blank">http://lists.thekelleys.org.<wbr>uk/mailman/listinfo/dnsmasq-<wbr>discuss</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Gilbert Standen<div>Creator Orabuntu-LXC</div><div>914-261-4594</div><div><a href="mailto:gilbert@orabuntu-lxc.com" target="_blank">gilbert@orabuntu-lxc.com</a></div><div><br></div></div></div>
</div>