sudo apt-get install build-essential openssl libncurses5-dev libssl-dev
sudo apt-get install zlibc minizip libidn11-dev libidn11 bison flex
git clone https://github.com/xianliang66/Linux-DSM.git
cd Linux-DSM
Switch the MACRO definition from USE_KRDMA_NETWORK to USE_KTCP_NETWORK in arch/x86/include/asm/kvm_host.h.
make menuconfigVirtualization --> KVM distributed software memory support --> press 'Y' to include the option
Save --> Exit
make -jNN is the number of threads you'd like to run parallelly.
sudo make modules_install
sudo make install sudo update-grub rebootSelect the newly installed kernel, which should be 4.9.76+.
sudo apt-get install python pkg-config libglib2.0-dev zlib1g-dev libpixman-1-dev libfdt-dev qemu-system-x86
git clone https://github.com/xianliang66/QEMU.git
cd QEMU
./configure --target-list=x86_64-softmmu --enable-kvm make -jN wget http://ftp.sjtu.edu.cn/ubuntu-cd/16.04.7/ubuntu-16.04.7-server-amd64.iso
cd QEMU
./qemu-img create -f qcow2 ubuntu-server.img 10G
qemu-system-x86_64 -m 1024 ubuntu-server.img -cdrom ../ubuntu-16.04.7-server-amd64.iso -enable-kvmWe simulate two machines by running two QEMU processes on a single machine.
First we install vncviewer to monitor the guest.
wget https://www.realvnc.com/download/file/viewer.files/VNC-Viewer-6.19.325-Linux-x64.deb
sudo dpkg -i VNC-Viewer-6.19.325-Linux-x64.debTerminal 1:
sudo x86_64-softmmu/qemu-system-x86_64 --nographic -hda ubuntu-server.img -cpu host -machine kernel-irqchip=off -smp 2 -m 2048 --enable-kvm -serial mon:stdio -local-cpu 1,start=0,iplist="127.0.0.1 127.0.0.1" -vnc :0Terminal 2:
sudo x86_64-softmmu/qemu-system-x86_64 --nographic -hda ubuntu-server.img -cpu host -machine kernel-irqchip=off -smp 2 -m 2048 --enable-kvm -serial mon:stdio -local-cpu 1,start=1,iplist="127.0.0.1 127.0.0.1"Terminal 3:
vncviewer :0By default, QEMU provides an emulated, user mode networking for VMs, which is slow compared with physical network devices.
We could configure a network bridge between the Host and the VM.
- Check network devices
ifconfig
-
Create a bridge
brctl addbr br0 -
Clear IP of
eth0ip addr flush dev eth0 -
Add
eth0to bridgebrctl addif br0 eth0 -
Create tap interface
tunctl -t tap0 -u root -
Add
tap0to bridgebrctl addif br0 tap0 -
Make sure everything is up
ifconfig eth0 up ifconfig tap0 up ifconfig br0 up -
Check if properly bridged
brctl show -
Assign ip to
br0dhclient -v br0
Reference: https://gist.github.com/extremecoders-re/e8fd8a67a515fee0c873dcafc81d811c
Terminal 1:
sudo x86_64-softmmu/qemu-system-x86_64 --nographic -hda ubuntu-server.img -cpu host -machine kernel-irqchip=off -smp 2 -m 2048 --enable-kvm -serial mon:stdio -local-cpu 1,start=0,iplist="127.0.0.1 127.0.0.1" -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01 -vnc :0Terminal 2:
sudo x86_64-softmmu/qemu-system-x86_64 --nographic -hda ubuntu-server.img -cpu host -machine kernel-irqchip=off -smp 2 -m 2048 --enable-kvm -serial mon:stdio -local-cpu 1,start=1,iplist="127.0.0.1 127.0.0.1"Terminal 3:
vncviewer :0Weiye Chen