Toastie 1 年間 前
コミット
7aae71254c
1 ファイル変更42 行追加0 行削除
  1. 42 0
      install_kvm.sh

+ 42 - 0
install_kvm.sh

@@ -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