Libvirt: Difference between revisions
Add virt-manager hyperlink |
m style fixes |
||
| Line 62: | Line 62: | ||
Create a XML file called <code>virbr0.xml</code> with the definition of the bridge interface. | Create a XML file called <code>virbr0.xml</code> with the definition of the bridge interface. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="xml"> | ||
<network> | <network> | ||
<name>virbr0</name> | <name>virbr0</name> | ||
| Line 72: | Line 72: | ||
Add and enable bridge interface. | Add and enable bridge interface. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
virsh net-define virbr0.xml | # virsh net-define virbr0.xml | ||
virsh net-start virbr0 | # virsh net-start virbr0 | ||
ip link add virbr0 type bridge | # ip link add virbr0 type bridge | ||
ip address ad dev virbr0 10.25.0.1/24 | # ip address ad dev virbr0 10.25.0.1/24 | ||
ip link set dev virbr0 up | # ip link set dev virbr0 up | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Edit the libvirt guest <code>my_guest</code> XML file and add the bridge interface to it. | Edit the libvirt guest <code>my_guest</code> XML file and add the bridge interface to it. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
virsh edit my_guest | $ virsh edit my_guest | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Add: | Add: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="xml"> | ||
<devices> | |||
[...] | |||
<interface type='bridge'> | |||
<mac address='52:54:00:12:34:56'/> | |||
<source bridge='virbr0'/> | |||
<model type='virtio'/> | |||
<address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/> | |||
</interface> | |||
[...] | |||
</devices> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 161: | Line 161: | ||
Shutdown the client, in this example named <code>my_guest</code>, and edit the libvirt XML file. | Shutdown the client, in this example named <code>my_guest</code>, and edit the libvirt XML file. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
virsh edit my_guest | $ virsh edit my_guest | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Add the following snippet after <code><channel type='unix'>[...]</channel></code> part inside the devices subsection: | Add the following snippet after <code><channel type='unix'>[...]</channel></code> part inside the devices subsection: | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="xml"> | ||
<channel type='spiceport'> | |||
<source channel='org.spice-space.webdav.0'/> | |||
<target type='virtio' name='org.spice-space.webdav.0'/> | |||
<address type='virtio-serial' controller='0' bus='0' port='3'/> | |||
</channel> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 183: | Line 183: | ||
List available shares for the guest. | List available shares for the guest. | ||
<syntaxhighlight lang=" | <syntaxhighlight lang="console"> | ||
curl localhost:9843 | $ curl localhost:9843 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 231: | Line 231: | ||
}; | }; | ||
} | } | ||
</syntaxhighlight>Note that after you added the configuration and switch, you'll have the following command to setup the hooks.<syntaxhighlight lang=" | </syntaxhighlight>Note that after you added the configuration and switch, you'll have the following command to setup the hooks.<syntaxhighlight lang="console"> | ||
systemctl start libvirtd-config.service | $ systemctl start libvirtd-config.service | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 248: | Line 248: | ||
Following are notes regarding the use of some of those tools | Following are notes regarding the use of some of those tools | ||
==== error: cannot find any suitable libguestfs supermin ==== | ==== error: cannot find any suitable libguestfs supermin ==== | ||
| Line 316: | Line 314: | ||
Also, I use letsencrypt dns mode to get https cert and key. Nginx i nixos can get the certs on its own. Since I use the same certs also for other things, I just put them in the root (/) folder. Use what is best for you. | Also, I use letsencrypt dns mode to get https cert and key. Nginx i nixos can get the certs on its own. Since I use the same certs also for other things, I just put them in the root (/) folder. Use what is best for you. | ||
==== Get EyeOS Spice Web Client ==== | ==== Get EyeOS Spice Web Client ==== | ||