Close

Setup LXD to obtain local IP on VirtualBox VM

Step 1: Configure VirtualBox VM Network Settings

  1. Stop your VirtualBox guest VM.
  2. Open the Settings for the VM.
  3. Navigate to the Network section.
  4. In Adapter 1 (or an unused adapter tab), ensure the Enable Network Adapter checkbox is selected.
  5. Change the Attached to: dropdown to Bridged Adapter.
  6. In the Name dropdown, select your host machine’s physical network interface (e.g., enp0s3eth0, or the name of your physical Wi-Fi/Ethernet adapter) that is connected to your local network/router.
  7. Click OK to save the settings and start the VM. 
  1. Create a new Netplan configuration file (e.g., 99-lxd-bridge.yaml) in /etc/netplan/.
  2. Edit the file, replacing enp0s3 with your actual guest physical interface name (found using ip addr or ifconfig): 
network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: no
  bridges:
    br0:
      dhcp4: yes
      interfaces:
        - enp3s0
      parameters:
        stp: false

Apply the Netplan configuration with sudo netplan apply (this will briefly disconnect you if using SSH). 

Update the Profiles: “LXD UI > Profiles > default” “yaml” file as below.

name: default
description: Default LXD profile
devices:
  eth0:
    name: eth0
    nictype: bridged
    parent: br0
    type: nic
  root:
    path: /
    pool: default
    type: disk
config: {}
access_entitlements:
  - can_delete
  - can_edit
project: default