2

enter image description hereI have a host (Openstack Newton data center controller) with the following services running on it:

  • Maas-Rack-Controller (bridge DHCP)
  • Cloudify (multi-cloud management POC)
  • Juju (cant bootstrap yet...)

These are running as LXD containers on ZFS. The hardware is an Intel NUC 5i5MYHE blade with an SSD drive. The blade is fed a set of VLAN trunks with the first VLAN untagged. This untagged LVAN is our core data center network. I have a Maas-Region-Controller upstream that communicates to the rack controller and manages it.

MaaS has a DHCP reservation excluding the first 10 IP addresses on this network for these core services, and is set to assign addresses from a DHCP pool to LXD Openstack components on my other blades over the untagged VLAN when they PXE boot to the internal rack controller.

I can easily set the LXD bridge interface IP address to DHCP since I technically do not care about it, but the controller host that all of this lives on needs a static address in the reserved range.

Juju will need a DHCP assignment to be able to complete it's bootstrap process.

I am searching for something like this, although this doesn't work for obvious reasons:

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

iface enp0s25 inet manual
        address 192.168.199.5
        netmask 255.255.255.0
        network 192.168.199.0
        broadcast 192.168.199.255
        gateway 192.168.199.1
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 192.168.199.1 192.168.1.1 8.8.8.8
        dns-search home.spyderdyne.net

auto br0
iface br0 inet dhcp
       bridge-ifaces enp0s25
       bridge-ports enp0s25
       up ifconfig enp0s25 up

Any thoughts on a way to allow DHCP across the bridge with a blade having a static IP and not breaking VLANs are welcome. I am thinking about some sort of sub-interface definition maybe.

Obviously this is not covered anywhere that I can find and probably represents an odd setup, but I am trying to make the most of limited resources and space for this project.

enter image description here

  • I cannot just set the controller (LXD host) to have networking because the MaaS controller can't get out. Alternatively I cannot just make the bridge work thus far so the MaaS controller can reach the region controller because I cannot reach either. I seem to keep finding great things for these to be able to do that are beyond their limits. – spyderdyne Feb 14 '17 at 4:52
  • This document is no longer applicable: insights.ubuntu.com/2016/04/07/lxd-networking-lxdbr0-explained /etc/default/lx* is deprecated. unable to find updated instructions. – spyderdyne Feb 14 '17 at 15:56
0

I figured it out. Here are the steps:

Step 1. Enable DHCP on your network somehow. For this I changed my router from a DHCP forwarder to a DHCP server.

Step 2. Set up a bridge device on the "controller" server with your manual (static) address in /etc/network/interfaces.

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface

auto br0
iface br0 inet static
       address 192.168.199.5
       netmask 255.255.255.0
       gateway 192.168.199.1
       dns-nameservers 192.168.199.2 192.168.199.1 192.168.1.1
       dns-search home.spyderdyne.net
       bridge-ifaces enp0s25        
bridge-ports enp0s25
        up ifconfig enp0s25 up

iface enp0s25 inet manual

Step 3. Record the hardware/MAC address of your new bridge device:

root@rack2-controller0:~# ifconfig br0
br0: flags=4163  mtu 1500
        inet 192.168.199.5  netmask 255.255.255.0  broadcast 192.168.199.255
        inet6 fe80::baae:edff:fe7f:fd70  prefixlen 64  scopeid 0x20
        ether b8:ae:ed:7f:fd:70  txqueuelen 1000  (Ethernet)
        RX packets 315449  bytes 353143957 (353.1 MB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 217291  bytes 16267645 (16.2 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Step 4. Configure your DHCP server to assign that correct static IP address you want to assign to the bridge device:

Other DHCP Server, Static MAC Assignment

Step 5. Install LXD:

root@rack2-controller0:~# lxd init
Name of the storage backend to use (dir or zfs) [default=zfs]: 
Create a new ZFS pool (yes/no) [default=yes]? 
Name of the new ZFS pool [default=lxd]: 
Would you like to use an existing block device (yes/no) [default=no]? yes
Path to the existing block device: /dev/sda2
Would you like LXD to be available over the network (yes/no) [default=no]? yes
Address to bind LXD to (not including port) [default=all]: 
Port to bind LXD to [default=8443]: 
Trust password for new clients: 
Again: 
Would you like stale cached images to be updated automatically (yes/no) [default=yes]? 
Would you like to create a new network bridge (yes/no) [default=yes]? no
LXD has been successfully configured.

Step 6. Edit you default LXD profile network config to include the bridge:

root@rack2-controller0:~# lxc profile edit default

### This is a yaml representation of the profile.
### Any line starting with a '# will be ignored.
###
### A profile consists of a set of configuration items followed by a set of
### devices.
###
### An example would look like:
### name: onenic
### config:
###   raw.lxc: lxc.aa_profile=unconfined
### devices:
###   eth0:
###     nictype: bridged
###     parent: lxdbr0
###     type: nic
###
### Note that the name is shown but cannot be changed

name: default
config: {}
description: Default LXD profile
devices:   
    eth0:
        nictype: bridged
        parent: br0

Step 7. Launch a new container instance:

root@rack2-controller0:~# lxc launch ubuntu:yakkety rack2-maas-rack0
Creating rack2-maas-rack0
Retrieving image: 100%
Starting rack2-maas-rack0
root@rack2-controller0:~# lxc list
+------------------+---------+------+------+------------+-----------+
|       NAME       |  STATE  | IPV4 | IPV6 |    TYPE    | SNAPSHOTS |
+------------------+---------+------+------+------------+-----------+
| rack2-maas-rack0 | RUNNING |      |      | PERSISTENT | 0         |
+------------------+---------+------+------+------------+-----------+

Step 8. Set the new container's network settings to the desired static address:

root@rack2-maas-rack0:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# Source interfaces
# Please check /etc/network/interfaces.d before changing this file
# as interfaces may have been defined in /etc/network/interfaces.d
# See LP: #1262951
#source /etc/network/interfaces.d/*.cfg

auto eth0
iface eth0 inet static
        address 192.168.199.6
        netmask 255.255.255.0
        gateway 192.168.199.1
        dns-nameservers 192.168.199.1 192.168.1.1 8.8.8.8

Step 9. Install maas-rack-controller:

apt install -y maas-rack-controller

Step 10. Add the new Rack controller to your region controller:

root@rack2-maas-rack0:~# maas-rack register --url=http://192.168.199.2/5240/MAAS --secret=e613b300be30450c07a724ac77819aae

Step 11. Wait for the new rack controller to sync with the rest of the region:

Rack Controller Sync

Step 12. Disable DHCP on your OTHER DHCP server:

Prefer MaaS DHCP

Step 13. Configure MaaS DHCP:

MaaS Rack DHCP

Step 14: Add DHCP reservations if needed.

DHCP Pools and Reservations

Step 15. Manually configure hosts by MAC address to set static addresses via DHCP, or at least preserve their addresses from future allocation.

I will have to wait for the new rack controller to finish it''s sync operations before I can tell for sure that rack DHCP is working, but at least I have manual addresses up and running, and should be able to run the DHCP server now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.