123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #!/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 /tmp/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 /tmp/isolated-bridge.xml
- virsh net-autostart isolated-bridge
- virsh net-start isolated-bridge
- rm /tmp/isolated-bridge.xml
- # List networks
- virsh net-list
|