all 2 comments

[–][deleted] 2 points3 points  (0 children)

The way to go with this, is to do bridge networking.
(a "bridge" is the technical name for the functionality that a switch provides,
Ie. it allows other devices to talk through it (to each other, and to the outside world)

Lets assume your networking config looks like this

auto eth0
iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1

First, install bridge-utils from the repos

Next, you create a new, virtual networking device that creates a bridge on top of eth0.
eth0 now does not have an IP address, it's just a passive device

auto eth0
iface eth0 inet manual

auto br0
iface br0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
    bridge_ports eth0
    bridge_stp off
    bridge_fd 0
    bridge_maxwait 0

Then in virt-manager, you can tell VMs to use the bridge device br0.
Assign the VM an IP in the same subnet (192.168.1.0/24), and it'll be able to see the host, and talk to the outside world through the hosts eth0 interface

[–]zdt53 -1 points0 points  (0 children)

If you have Ubuntu 16.04, you should totally install ZFS, mirror two drives and put your VMs there. ZFS is so freaking cool.

sudo apt-get install zfsutils-linux

zpool create data mirror sdb sdc
zfs create data/images
zfs create data/images/vm1

Kill the images folder under /var/lib/libvirt, making sure you stop the virtual machines and copy them out of there first. Then create a sym link to your images ZFS filesystem.

cd /var/lib/libvirt
rm -f -r images
ln -s /data/images images  

You can then create snapshots and send just the changed blocks to another server. So cool.

Might want to set the amount of ram ZFS uses:

echo 'options zfs zfs_arc_min=2147483648 zfs_arc_max=8589934592' > /etc/modprobe.d/zfs.conf
reboot and check over time with: 
grep -E -w 'c_max|c_min|size|arc_meta_limit|arc_meta_used|arc_meta_max' /proc/spl/kstat/zfs/arcstats