[lxc-users] Centos: how to specify static ip address to container

Mingjiang Shi mrjewes at gmail.com
Thu Feb 13 08:23:46 UTC 2014


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.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140213/a80ea7f5/attachment.html>


More information about the lxc-users mailing list