Error: Failed to create network 'lxdbr0': Failed to automatically find an unused IPv4 subnet, manual configuration required

LXD init on Ubuntu VM returns following error:
Error: Failed to create network 'lxdbr0': Failed to automatically find an unused IPv4 subnet, manual configuration required

lxc info:

config: {}

  • storage_zfs_remove_snapshots
  • container_host_shutdown_timeout
  • container_stop_priority
  • container_syscall_filtering
  • auth_pki
  • container_last_used_at
  • etag
  • patch
  • usb_devices
  • https_allowed_credentials
  • image_compression_algorithm
  • directory_manipulation
  • container_cpu_time
  • storage_zfs_use_refquota
  • storage_lvm_mount_options
  • network
  • profile_usedby
  • container_push
  • container_exec_recording
  • certificate_update
  • container_exec_signal_handling
  • gpu_devices
  • container_image_properties
  • migration_progress
  • id_map
  • network_firewall_filtering
  • network_routes
  • storage
  • file_delete
  • file_append
  • network_dhcp_expiry
  • storage_lvm_vg_rename
  • storage_lvm_thinpool_rename
  • network_vlan
  • image_create_aliases
  • container_stateless_copy
  • container_only_migration
  • storage_zfs_clone_copy
  • unix_device_rename
  • storage_lvm_use_thinpool
  • storage_rsync_bwlimit
  • network_vxlan_interface
  • storage_btrfs_mount_options
  • entity_description
  • image_force_refresh
  • storage_lvm_lv_resizing
  • id_map_base
  • file_symlinks
  • container_push_target
  • network_vlan_physical
  • storage_images_delete
  • container_edit_metadata
  • container_snapshot_stateful_migration
  • storage_driver_ceph
  • storage_ceph_user_name
  • resource_limits
  • storage_volatile_initial_source
  • storage_ceph_force_osd_reuse
  • storage_block_filesystem_btrfs
  • resources
  • kernel_limits
  • storage_api_volume_rename
  • macaroon_authentication
  • network_sriov
  • console
  • restrict_devlxd
  • migration_pre_copy
  • infiniband
  • maas_network
  • devlxd_events
  • proxy
  • network_dhcp_gateway
  • file_get_symlink
  • network_leases
  • unix_device_hotplug
  • storage_api_local_volume_handling
  • operation_description
  • clustering
  • event_lifecycle
  • storage_api_remote_volume_handling
  • nvidia_runtime
    api_status: stable
    api_version: “1.0”
    auth: trusted
    public: false
  • tls
    addresses: []
    • x86_64
    • i686
      certificate: |
      -----BEGIN CERTIFICATE-----
      -----END CERTIFICATE-----
      certificate_fingerprint: xxxxxxxxxxxxxxxx
      driver: lxc
      driver_version: 3.0.1
      kernel: Linux
      kernel_architecture: x86_64
      kernel_version: 4.4.0-127-generic
      server: lxd
      server_pid: 1815
      server_version: 3.0.1
      storage: “”
      storage_version: “”
      server_clustered: false
      server_name: virtualserver01
1 Like

It happened to me as well the other day on a fresh installation.
Lxd init was not able to figure out the IP for lxdbr0 and gave up. It would be good to figure out the exact details in order to fix in LXD init.

I am on mobile now; you can create manually lxdbr0 with lxc network, the add the interface to the default LXD profile, using lxc profile add…

1 Like

Thanks @simos.

Even with manual create, getting same error.

root@myserver:~# lxc network create lxdbr0
Error: Failed to automatically find an unused IPv4 subnet, manual configuration required

You need to specify the rest of the details manually I think you need to add ipv4.address=

@simos Thanks. That worked. I am still curious why it didn’t work with lxd init.

I am guessing error was because of device name conflict with eth0 (as default) which is already in use (along with eth1), in my case.

Just a thought: if internal subnet and device name to be attached to, can be added as an option for LXD init?


Here is the code that lxd init will use to find a random available IPv4 network,

You can see that it tries with 100 random subnets before it gives up.
For each randomly created network, it checks

  1. If the network is in the routing table
  2. If the network can be pinged

and does that for both IPv4 and IPv6.

Someone can add some print statements in the code to see where it fails (either the random networks are not random, either the check if the network is already in the routing table fails, either the pinging of the subnet has some weird issue and LXD gets replies from anything), either one of IPv4 or IPv6 is not available on the host.

The code that uses these functions is

so if you run lxd init, and press Enter all the way while there is no, for example, IPv6 support, then you get the error because in one of the Enters you select auto for IPv6.

lxd init can also accept a pre-seed file, therefore you can add there the network instead of asking LXD to find one randomly. Or, when you use the wizard lxd init, do not press Enter to accept auto but specify the network there. If, for example, there is no IPv6 support, type none instead.

Therefore, in your case, find the reason why auto fails in LXD init (network subnet configuration) for IPv4 and IPv6, and supply the appropriate values either at lxd init or with a LXD preseed file.

In the worst case, you can select none for the networking and then create the network later and finally add it to the lxd profile. In that way, you can get a nice network.


I suspect the issue you ran into is that you had a route for on your machine, effectively marking the entirety of the RFC1918 space as directly attached.

In such a case, LXD cannot safely find any subnet for you to use, making manual configuration the only safe option. That’s pretty uncommon though as having a netmask is a terrible idea in general since it means you may have up to 16 million devices talking to you directly (with all the possible collisions and needless ARP/broadcast that this would cause).


@stgraber You are correct. I checked network interface (eth0) and it has exact same configuration for the route.

Tried to do so, it worked, but containers attached to such bridge doesn’t see the internet. I can only ping the addresses of host’s enp2s0 from containers.
So adding ipv4.address=w.x.y.z to the lxc network create ... doesn’t really help. Any ideas?

add ipv4.nat=true to network