Difference between revisions of "KVM"

From HyperSecurity Wiki
Jump to: navigation, search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 +
== Installation Guides ==
 +
*[https://www.howtoforge.com/virtualization-with-kvm-on-a-debian-squeeze-server Debian 7/8 ]
 +
*[https://www.cyberciti.biz/faq/install-kvm-server-debian-linux-9-headless-server/ Debian 9]
 +
 +
== Example of /etc/network/interfaces ==
 +
# This file describes the network interfaces available on your system
 +
# and how to activate them. For more information, see interfaces(5).
 +
 +
source /etc/network/interfaces.d/*
 +
 +
# The loopback network interface
 +
auto lo
 +
iface lo inet loopback
 +
 +
# The primary network interface
 +
auto eth0
 +
iface eth0 inet manual
 +
 +
# Management IP Address
 +
auto br0
 +
iface br0 inet static
 +
        address 192.168.1.2
 +
        netmask 255.255.255.0
 +
        network 192.168.1.0
 +
        broadcast 192.168.1.255
 +
        gateway 192.168.1.1
 +
        bridge_ports eth0
 +
        bridge_fd 9
 +
        bridge_hello 2
 +
        bridge_maxage 12
 +
        bridge_stp off
 +
        dns-nameservers 8.8.8.8
 +
        dns-search ggeng.triumf.ca
 +
 +
# Unused
 +
auto br1
 +
iface br1 inet static
 +
        address 0.0.0.0
 +
        bridge_ports eth1
 +
        bridge_fd 9
 +
        bridge_hello 2
 +
        bridge_maxage 12
 +
        bridge_stp off
 +
 +
Restart the network:
 +
systemctl restart network
 +
 +
== Manually adding bridges ==
 +
 +
Create a bridge that is not listed in /etc/network/interfaces
 +
brctl addbr br1
 +
 +
Assign Ethernet to bridge:
 +
brctl addif br1 eth1
 +
 +
Confirm bridge is listed and working:
 +
brctl show
 +
 +
== Virsh Commands ==
 
List all VM:
 
List all VM:
 
  virsh -c qemu:///system list
 
  virsh -c qemu:///system list

Latest revision as of 22:10, 22 March 2019

Installation Guides

Example of /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet manual

# Management IP Address
auto br0
iface br0 inet static
       address 192.168.1.2
       netmask 255.255.255.0
       network 192.168.1.0
       broadcast 192.168.1.255
       gateway 192.168.1.1
       bridge_ports eth0
       bridge_fd 9
       bridge_hello 2
       bridge_maxage 12
       bridge_stp off
       dns-nameservers 8.8.8.8
       dns-search ggeng.triumf.ca

# Unused
auto br1
iface br1 inet static
       address 0.0.0.0
       bridge_ports eth1
       bridge_fd 9
       bridge_hello 2
       bridge_maxage 12
       bridge_stp off

Restart the network:

systemctl restart network

Manually adding bridges

Create a bridge that is not listed in /etc/network/interfaces

brctl addbr br1

Assign Ethernet to bridge:

brctl addif br1 eth1

Confirm bridge is listed and working:

brctl show

Virsh Commands

List all VM:

virsh -c qemu:///system list

Auto Start:

virsh autostart vmName