<div dir="ltr">How do i restart dnsmasq without restarting lxd? That would pause all my containers.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 28, 2017 at 3:47 PM, Fajar A. Nugraha <span dir="ltr"><<a href="mailto:list@fajar.net" target="_blank">list@fajar.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Wed, Jun 28, 2017 at 4:36 PM, Adil Baig <span dir="ltr"><<a href="mailto:simplyadilb@gmail.com" target="_blank">simplyadilb@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">In the new LXD (2.5+) is there automatic DNS resolution for containers on the host? <div><br></div></div></blockquote><div><br></div></span><div>It can. But you need to make it so.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>I'd like to configure a virtual host on Apache (on the host mahcine) to proxy requests to a container using its DNS rather than its IP. How can i do this?</div></div>
<br></blockquote><div><br></div></span><div>(1) See <a href="https://stgraber.org/2016/10/27/network-management-with-lxd-2-3/" target="_blank">https://stgraber.org/2016/<wbr>10/27/network-management-with-<wbr>lxd-2-3/</a> . In particular:</div><div>- creating a new network bridge (or use lxdbr0, if you want)</div><div>- dns.domain and ipv4.address (for the bridge)</div><div>- (optional, if you want "static" ip for the container): "lxc network attach" and ipv4.address for the container</div><div><br></div><div>(2) configure the container to use DHCP. Dnsmasq will assign the appropriate IP based on the ip address you assign to the container in the previous step</div><div><br></div><div>(3) make sure you have dnsmasq installed on the host. Install it if you don't have it.</div><div><br></div><div>(4) make sure /etc/dnsmasq.d/lxd on the host exclude the interface created on step (1) (e.g. except-interface=lxdbr0)</div><div><br></div><div>(5) Create a file (I call mine /etc/dnsmasq.d/lxd-<wbr>resolve), with this line (adjust IP and domain as necessary)</div><div><div>server=/lxd/<a href="http://10.0.3.1" target="_blank">10.0.3.1</a></div></div><div><br></div><div>(6) restart dnsmasq on the host if necessary</div><div><br></div><div>You can then refer to container using dns from the host</div><div><div># lxc list test</div><div>+------+---------+------------<wbr>-------+------+------------+--<wbr>---------+</div><div>| NAME | STATE | IPV4 | IPV6 | TYPE | SNAPSHOTS |</div><div>+------+---------+------------<wbr>-------+------+------------+--<wbr>---------+</div><div>| test | RUNNING | 10.0.3.117 (eth0) | | PERSISTENT | 1 |</div><div>+------+---------+------------<wbr>-------+------+------------+--<wbr>---------+</div><div><br></div><div># ping -n -c 1 test.lxd<br></div><div>PING test.lxd (10.0.3.117) 56(84) bytes of data.</div><div>64 bytes from <a href="http://10.0.3.117" target="_blank">10.0.3.117</a>: icmp_seq=1 ttl=64 time=0.082 ms</div><div><br></div><div>--- test.lxd ping statistics ---</div><div>1 packets transmitted, 1 received, 0% packet loss, time 0ms</div><div>rtt min/avg/max/mdev = 0.082/0.082/0.082/0.000 ms</div></div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>-- </div><div>Fajar</div></font></span></div></div></div>
<br>______________________________<wbr>_________________<br>
lxc-users mailing list<br>
<a href="mailto:lxc-users@lists.linuxcontainers.org">lxc-users@lists.<wbr>linuxcontainers.org</a><br>
<a href="http://lists.linuxcontainers.org/listinfo/lxc-users" rel="noreferrer" target="_blank">http://lists.linuxcontainers.<wbr>org/listinfo/lxc-users</a><br></blockquote></div><br></div>