[lxc-users] LXD assigning static IP's at start tp containers
Kevin LaTona
lists at studiosola.com
Sat May 16 16:56:04 UTC 2015
Hi Mark,
I was thinking that by just updating the /etc/default/lxc-net config file from the 10.x.x.x to a 192.168.x.x that was going to do it for me.
It's not.
Some where else I am missing a spot that must be saying that the 10.0.x.x is the dnsmasq address.
As of right now at boot up the lxcbr0 is not loading in a base ubuntu 15.04 server install.
So I am still looking for that config setting to do that for me now rather than trying other methods.
Maybe someone else will adding in here to say where to find this blocking point.
Have to say a big thanks for showing how you used grep to grab the config file kv pairs.
Pretty cool use of grep….. I like how simple it is and it just works in this case.
Grep for me is another one of those never ending tools that one never fully recalls all the ways it can be used to grab some text.
-Kevin
On May 16, 2015, at 12:30 AM, Mark Constable <markc at renta.net> wrote:
> On Fri, 15 May 2015 10:54:08 PM Kevin LaTona wrote:
>> I was reading about ways in legacy LXC of being able to have the DHCP server
>> assign static IP's to containers at startup based upon container name.
>> If one is using Ubuntu 15.04, systemd and LXD is that still possible?
>
> Hey Kevin, I just set something like this up and although this may not
> be "the right way" to do it works for my situation which sounds somewhat
> similar to what you are after. Best I should show my relevant config
> files and some of this may help you or provide some ideas...
>
> My main gateway/wireless/dhcp router is 192.168.0.1
>
> ~ grep -Ev "^(#|$)" /etc/default/lxc-net
> USE_LXC_BRIDGE="true"
> LXC_BRIDGE="lxcbr0"
> LXC_ADDR="192.168.0.2"
> LXC_NETMASK="255.255.255.0"
> LXC_NETWORK="192.168.0.0/24"
> LXC_DHCP_RANGE="192.168.0.2,192.168.0.54"
> LXC_DHCP_MAX="53"
> LXC_DHCP_CONFILE=/etc/lxc/dnsmasq.conf
> LXC_DOMAIN="example.org"
>
> And the magic to fill in the gaps above...
>
> ~ cat /etc/rc.local
> sleep 5 && {
> brctl addif lxcbr0 eth0
> sleep 1
> route add default gw 192.168.0.1
> echo "nameserver 8.8.8.8" > /etc/resolv.conf
> }
> exit 0
>
> ~ cat /etc/lxc/dnsmasq.conf
> dhcp-host=sysadm,192.168.0.3
> dhcp-host=markc,192.168.0.4
>
>
> I also remove ifupdown and resolvconf and set all my NetworkManager
> interfaces not to "autoconnect=false" so if I need to switch to wifi
> when moving my laptop away from an eth cable I can ifconfig down lxcbr0
> select a wifi connection.
>
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
More information about the lxc-users
mailing list