|
@@ -0,0 +1,42 @@
|
|
|
+#!/bin/bash
|
|
|
+
|
|
|
+# Install KVM
|
|
|
+apt-get install --no-install-recommends \
|
|
|
+ qemu-system libvirt-clients libvirt-daemon-system ovmf
|
|
|
+
|
|
|
+
|
|
|
+# Remove virbr0 NAT interface created during the kvm installation
|
|
|
+virsh net-destroy default
|
|
|
+virsh net-undefine default
|
|
|
+
|
|
|
+
|
|
|
+# Create network from exisiting host bridge
|
|
|
+cat >/tmp/host-bridge.xml <<EOL
|
|
|
+<network>
|
|
|
+ <name>host-bridge</name>
|
|
|
+ <forward mode="bridge"/>
|
|
|
+ <bridge name="br0"/>
|
|
|
+</network>
|
|
|
+EOL
|
|
|
+virsh net-define host-bridge.xml
|
|
|
+virsh net-autostart host-bridge
|
|
|
+virsh net-start host-bridge
|
|
|
+rm /tmp/host-bridge.xml
|
|
|
+
|
|
|
+
|
|
|
+# Create isolated network (without DHCP)
|
|
|
+cat >/tmp/isolated-bridge.xml <<EOL
|
|
|
+ <network>
|
|
|
+ <name>isolated-bridge</name>
|
|
|
+ <forward mode="bridge"/>
|
|
|
+ <bridge name="br1"/>
|
|
|
+ </network>
|
|
|
+EOL
|
|
|
+virsh net-define isolated-bridge.xml
|
|
|
+virsh net-autostart isolated-bridge
|
|
|
+virsh net-start isolated-bridge
|
|
|
+rm /tmp/isolated-bridge.xml
|
|
|
+
|
|
|
+
|
|
|
+# List networks
|
|
|
+virsh net-list
|