[lxc-users] How to check DNS records of containers

Adil Baig simplyadilb at gmail.com
Wed Jun 28 11:34:14 UTC 2017


This hasn't worked for me.

lxc network show lxdbr0
description: ""
config:
  dns.domain: lxd
  dns.mode: managed
  ipv4.address: 10.0.1.1/24
  ipv4.dhcp.ranges: 10.0.1.2-10.0.1.254
  ipv4.nat: "true"
  ipv6.address: none
  raw.dnsmasq: conf-file=/home/ubuntu/stockopedia-lxd-dnsmasq.conf
name: lxdbr0
type: bridge
used_by:
- /1.0/containers/devop-tools
- /1.0/containers/polished-thrush
- /1.0/containers/python-live
- /1.0/containers/python-staging
- /1.0/containers/symfony-cli
- /1.0/containers/symfony-cli-movements
- /1.0/containers/symfony-cli-staging
managed: true

I did steps 1.2 and 5. The rest were already in place (lxc version 2.14). I
killed dnsmasq and restarted lxd service (sudo service lxd restart) .

Still no luck.

+-----------------------+---------+-------------------+------+------------+-----------+
|         NAME          |  STATE  |       IPV4        | IPV6 |    TYPE    |
SNAPSHOTS |
+-----------------------+---------+-------------------+------+------------+-----------+
| devop-tools           | RUNNING | 10.0.1.66 (eth0)  |      | PERSISTENT |
0         |
+-----------------------+---------+-------------------+------+------------+-----------+
| polished-thrush       | RUNNING | 10.0.1.55 (eth0)  |      | PERSISTENT |
0         |
+-----------------------+---------+-------------------+------+------------+-----------+
| python-live           | RUNNING | 10.0.1.52 (eth0)  |      | PERSISTENT |
0         |
+-----------------------+---------+-------------------+------+------------+-----------+
| python-staging        | RUNNING | 10.0.1.61 (eth0)  |      | PERSISTENT |
0         |
+-----------------------+---------+-------------------+------+------------+-----------+
| symfony-cli           | RUNNING | 10.0.1.2 (eth0)   |      | PERSISTENT |
1         |
+-----------------------+---------+-------------------+------+------------+-----------+
| symfony-cli-movements | RUNNING | 10.0.1.88 (eth0)  |      | PERSISTENT |
1         |
+-----------------------+---------+-------------------+------+------------+-----------+
| symfony-cli-staging   | RUNNING | 10.0.1.217 (eth0) |      | PERSISTENT |
0         |
+-----------------------+---------+-------------------+------+------------+-----------+

 ping devop-tools.lxd
ping: unknown host devop-tools.lxd

On Wed, Jun 28, 2017 at 4:42 PM, Adil Baig <simplyadilb at gmail.com> wrote:

> How do i restart dnsmasq without restarting lxd? That would pause all my
> containers.
>
> On Wed, Jun 28, 2017 at 3:47 PM, Fajar A. Nugraha <list at fajar.net> wrote:
>
>> On Wed, Jun 28, 2017 at 4:36 PM, Adil Baig <simplyadilb at gmail.com> wrote:
>>
>>> In the new LXD (2.5+) is there automatic DNS resolution for containers
>>> on the host?
>>>
>>>
>> It can. But you need to make it so.
>>
>>
>>> 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?
>>>
>>>
>> (1) See https://stgraber.org/2016/10/27/network-management-with-lxd-2-3/
>> . In particular:
>> - creating a new network bridge (or use lxdbr0, if you want)
>> - dns.domain and ipv4.address (for the bridge)
>> - (optional, if you want "static" ip for the container): "lxc network
>> attach" and ipv4.address for the container
>>
>> (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
>>
>> (3) make sure you have dnsmasq installed on the host. Install it if you
>> don't have it.
>>
>> (4) make sure /etc/dnsmasq.d/lxd on the host exclude the interface
>> created on step (1) (e.g. except-interface=lxdbr0)
>>
>> (5) Create a file (I call mine /etc/dnsmasq.d/lxd-resolve), with this
>> line (adjust IP and domain as necessary)
>> server=/lxd/10.0.3.1
>>
>> (6) restart dnsmasq on the host if necessary
>>
>> You can then refer to container using dns from the host
>> # lxc list test
>> +------+---------+-------------------+------+------------+-----------+
>> | NAME |  STATE  |       IPV4        | IPV6 |    TYPE    | SNAPSHOTS |
>> +------+---------+-------------------+------+------------+-----------+
>> | test | RUNNING | 10.0.3.117 (eth0) |      | PERSISTENT | 1         |
>> +------+---------+-------------------+------+------------+-----------+
>>
>> # ping -n -c 1 test.lxd
>> PING test.lxd (10.0.3.117) 56(84) bytes of data.
>> 64 bytes from 10.0.3.117: icmp_seq=1 ttl=64 time=0.082 ms
>>
>> --- test.lxd ping statistics ---
>> 1 packets transmitted, 1 received, 0% packet loss, time 0ms
>> rtt min/avg/max/mdev = 0.082/0.082/0.082/0.000 ms
>>
>>
>> --
>> Fajar
>>
>> _______________________________________________
>> lxc-users mailing list
>> lxc-users at lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20170628/c7505526/attachment-0001.html>


More information about the lxc-users mailing list