How to get addresses to be visible from virtual-machines

How would I go ahead and make IP-addresses visible by lxd for a virtual-machine (which is an applicance) ?

 lxc list boundless-assistance: --project networking
+---------------+---------+------+------+-----------------+-----------+
|     NAME      |  STATE  | IPV4 | IPV6 |      TYPE       | SNAPSHOTS |
+---------------+---------+------+------+-----------------+-----------+
| aloha-site1-a | RUNNING |      |      | VIRTUAL-MACHINE | 0         |
+---------------+---------+------+------+-----------------+-----------+

As seen above, the address isn’t visible. The machine has static IP.

You need to run the lxd-agent, which is exported to the guest via a 9p and virtiofs shared called config.

@sdeziel1 do you have an example of how to run lxd-agent installation from the config drive?

To manually install the agent, you can do:

modprobe 9pnet_virtio
mount -t 9p config /mnt -o access=0,transport=virtio || mount -t virtiofs config /mnt
cd /mnt
./install.sh
cd /
umount /mnt
reboot

After that, the LXD agent should work and let you see the VM IPs or even execute commands inside of it with lxc exec aloha-site1-a -- bash.

We have similar instructions in our doc at https://documentation.ubuntu.com/lxd/en/latest/howto/instances_create/#create-a-vm-that-boots-from-an-iso but they are not complete so I’ll fix them to match the above snippet.

@erik-lonroth if it doesn’t work, please let us know!

2 Likes

I’ll try. Thanx for the information, very useful!