On Fri, 2014-02-14 at 11:06 +0800, Mingjiang Shi wrote:
> Hi Michael,
> Thanks for answering my question. There was no such
> file /var/lib/libvirt/dnsmasq/default.conf, so I created one.
> However, it still doesn't work after killing the existing dnsmasq and
> restarted the libvirtd.  

Ok...  Maybe some amusing time to trigger some hate mail from Serge.

From the sounds of this thread, it sounds like they did this with
"malice aforethought"...

https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/247583

Our own dear Serge added this comment near the bottom...

-- 
> As has been discussed upstream, adding a generic custom conf file
> hides useful information when debugging. The dnsmasq features which
> need to be tweaked should be explicitly supported in new xml bits.
> Marking this wontfix here, but hoping that the features will show up
> upstream soon.
-- 

It does appear that SOMETHING appeared upstream as Fedora has custom
configurable default files for libvirt and dnsmasq, but I'm not sure
where that leaves you on CentOS.

I would personally suggest that maybe you could take the advice to
disable the libvirt dnsmasq and configure and start your own
independently as described in that article.  That would be a 3rd option
to using the distro configuration files (ifcfg-eth?) or using the lxc
configuration options for static addresses.

Mike

> ================
> [root@devmachine dnsmasq]# ls -l /var/lib/libvirt/dnsmasq/default.conf
> -rw-r--r-- 1 root root 21245 Feb 14
> 10:33 /var/lib/libvirt/dnsmasq/default.conf
> 
> 
> # added one line trying to assign 192.168.122.200 to container c1
> [root@devmachine dnsmasq]# tail
> -1 /var/lib/libvirt/dnsmasq/default.conf
> dhcp-host=c1,192.168.122.200
> 
> 
> # kill existing dnsmasq
> 
> [root@devmachine dnsmasq]# ps -ef | grep dns
> nobody   29325     1  0 10:37 ?        00:00:00 /usr/sbin/dnsmasq
> --strict-order --local=// --domain-needed
> --pid-file=/var/run/libvirt/network/default.pid --conf-file=
> --except-interface lo --bind-interfaces --listen-address 192.168.122.1
> --dhcp-range 192.168.122.2,192.168.122.254
> --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
> --dhcp-lease-max=253 --dhcp-no-override
> --dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
> --addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
> 
> 
> [root@devmachine dnsmasq]# kill -9 29325
> [root@devmachine dnsmasq]# !ps
> ps -ef | grep dns
> root     30695 34063  0 11:02 pts/3    00:00:00 grep dns
> 
> 
> # restart libvirtd
> [root@devmachine dnsmasq]# service libvirtd restart
> Stopping libvirtd daemon:                                  [  OK  ]
> Starting libvirtd daemon:                                  [  OK  ]
> 
> 
> # still no conf-file is given to dnsmasq
> [root@devmachine dnsmasq]# !ps
> ps -ef | grep dns
> nobody   30782     1  0 11:03 ?        00:00:00 /usr/sbin/dnsmasq
> --strict-order --local=// --domain-needed
> --pid-file=/var/run/libvirt/network/default.pid --conf-file=
> --except-interface lo --bind-interfaces --listen-address 192.168.122.1
> --dhcp-range 192.168.122.2,192.168.122.254
> --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
> --dhcp-lease-max=253 --dhcp-no-override
> --dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
> --addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
> root     30829 34063  0 11:03 pts/3    00:00:00 grep dns
> ================
> 
> 
> 
> 
> 
> On Fri, Feb 14, 2014 at 1:33 AM, Michael H. Warfield
> <[email protected]> wrote:
>         On Thu, 2014-02-13 at 16:23 +0800, Mingjiang Shi wrote:
>         > Hello,
>         > I run lxc container on centos and want to my container to
>         start with a
>         > static IP address.
>         >
>         >
>         > After some investigation, I figured out that the dnsmasq is
>         started by
>         > libvirtd to provide DNS and DHCP service to the container.
>         However, I
>         > cannot figure out how to reserve ip address for a specific
>         host in the
>         > dnsmasq config file.
>         >
>         >
>         > Meanwhile, in the ps out, it looks like no config file is
>         given when
>         > start the dnsmasq daemon, which doesn't sound right.
>         
>         
>         No, that doesn't sound right.  Are you sure there isn't a
>         dnsmasq config
>         file in /var/lib/libvirt/dnsmasq/default.conf ?  I take it
>         that it's
>         ignoring the default config file /etc/dnsmasq.conf options.
>         
>         According to the doco, dnsmasq does support static address
>         assignments,
>         so it's just a matter of getting to the correct conf file.
>          That may be
>         a libvirt configuation setting there.
>         >
>         > nobody   12531     1  0 Feb12 ?
>          00:00:01 /usr/sbin/dnsmasq
>         > --strict-order --local=// --domain-needed
>         > --pid-file=/var/run/libvirt/network/default.pid --conf-file=
>         > --except-interface lo --bind-interfaces --listen-address
>         192.168.122.1
>         > --dhcp-range 192.168.122.2,192.168.122.254
>         > --dhcp-leasefile=/var/lib/libvirt/dnsmasq/default.leases
>         > --dhcp-lease-max=253 --dhcp-no-override
>         > --dhcp-hostsfile=/var/lib/libvirt/dnsmasq/default.hostsfile
>         > --addn-hosts=/var/lib/libvirt/dnsmasq/default.addnhosts
>         >
>         >
>         >
>         > As a workaround, I configured a static ip address in the
>         container
>         > like how we configure an ip address to a standard Linux box.
>         However,
>         > I want to know how to config dnsmasq to give static ip
>         address to a
>         > specific container because I may run lots of containers.
>         Appreciate
>         > any response and idea. Thanks!
>         >
>         >
>         > --
>         > Thanks
>         > -Mingjiang
>         >
>         
>         > --
>         > This message has been scanned for viruses and
>         > dangerous content by MailScanner, and is
>         > believed to be clean.
>         > _______________________________________________
>         > lxc-users mailing list
>         > [email protected]
>         > http://lists.linuxcontainers.org/listinfo/lxc-users
>         
>         --
>         
>         Michael H. Warfield (AI4NB) | (770) 978-7061 |
>          [email protected]
>            /\/\|=mhw=|\/\/          | (678) 463-0932 |
>          http://www.wittsend.com/mhw/
>            NIC whois: MHW9          | An optimist believes we live in
>         the best of all
>          PGP Key: 0x674627FF        | possible worlds.  A pessimist is
>         sure of it!
>         
>         
>         _______________________________________________
>         lxc-users mailing list
>         [email protected]
>         http://lists.linuxcontainers.org/listinfo/lxc-users
> 
> 
> 
> 
> -- 
> Thanks
> -Mingjiang
> 
> -- 
> This message has been scanned for viruses and 
> dangerous content by MailScanner, and is 
> believed to be clean. 
> _______________________________________________
> lxc-users mailing list
> [email protected]
> http://lists.linuxcontainers.org/listinfo/lxc-users

-- 
Michael H. Warfield (AI4NB) | (770) 978-7061 |  [email protected]
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
lxc-users mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-users

Reply via email to