diff --git a/doc/conf.py b/doc/conf.py index 3f6086596..2e06d63d6 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -305,6 +305,7 @@ 'Thumbs.db', '.DS_Store', '.sphinx', + 'reuse', ] exclude_patterns.extend(custom_excludes) diff --git a/doc/multi-nic-vm-host-with-bonds-and-vlans.md b/doc/multi-nic-vm-host-with-bonds-and-vlans.md index b486e9475..76a010ec1 100644 --- a/doc/multi-nic-vm-host-with-bonds-and-vlans.md +++ b/doc/multi-nic-vm-host-with-bonds-and-vlans.md @@ -3,9 +3,9 @@ This guide shows how to configure a virtual machine (VM) host using Netplan and the `virsh` interface. The host in this scenario has four network interface (NICs). The host uses network bonding and three VLAN networks. -## Prerequisites +```{include} reuse/configure-vm-prerequisites.md -Ensure the following prerequisites are satisfied. +``` ### System @@ -35,23 +35,9 @@ Ensure the following prerequisites are satisfied. - Firewall configured; see [UFW](https://help.ubuntu.com/community/UFW). -#### Disable netfilter for bridged interfaces +```{include} reuse/configure-vm-disable-netfilter.md -To allow communication between the host server, its virtual machines, and the devices in the local VLANs, disable netfilter for bridged interfaces: - -1. Add the following lines to the `/etc/systemctl.conf` configuration file: - - ``` - net.bridge.bridge-nf-call-iptables = 0 - net.bridge.bridge-nf-call-ip6tables = 0 - net.bridge.bridge-nf-call-arptables = 0 - ``` - -2. Apply the changes immediately, without rebooting the host. - - ```none - sysctl -p /etc/sysctl.conf - ``` +``` ## Netplan configuration @@ -155,104 +141,16 @@ Configure Netplan: ``` -## Configure virtual networks using `virsh` - -The next step is to configure virtual networks defined for `virsh` domains. This is not necessary, but it makes VM deployment and management easier. - - -### Check networking and delete the default network - -1. Check existing virtual networks: - - ```none - virsh net-list --all - ``` - - There should be one default network as in this example: - - ``` - Name State Autostart Persistent - -------------------------------------------- - default active yes yes - ``` - - If needed, use the `net-info` command to gather more details about the default network: - - ``` - virsh net-info default - ``` - -2. Remove the default network: - - ``` - virsh net-destroy default - virsh net-undefine default - ``` - -3. Check network list to confirm the changes have been applied. There should no networks defined now: - - ```none - virsh net-list --all - ``` - +```{include} reuse/configure-vm-using-virsh.md -### Create bridged networks +``` -1. Create a directory for VM data. For example: - ```none - mkdir /mnt/vmstore/ - cd /mnt/vmstore/ - ``` +```{include} reuse/configure-vm-check-networking-delete-default.md -2. Define the bridge interface, `br0`, for VLAN1 by creating the `/mnt/vmstore/net-br0.xml` file with the following contents: +``` - ```xml - - br0 - - - - ``` - -3. Define the bridge interface, `br0-vlan40`, for VLAN40 by creating the `/mnt/vmstore/net-br0-vlan40.xml` file with the following contents: - - ```xml - - br0-vlan40 - - - - ``` - -4. Define the bridge interface, `br0-vlan41`, for VLAN41 by creating the `/mnt/vmstore/net-br0-vlan41.xml` file with the following contents: - - ```xml - - br0-vlan41 - - - - ``` - -5. Enable the virtual (bridged) networks. This consists of three steps (performed for each of the networks): - - 1. Define the network. - 2. Start the network. - 3. Set the network to autostart. - - ``` - virsh net-define net-br0.xml - virsh net-define net-br0-vlan40.xml - virsh net-define net-br0-vlan41.xml - virsh net-start br0 - virsh net-start br0-vlan40 - virsh net-start br0-vlan41 - virsh net-autostart br0 - virsh net-autostart br0-vlan40 - virsh net-autostart br0-vlan41 - ``` -6. Test the bridged networks. +```{include} reuse/configure-vm-create-bridged-networks.md -Congratulations, the configuration is complete. You can now create a virtual machine, assign the desired network using your preferred VM configuration tool, and run some tests. +``` \ No newline at end of file diff --git a/doc/reuse/configure-vm-check-networking-delete-default.md b/doc/reuse/configure-vm-check-networking-delete-default.md new file mode 100644 index 000000000..ea650bdf1 --- /dev/null +++ b/doc/reuse/configure-vm-check-networking-delete-default.md @@ -0,0 +1,34 @@ +### Check networking and delete the default network + +1. Check existing virtual networks: + + ```none + virsh net-list --all + ``` + + There should be one default network as in this example: + + ``` + Name State Autostart Persistent + -------------------------------------------- + default active yes yes + ``` + + If needed, use the `net-info` command to gather more details about the default network: + + ``` + virsh net-info default + ``` + +2. Remove the default network: + + ``` + virsh net-destroy default + virsh net-undefine default + ``` + +3. Check network list to confirm the changes have been applied. There should no networks defined now: + + ```none + virsh net-list --all + ``` \ No newline at end of file diff --git a/doc/reuse/configure-vm-create-bridged-networks.md b/doc/reuse/configure-vm-create-bridged-networks.md new file mode 100644 index 000000000..70b814d05 --- /dev/null +++ b/doc/reuse/configure-vm-create-bridged-networks.md @@ -0,0 +1,60 @@ +### Create bridged networks + +1. Create a directory for VM data. For example: + + ```none + mkdir /mnt/vmstore/ + cd /mnt/vmstore/ + ``` + +2. Define the bridge interface, `br0`, for VLAN1 by creating the `/mnt/vmstore/net-br0.xml` file with the following contents: + + ```xml + + br0 + + + + ``` + +3. Define the bridge interface, `br0-vlan40`, for VLAN40 by creating the `/mnt/vmstore/net-br0-vlan40.xml` file with the following contents: + + ```xml + + br0-vlan40 + + + + ``` + +4. Define the bridge interface, `br0-vlan41`, for VLAN41 by creating the `/mnt/vmstore/net-br0-vlan41.xml` file with the following contents: + + ```xml + + br0-vlan41 + + + + ``` + +5. Enable the virtual (bridged) networks. This consists of three steps (performed for each of the networks): + + 1. Define the network. + 2. Start the network. + 3. Set the network to autostart. + + ``` + virsh net-define net-br0.xml + virsh net-define net-br0-vlan40.xml + virsh net-define net-br0-vlan41.xml + virsh net-start br0 + virsh net-start br0-vlan40 + virsh net-start br0-vlan41 + virsh net-autostart br0 + virsh net-autostart br0-vlan40 + virsh net-autostart br0-vlan41 + ``` + +6. Test the bridged networks. + +Congratulations, the configuration is complete. You can now create a virtual machine, assign the desired network using your preferred VM configuration tool, and run some tests. \ No newline at end of file diff --git a/doc/reuse/configure-vm-disable-netfilter.md b/doc/reuse/configure-vm-disable-netfilter.md new file mode 100644 index 000000000..a05fc13dd --- /dev/null +++ b/doc/reuse/configure-vm-disable-netfilter.md @@ -0,0 +1,17 @@ +#### Disable netfilter for bridged interfaces + +To allow communication between the host server, its virtual machines, and the devices in the local VLANs, disable netfilter for bridged interfaces: + +1. Add the following lines to the `/etc/systemctl.conf` configuration file: + + ``` + net.bridge.bridge-nf-call-iptables = 0 + net.bridge.bridge-nf-call-ip6tables = 0 + net.bridge.bridge-nf-call-arptables = 0 + ``` + +2. Apply the changes immediately, without rebooting the host. + + ```none + sysctl -p /etc/sysctl.conf + ``` \ No newline at end of file diff --git a/doc/reuse/configure-vm-prerequisites-system.md b/doc/reuse/configure-vm-prerequisites-system.md new file mode 100644 index 000000000..cf3e9d694 --- /dev/null +++ b/doc/reuse/configure-vm-prerequisites-system.md @@ -0,0 +1,6 @@ +### System + +- Computer with a single network interface card (NIC). +- Ubuntu Server installed. +- KVM and QEMU installed; see [KVM installation](https://help.ubuntu.com/community/KVM/Installation). +- Administrator privileges. \ No newline at end of file diff --git a/doc/reuse/configure-vm-prerequisites.md b/doc/reuse/configure-vm-prerequisites.md new file mode 100644 index 000000000..768d45bb6 --- /dev/null +++ b/doc/reuse/configure-vm-prerequisites.md @@ -0,0 +1,3 @@ +## Prerequisites + +Ensure the following prerequisites are satisfied. \ No newline at end of file diff --git a/doc/reuse/configure-vm-using-virsh.md b/doc/reuse/configure-vm-using-virsh.md new file mode 100644 index 000000000..b739ab7ca --- /dev/null +++ b/doc/reuse/configure-vm-using-virsh.md @@ -0,0 +1,3 @@ +## Configure virtual networks using `virsh` + +The next step is to configure virtual networks defined for `virsh` domains. This is not necessary, but it makes VM deployment and management easier. \ No newline at end of file diff --git a/doc/single-nic-vm-host-with-vlans.md b/doc/single-nic-vm-host-with-vlans.md index 0c2143899..b1e4dc643 100644 --- a/doc/single-nic-vm-host-with-vlans.md +++ b/doc/single-nic-vm-host-with-vlans.md @@ -3,18 +3,14 @@ This guide shows how to configure a virtual machine (VM) host using Netplan and the `virsh` interface. The host in this scenario has a single network interface (NIC) and three VLAN networks. -## Prerequisites +```{include} reuse/configure-vm-prerequisites.md -Ensure the following prerequisites are satisfied. +``` -### System - -- Computer with a single network interface card (NIC). -- Ubuntu Server installed. -- KVM and QEMU installed; see [KVM installation](https://help.ubuntu.com/community/KVM/Installation). -- Administrator privileges. +```{include} reuse/configure-vm-prerequisites-system.md +``` ### Networking @@ -33,23 +29,9 @@ Ensure the following prerequisites are satisfied. - Firewall configured; see [UFW](https://help.ubuntu.com/community/UFW). -#### Disable netfilter for bridged interfaces - -To allow communication between the host server, its virtual machines, and the devices in the local VLANs, disable netfilter for bridged interfaces: - -1. Add the following lines to the `/etc/systemctl.conf` configuration file: - - ``` - net.bridge.bridge-nf-call-iptables = 0 - net.bridge.bridge-nf-call-ip6tables = 0 - net.bridge.bridge-nf-call-arptables = 0 - ``` - -2. Apply the changes immediately, without rebooting the host. +```{include} reuse/configure-vm-disable-netfilter.md - ```none - sysctl -p /etc/sysctl.conf - ``` +``` ## Netplan configuration @@ -136,104 +118,16 @@ Configure Netplan: ``` -## Configure virtual networks using `virsh` - -The next step is to configure virtual networks defined for `virsh` domains. This is not necessary, but it makes VM deployment and management easier. - - -### Check networking and delete the default network - -1. Check existing virtual networks: - - ```none - virsh net-list --all - ``` - - There should be one default network as in this example: - - ``` - Name State Autostart Persistent - -------------------------------------------- - default active yes yes - ``` +```{include} reuse/configure-vm-using-virsh.md - If needed, use the `net-info` command to gather more details about the default network: +``` - ``` - virsh net-info default - ``` -2. Remove the default network: +```{include} reuse/configure-vm-check-networking-delete-default.md - ``` - virsh net-destroy default - virsh net-undefine default - ``` +``` -3. Check network list to confirm the changes have been applied. There should no networks defined now: - - ```none - virsh net-list --all - ``` - - -### Create bridged networks - -1. Create a directory for VM data. For example: - - ```none - mkdir /mnt/vmstore/ - cd /mnt/vmstore/ - ``` - -2. Define the bridge interface, `br0`, for VLAN1 by creating the `/mnt/vmstore/net-br0.xml` file with the following contents: - - ```xml - - br0 - - - - ``` - -3. Define the bridge interface, `br0-vlan40`, for VLAN40 by creating the `/mnt/vmstore/net-br0-vlan40.xml` file with the following contents: - - ```xml - - br0-vlan40 - - - - ``` - -4. Define the bridge interface, `br0-vlan41`, for VLAN41 by creating the `/mnt/vmstore/net-br0-vlan41.xml` file with the following contents: - - ```xml - - br0-vlan41 - - - - ``` - -5. Enable the virtual (bridged) networks. This consists of three steps (performed for each of the networks): - - 1. Define the network. - 2. Start the network. - 3. Set the network to autostart. - - ``` - virsh net-define net-br0.xml - virsh net-define net-br0-vlan40.xml - virsh net-define net-br0-vlan41.xml - virsh net-start br0 - virsh net-start br0-vlan40 - virsh net-start br0-vlan41 - virsh net-autostart br0 - virsh net-autostart br0-vlan40 - virsh net-autostart br0-vlan41 - ``` -6. Test the bridged networks. +```{include} reuse/configure-vm-create-bridged-networks.md -Congratulations, the configuration is complete. You can now create a virtual machine, assign the desired network using your preferred VM configuration tool, and run some tests. +``` \ No newline at end of file diff --git a/doc/single-nic-vm-host.md b/doc/single-nic-vm-host.md index 0519b84ac..aca0168f1 100644 --- a/doc/single-nic-vm-host.md +++ b/doc/single-nic-vm-host.md @@ -3,16 +3,14 @@ This guide shows how to configure a virtual-machine host using Netplan and the `virsh` interface. The host in this scenario has a single network interface. -## Prerequisites +```{include} reuse/configure-vm-prerequisites.md -Ensure the following prerequisites are satisfied. +``` -### System -- Computer with a single network interface card (NIC). -- Ubuntu Server installed. -- KVM and QEMU installed; see [KVM installation](https://help.ubuntu.com/community/KVM/Installation). -- Administrator privileges. +```{include} reuse/configure-vm-prerequisites-system.md + +``` ### Networking @@ -28,23 +26,9 @@ Ensure the following prerequisites are satisfied. - Firewall configured; see [UFW](https://help.ubuntu.com/community/UFW). -#### Disable netfilter for bridged interfaces - -To allow communication between the host server, its virtual machines, and the devices in the local VLANs, disable netfilter for bridged interfaces: - -1. Add the following lines to the `/etc/systemctl.conf` configuration file: - - ``` - net.bridge.bridge-nf-call-iptables = 0 - net.bridge.bridge-nf-call-ip6tables = 0 - net.bridge.bridge-nf-call-arptables = 0 - ``` - -2. Apply the changes immediately, without rebooting the host. +```{include} reuse/configure-vm-disable-netfilter.md - ```none - sysctl -p /etc/sysctl.conf - ``` +``` ## Netplan configuration @@ -97,45 +81,14 @@ Configure Netplan: ``` -## Configure virtual networks using `virsh` - -The next step is to configure virtual networks defined for `virsh` domains. This is not necessary, but it makes VM deployment and management easier. - - -### Check networking and delete the default network - -1. Check existing virtual networks: - - ```none - virsh net-list --all - ``` - - There should be one default network as in this example: - - ``` - Name State Autostart Persistent - -------------------------------------------- - default active yes yes - ``` - - If needed, use the `net-info` command to gather more details about the default network: - - ``` - virsh net-info default - ``` +```{include} reuse/configure-vm-using-virsh.md -2. Remove the default network: +``` - ``` - virsh net-destroy default - virsh net-undefine default - ``` -3. Check network list to confirm the changes have been applied. There should no networks defined now: +```{include} reuse/configure-vm-check-networking-delete-default.md - ```none - virsh net-list --all - ``` +``` ### Create bridged networks