[lxc-users] Static container IP with unmanaged bridge network
Daniele Riccucci
devster at posteo.net
Sat Feb 9 17:41:20 UTC 2019
Hello,
I'm using LXD on Ubuntu 18.04 (snap installation).
I'd like to set a static IP on a bridged interface which is not managed
by LXD.
Below the configs I have:
$ lxc profile show my-test-config
config: {}
devices:
eth0:
name: eth0
nictype: bridged
parent: br0
type: nic
root:
path: /
pool: default
type: disk
name: my-test-config
And the netplan config for the host machine:
$ cat /etc/netplan/netplan.yml
# Let networkd manage all devices on this system
network:
version: 2
renderer: networkd
ethernets:
id0:
match: {name: "eno[1-2]"}
dhcp4: true
wakeonlan: true
switchports:
match: {name: "eno[3-4]"}
bonds:
bond0:
interfaces: [switchports]
# dhcp4: true
dhcp4: false
parameters:
mode: 802.3ad
bridges:
br0:
interfaces: [bond0]
dhcp4: true
+---------+----------+---------+-------------+---------+
| NAME | TYPE | MANAGED | DESCRIPTION | USED BY |
+---------+----------+---------+-------------+---------+
| bond0 | bond | NO | | 0 |
+---------+----------+---------+-------------+---------+
| br0 | bridge | NO | | 0 |
+---------+----------+---------+-------------+---------+
| docker0 | bridge | NO | | 0 |
+---------+----------+---------+-------------+---------+
| eno1 | physical | NO | | 0 |
+---------+----------+---------+-------------+---------+
| eno2 | physical | NO | | 0 |
+---------+----------+---------+-------------+---------+
| eno3 | physical | NO | | 0 |
+---------+----------+---------+-------------+---------+
| eno4 | physical | NO | | 0 |
+---------+----------+---------+-------------+---------+
| lxdbr0 | bridge | YES | | 0 |
+---------+----------+---------+-------------+---------+
This brings up a container with a DHCP address on eth0, visible by the
network thanks to the bridge over the bonded interface.
+-------------+---------+------------------------------+------------+
| NAME | STATE | IPV4 | TYPE |
+-------------+---------+------------------------------+------------+
| bionic-test | RUNNING | 10.0.0.181 (eth0) | PERSISTENT |
+-------------+---------+------------------------------+------------+
I'm having a bit of a hard time figuring out from the documentation if
adding ipv4.address to devices > eth0 in the profile would work and if
this requires a simple IP or a CIDR.
Is this setup possible since the bridge device isn't managed by LXD?
Thank you.
More information about the lxc-users
mailing list