![虚拟机管理器 - 自动执行重复启动步骤](https://linux22.com/image/206002/%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%AE%A1%E7%90%86%E5%99%A8%20-%20%E8%87%AA%E5%8A%A8%E6%89%A7%E8%A1%8C%E9%87%8D%E5%A4%8D%E5%90%AF%E5%8A%A8%E6%AD%A5%E9%AA%A4.png)
每次启动 Virtual Machine Manager 时,我都必须运行以下命令才能成功运行任何虚拟机:
sudo virsh net-start default
在 Debian 11 桌面上,如何配置 Virtual Machine Manager,以便仅通过启动应用程序即可完成此操作?
答案1
您需要告诉 libvirt,启动 libvirtd 时应自动启动“默认”网络。
sudo virsh net-autostart default
如果“default”尚未启动,您仍然需要最后一次手动启动它,但下次重新启动时,“default”将与 libvirtd 一起自动启动。
仅供参考,virsh
有内置帮助,例如:
# virsh help network
Networking (help keyword 'network'):
net-autostart autostart a network
net-create create a network from an XML file
net-define define an inactive persistent virtual network or modify an existing persistent one from an XML file
net-destroy destroy (stop) a network
net-dhcp-leases print lease info for a given network
net-dumpxml network information in XML
net-edit edit XML configuration for a network
net-event Network Events
net-info network information
net-list list networks
net-name convert a network UUID to network name
net-start start a (previously defined) inactive network
net-undefine undefine a persistent network
net-update update parts of an existing network's configuration
net-uuid convert a network name to network UUID
net-port-list list network ports
net-port-create create a network port from an XML file
net-port-dumpxml network port information in XML
net-port-delete delete the specified network port
# virsh help net-autostart
NAME
net-autostart - autostart a network
SYNOPSIS
net-autostart <network> [--disable]
DESCRIPTION
Configure a network to be automatically started at boot.
OPTIONS
[--network] <string> network name or uuid
--disable disable autostarting