Netplan version for lxd containers bridge


(Nik S Firefly) #1

I got some ubuntu 16.04 hosts in Hetzner datacenter network
with working lxd containers but due to migration
I need to recreate 18.04 ubuntu’s netplan config similar to below
Is it possible or is there another solution?
I posted below interfaces and my netplan - not working yet config.

I got 1 main IP for host and additional multiple IP’s for containers
/etc/network/interfaces

auto lo                                                                                                                                                                                                                                      
iface lo inet loopback                                                                                                                                                                                                                       
iface lo inet6 loopback                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
auto  eth0                                                                                                                                                                                                                                   
iface eth0 inet static                                                                                                                                                                                                                       
  address  main-IP                                                                                                                                                                                                                
  netmask   255.255.255.224                                                                                                                                                                                                                  
  gateway   gw-IP                                                                                                                                                                                                                    
  up route add -net 176.9.43.160 netmask 255.255.255.224 gw gw-IP eth0                                                                                                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
auto  br0                                                                                                                                                                                                                                    
iface br0 inet static                                                                                                                                                                                                                        
 address   main-IP                                                                                                                                                                                                                       
 netmask   255.255.255.255                                                                                                                                                                                                                   
 bridge_ports none                                                                                                                                                                                                                           
 bridge_stp off                                                                                                                                                                                                                              
 bridge_fd 0                                                                                                                                                                                                                                 
 bridge_maxwait 0                                                                                                                                                                                                                            
 up route add -host additional-IP dev br0                                                                                                                                                                                                     
 up route add -host additional-IP dev br0       

What is wrong with my netplan config?
host /etc/netplan/01-netcfg.yaml

network:
  version: 2
  renderer: networkd
  ethernets:
    enp0s31f6:
      dhcp4: no
      dhcp6: no
  bridges:
    br0:
      macaddress: 90:1b:0e:e0:d7:f5
      dhcp4: no
      dhcp6: no
      interfaces: [ enp0s31f6 ]
      addresses:
        - main-IP/32
        - 2a01:4f8:13b:2d2c::2/64
      routes:
        - on-link: true
          to: 0.0.0.0/0
          via: gw-IP
      gateway6: fe80::1
      gateway4: gw-IP
      nameservers:
        addresses:
          - 213.133.100.100
          - 213.133.98.98
          - 213.133.99.99
          - 2a01:4f8:0:1::add:9999
          - 2a01:4f8:0:1::add:9898
          - 2a01:4f8:0:1::add:1010
      parameters:
        stp: false
        forward-delay: 1
        hello-time: 2
        max-age: 12

for every container with
/etc/netplan/50-cloud-init.yaml

network:
  version: 2
  ethernets:
    eth0:
      dhcp4: no
      dhcp6: no
      addresses:
        - <additional-IP>/32
      gateway4: <gw-IP>
      nameservers:
        addresses:
          - 213.133.100.100
          - 213.133.98.98
          - 213.133.99.99
          - 2a01:4f8:0:1::add:9999
          - 2a01:4f8:0:1::add:9898
          - 2a01:4f8:0:1::add:1010