1. Install Qemu
$ git clone git://git.qemu-project.org/qemu.git cloning into ' qemu ' ...
Remote:counting objects:131834, done.
Remote:compressing objects:100% (29320/29320), done.
Remote:total 131834 (Delta 104345), reused 129302 (Delta 102090)
Receiving objects:100% (131834/131834), 45.42 MiB | KIB/S, done.
Resolving deltas:100% (104345/104345), done.
Checking out files:100% (2849/2849), done.
$ CD qemu/
$./configure
$ sudo apt-get install libgtk-3-0
$ sudo apt-get install Libsdl1.2-dev
$ make
$ sudo make install
2. Install Ubuntu on QEMU
Qemu-img create-f qcow2 ubuntu.img 8G
Qemu-system-x86_64-enable-kvm-m 1g-hda Ubuntu.img-cdrom/home/chenyu/iso/ubuntu-16.04-desktop-amd64.iso-boot D
3. Enable Nvdimm
DD If=zero of=nvdimm.img bs=1g count=2
/home/chenyu/tool/qemu/bin/qemu-system-x86_64-enable-kvm-machine pc,nvdimm-cpu kvm64-m 1G,maxmem=100G,slots=100- SMP 4-hda Ubuntu.img-object Memory-backend-file,share,id=mem1,mem-path=./nvdimm.img,size=4g-device nvdimm,memdev= Mem1,id=nv1-vnc 192.168.1.4:0-monitor Stdio-netdev type=tap,id=eth0,ifname=tap0,script=no,downscript=no-device pcnet,netdev=eth0,mac=12:03:04:05:06:08
4. Use Vncviewer on Windows to connect to ip:0
5. Besides, you might want to enable the network in QEMU, as we illustrated above, we have already pasted the command
Above, which is Netdev type=tap,id=eth0,ifname=tap0,script=no,downscript=no-device pcnet,netdev=eth0,mac= 12:03:04:05:06:08
Which declare a netdev with type tap, assign it ID with eth0, and it device name is Tap0 (which was created by Tunctl),
and create a guest device of PCnet, its attributes Netdev is the newly created device. With the Mac set with 12:03:04:05:06:08.
ENS3 hwaddr 12:03:04:05:06:08
Above is the ifconfig result after booting into the guest OS. You can-there is no IP of it,
Because actually we haven ' t create any virtual net device or network to the host, let's Do it now:
Need to install virtual Network Tools:
Apt-get Install Uml-utilities
Then you can create the virtual network:
Tunctl-t tap0
Tunctl-t tap0
Set ' tap0 ' persistent and owned by UID 0
Brctl Show Bridge
name Bridge ID STP enabled interfaces
Enable this card
Ifconfig tap0 Promisc up
OK, let's create a bridge to connect host network and newly created virtual net card:
Brctl ADDBR Br0
Brctl Show Bridge
name Bridge ID STP enabled interfaces
br0 8000.000000000000 No
Add tap0 and Host network to the bridge:
Brctl addif br0 tap0
# brctl show Bridge
name Bridge ID STP enabled interfaces
br0 8000.5afa09f95226 No tap0
Add Host:
Brctl addif br0 Enx8cae4cec9a43
But after this command, the host network are down, because the bridge isn't enabled,
You are have to use the following solution:
# ifconfig eth0 0.0.0.0
# ifconfig eth1 0.0.0.0
# brctl ADDBR mybridge
# brctl addif mybridge eth0
# Brctl AddIf Mybridge eth1
# ifconfig Mybridge up
All of the network works now.