Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-19 Thread Matt Green
I've been effectively building a network interfaces file and pushing it to
the container.
I posted my script here:
https://www.reddit.com/r/homelab/comments/50s7jz/lxd_automation_script/

I'm in the process of moving my build scripts to python, but that shell
script worked.

Matt

On 19 October 2016 at 20:22, Caleb Everett  wrote:

> https://github.com/lxc/lxd/issues/2050
>
> On Wed, Oct 19, 2016 at 4:37 AM, Nicola Volpini 
> wrote:
>
>> Hello
>> > ATM what I do is either use dnsmasq to provide DHCP or stop the
>> > container and push a preconfigured interfaces file...
>> >
>> > lxc file push interfaces.tmp CONTAINER/etc/network/interfaces
>> Same approach we are using, but with Ansible as our
>> "bootstrapper/configurer".
>>
>> I've been successfully able to do the following:
>>
>> 1. generate instance-specific config in the form of a cloud-init file
>> 2. create container
>> 3. take down network on the container by running lxc exec ... ifdown -a
>> 4. generate the container's nw config file on the LXD host via ansible
>> and push it to the container via "lxc push" (and remove the default
>> configs if necessary)
>> 5. bring up network on the container by running lxc exec ... ifup -a
>>
>> The cloud-init config is used to inject the ssh key, setup the ssh
>> daemon+config and create an ansible-remote user. That user is necessary
>> for ansible to do later more complex configs by directly accessing the
>> container over ssh, as you would do for a normal ansible host.
>>
>> Something cleaner would be cool, possibly integrated in cloud-init itself.
>>
>> I guess this is somehow possible by creating your custom images and
>> customizing the templates section of the metadata.yaml file, as outlined
>> in the last part of this article
>> https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/
>>
>> CONFIDENTIALITY NOTICE: This email message (and any attachment) is
>> intended only for the individual or entity to which it is addressed. The
>> information in this email is confidential and may contain information that
>> is legally privileged or exempt from disclosure under applicable law. If
>> you are not the intended recipient, you are strictly prohibited from
>> reading, using, publishing or disseminating such information and upon
>> receipt, must permanently delete the original and destroy any copies. We
>> take steps to protect against viruses and other defects but advise you to
>> carry out your own checks and precautions as Kambi does not accept any
>> liability for any which remain. Thank you for your co-operation.
>> ___
>> lxc-users mailing list
>> lxc-users@lists.linuxcontainers.org
>> http://lists.linuxcontainers.org/listinfo/lxc-users
>>
>
>
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-19 Thread Caleb Everett
https://github.com/lxc/lxd/issues/2050

On Wed, Oct 19, 2016 at 4:37 AM, Nicola Volpini 
wrote:

> Hello
> > ATM what I do is either use dnsmasq to provide DHCP or stop the
> > container and push a preconfigured interfaces file...
> >
> > lxc file push interfaces.tmp CONTAINER/etc/network/interfaces
> Same approach we are using, but with Ansible as our
> "bootstrapper/configurer".
>
> I've been successfully able to do the following:
>
> 1. generate instance-specific config in the form of a cloud-init file
> 2. create container
> 3. take down network on the container by running lxc exec ... ifdown -a
> 4. generate the container's nw config file on the LXD host via ansible
> and push it to the container via "lxc push" (and remove the default
> configs if necessary)
> 5. bring up network on the container by running lxc exec ... ifup -a
>
> The cloud-init config is used to inject the ssh key, setup the ssh
> daemon+config and create an ansible-remote user. That user is necessary
> for ansible to do later more complex configs by directly accessing the
> container over ssh, as you would do for a normal ansible host.
>
> Something cleaner would be cool, possibly integrated in cloud-init itself.
>
> I guess this is somehow possible by creating your custom images and
> customizing the templates section of the metadata.yaml file, as outlined
> in the last part of this article
> https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/
>
> CONFIDENTIALITY NOTICE: This email message (and any attachment) is
> intended only for the individual or entity to which it is addressed. The
> information in this email is confidential and may contain information that
> is legally privileged or exempt from disclosure under applicable law. If
> you are not the intended recipient, you are strictly prohibited from
> reading, using, publishing or disseminating such information and upon
> receipt, must permanently delete the original and destroy any copies. We
> take steps to protect against viruses and other defects but advise you to
> carry out your own checks and precautions as Kambi does not accept any
> liability for any which remain. Thank you for your co-operation.
> ___
> lxc-users mailing list
> lxc-users@lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users
>
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-19 Thread Nicola Volpini
Hello
> ATM what I do is either use dnsmasq to provide DHCP or stop the
> container and push a preconfigured interfaces file...
>
> lxc file push interfaces.tmp CONTAINER/etc/network/interfaces
Same approach we are using, but with Ansible as our
"bootstrapper/configurer".

I've been successfully able to do the following:

1. generate instance-specific config in the form of a cloud-init file
2. create container
3. take down network on the container by running lxc exec ... ifdown -a
4. generate the container's nw config file on the LXD host via ansible
and push it to the container via "lxc push" (and remove the default
configs if necessary)
5. bring up network on the container by running lxc exec ... ifup -a

The cloud-init config is used to inject the ssh key, setup the ssh
daemon+config and create an ansible-remote user. That user is necessary
for ansible to do later more complex configs by directly accessing the
container over ssh, as you would do for a normal ansible host.

Something cleaner would be cool, possibly integrated in cloud-init itself.

I guess this is somehow possible by creating your custom images and
customizing the templates section of the metadata.yaml file, as outlined
in the last part of this article
https://www.stgraber.org/2016/03/30/lxd-2-0-image-management-512/

CONFIDENTIALITY NOTICE: This email message (and any attachment) is intended 
only for the individual or entity to which it is addressed. The information in 
this email is confidential and may contain information that is legally 
privileged or exempt from disclosure under applicable law. If you are not the 
intended recipient, you are strictly prohibited from reading, using, publishing 
or disseminating such information and upon receipt, must permanently delete the 
original and destroy any copies. We take steps to protect against viruses and 
other defects but advise you to carry out your own checks and precautions as 
Kambi does not accept any liability for any which remain. Thank you for your 
co-operation.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-18 Thread Mark Constable
On 19/10/16 07:10, David Favor wrote:
> I'd prefer the "tweak each container config" approach.
> Be great if someone could provide a URL for an example.

Very hard to impossible to find examples of using lxc config to set
the IP of each container and I'm still not sure it's even possible.

Can anyone confirm this, and if so, provide an example?

ATM what I do is either use dnsmasq to provide DHCP or stop the
container and push a preconfigured interfaces file...

lxc file push interfaces.tmp CONTAINER/etc/network/interfaces

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-18 Thread David Favor

Mark Constable wrote:

On 19/10/16 05:02, David Favor wrote:
Looking for best way to change 10.87.167.115 to 144.217.33.224 
(static/public IP). Prefer doing this in a way where communication

between host/container + container/container works without adding
iptables rules, which become complex to manage with many containers.


The simplest way I am aware of is to set up your own bridge on a public
IP range that you want to allocate and provide your own DHCP server that
you have control over, or use lxc config to tweak the config of each
container to provide it with a static IP as you go.


I'd prefer the "tweak each container config" approach.

Be great if someone could provide a URL for an example.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

Re: [lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-18 Thread Mark Constable
On 19/10/16 05:02, David Favor wrote:
> Looking for best way to change 10.87.167.115 to 144.217.33.224 
> (static/public IP). Prefer doing this in a way where communication
> between host/container + container/container works without adding
> iptables rules, which become complex to manage with many containers.

The simplest way I am aware of is to set up your own bridge on a public
IP range that you want to allocate and provide your own DHCP server that
you have control over, or use lxc config to tweak the config of each
container to provide it with a static IP as you go.

___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users

[lxc-users] Looking for LXD-2.4.1 Static IP Setup Documentation

2016-10-18 Thread David Favor

Many conflicting suggestions. Looking for documentation for how to
accomplish the following.

My project consists of migrating 100s of LXC containers to LXD,
where each container has a static/public IP.
___

Environment + example test container...

net12 # lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 16.10
Release:16.10
Codename:   yakkety

net12 # lxd --version
2.4.1

net12 # lxc list
+--+-+--+---++---+
|   NAME   |  STATE  | IPV4 | IPV6  
|TYPE| SNAPSHOTS |
+--+-+--+---++---+
| yakkety-template | RUNNING | 10.87.167.115 (eth0) | 
fd42:1ad8:ce37:1b12:216:3eff:fe86:c4d4 (eth0) | PERSISTENT | 0 |
+--+-+--+---++---+
___

Looking for best way to change 10.87.167.115 to 144.217.33.224 (static/public 
IP).

Prefer doing this in a way where communication between host/container + 
container/container
works without adding iptables rules, which become complex to manage with many 
containers.

Thanks.
___
lxc-users mailing list
lxc-users@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users