...
Code Block | ||||
---|---|---|---|---|
| ||||
root@dilos:~# zfs create -V 16Gb rpool/kvm0 |
Code Block | ||||
---|---|---|---|---|
| ||||
root@dilos:~# dladm create-vnic -I vmxnet3s1 vnic1 #Directly connected interface
root@dilos:~# dladm create-vnic -v 300 -I vmxnet3s2 vnic2 #Interface in VLAN300 on TRUNK link
root@dilos:~# vndadm create vnic1 #create vSwitch on vnic1 (mgmt link)
root@dilos:~# vndadm create vnic2 #create vSwitch on vnic2 (data link) |
We are ready to run nested VM in QEMU with /KVM virtual machine
Code Block | ||||
---|---|---|---|---|
| ||||
root@dilos:~# /smartdc/bin/qemu-system-x86_64 -enable-kvm -smp 2 -m 2048 -boot order=dc \ \ -drive file=/dev/zvol/rdsk/rpool/kvm0kvm1,if=virtio,index=0,media=disk,boot=on,id=disk0 \ -drive file=/root/dilos-2.0.1.22.iso,media=cdrom,if=ide,index=1 \ -bios /smartdc/share/qemu/extboot.bin \ -vnc 0.0.0.0:0,password -monitor stdio \ -device virtio-net-pci,netdev=n1,mac=02:08:20:80:8e:d3 -netdev user,id=n1,net=192.168.11.0/24,tx=timer,x-txtimer=200000,x-txburst=128,vlan=1 \ -net vnic,vlan=1,name=net1,ifname=vnic1 \ -device virtio-net-pci,mac=02:08:20:78:6f:55,tx=timer,x-txtimer=200000,x-txburst=128,vlan=2 \ -net vnic,vlan=2,name=net2,ifname=vnic2 \ -boot order=cd \ -drive file=/root/dilos-2.0.1.22.iso,media=cdrom,if=ide,index=1 -boot order=cd |
Where:
-enable-kvm - instruct to use KVM hypervisor module
...
-drive file=/dev/zvol/rdsk/rpool/kvm0kvm1,if=virtio,index=0,media=disk,boot=on,id=disk0 - paramenters parameters for the hdd device where quest OS will be installed
...
-vnc 0.0.0.0:0,password -monitor stdio - description of VNC console for accessing this virtual machine: listen on all network interfaces, port 6080.
-device virtio-net-pci,netdev=n1,mac=02:08:20:80:8e:d3,tx=timer,x-txtimer=200000,x-txburst=128,vlan=1 - instruct KVM to use viertio virtio paravirtual driver for network card and , set - up described port parameters and configure MAC address for ethernet port for the first interface
-netdev user,id=n1,net=192.168.11.0/24 - indicates the network net vnic,vlan=1,name=net1,ifname=vnic1 - indicates VLAN to be provided to this VM . Network bridge will be automatically created to provide the conenctivity to external resources.and though which interface
(assume similar description of networking for vnic2)
Code Block | ||||
---|---|---|---|---|
| ||||
qemu-system-x86_64: -net vnic,vlan=1,name=net1,ifname=vnic1: vnic dhcp disabled qemu-system-x86_64: -net vnic,vlan=2,name=net2,ifname=vnic2: vnic dhcp disabled QEMU 0.14.1 monitor - type 'help' for more information (qemu) Start bios (version 0.6.1.2-20110201_165504-titi) Ram Size=0x80000000 (0x0000000000000000 high) CPU Mhz=26132607 PCI: pci_bios_init_bus_rec bus = 0x0 PIIX3/PIIX4 init: elcr=00 0c PCI: bus=0 devfn=0x00: vendor_id=0x8086 device_id=0x1237 PCI: bus=0 devfn=0x08: vendor_id=0x8086 device_id=0x7000 PCI: bus=0 devfn=0x09: vendor_id=0x8086 device_id=0x7010 region 4: 0x0000c000 PCI: bus=0 devfn=0x0b: vendor_id=0x8086 device_id=0x7113 PCI: bus=0 devfn=0x10: vendor_id=0x1013 device_id=0x00b8 region 0: 0xf0000000 region 1: 0xf2000000 region 6: 0xf2010000 PCI: bus=0 devfn=0x18: vendor_id=0x1af4 device_id=0x1000 region 0: 0x0000c020 region 1: 0xf2020000 region 6: 0xf2040000 PCI: bus=0 devfn=0x20: vendor_id=0x1af4 device_id=0x10010x1000 region 0: 0x0000c040 region 1: 0xf2060000 region 6: 0xf2080000 PCI: bus=0 devfn=0x28: vendor_id=0x1af4 device_id=0x1001 region 0: 0x0000c080 region 1: 0xf20a0000 Found 2 cpu(s) max supported 2 cpu(s) MP table addr=0x000fdbe0 MPC table addr=0x000fdbf0 size=252 SMBIOS ptr=0x000fdbc0 table=0x7ffffec0 ACPI tables: RSDP=0x000fdb90 RSDT=0x7fffdbd0 Scan for VGA option rom Running option rom at c000:0003 VGABios $Id$ Turning on vga text mode console SeaBIOS (version 0.6.1.2-20110201_165504-titi) Found 1 lpt ports Found 1 serial ports ATA controller 0 at 1f0/3f4/0 (irq 14 dev 9) ATA controller 1 at 170/374/0 (irq 15 dev 9) found virtio-blk at 0:45 ebda moved from 9fc00 to 9dc00 drive 0x000fdb40: PCHS=16383/16/63 translation=lba LCHS=1024/255/63 s=33554432 ata0-1: QEMU DVD-ROM ATAPI-4 DVD/CD ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD PS2 keyboard initialized All threads complete. Scan for option roms Running option rom at c900:0003 pmm call arg1=1 pmm call arg1=0 pmm call arg1=1 pmm call arg1=0 Running option rom at ca00:0003 pmm call arg1=1 pmm call arg1=1 Running option rom at cb00:0003 Returned 53248 bytes of ZoneHigh e820 map has 7 items: 0: 0000000000000000 - 000000000009dc00 = 1 1: 000000000009dc00 - 00000000000a0000 = 2 2: 00000000000f0000 - 0000000000100000 = 2 3: 0000000000100000 - 000000007fffd000 = 1 4: 000000007fffd000 - 0000000080000000 = 2 5: 00000000feffc000 - 00000000ff000000 = 2 6: 00000000fffc0000 - 0000000100000000 = 2 enter handle_19: NULL Booting from Hard Disk... Boot failed: not a bootable disk enter handle_18: NULL Booting from DVD/CD... 264MB medium detected Booting from 0000:7c00 |
Virtual machine is running. To access QEMU monitor press enter in console and set up the VNC password
...
Open your favourite browser and connect to VM's console through noVNC service by URL https://YOUR_HOST:6080/vnc.html:
You have configured and run virtual machine using qemu kvm! Proceed with further OS installation procedure.
When you at step of configuration the network interface, choose the DHCP as a method of getting IP address. Manual setup of IP addresses and enter appropriate values
Note that we use paravirtualized driver (vioif0/1) which have been configured when have started the machine.inside virtual machine.
Repeat configuration procedure for second network interface (data link) and proceed with installation .
When installation is compleated completed and VM can boot from virtual HDD, we can put cd-rom device out of command line to simplefy simplify the command . For accessing newly created VM from outside network use embedded ipforwarding feature as on example below:
Code Block | ||||
---|---|---|---|---|
| ||||
root@dilos:~# smb-/smartdc/bin/qemu-system-x86_64 -enable-kvm -smp 2 -m 2048 \ -drive file=/dev/zvol/rdsk/rpool/kvm0kvm1,if=virtio,index=0,media=disk,boot=on,id=disk0 \ -bios /smartdc/share/qemu/extboot.bin \ -vnc 0.0.0.0:0,password -monitor stdio \ -device virtio-net-pci,netdev=n1,mac=02:08:20:80:8e:d3,tx=timer,x-txtimer=200000,x-txburst=128,vlan=1 \ -netdev user,id=n1,net=192.168.11.0/24,hostfwd=tcp:127.0.0.1:2222-:22 |
Where:
hostfwd=tcp:127.0.0.1:2222-:22 - configure that port endpoint 127.0.0.1:2222 on the host will be forwarded to port 22 in the guest VM.
Code Block | ||||
---|---|---|---|---|
| ||||
root@dilos:~# ssh root@localhost -p 2222 Password: root@dilos-guest:~#net vnic,vlan=1,name=net1,ifname=vnic1 \ -device virtio-net-pci,mac=02:08:20:78:6f:55,tx=timer,x-txtimer=200000,x-txburst=128,vlan=2 \ -net vnic,vlan=2,name=net2,ifname=vnic2 |
Code Block | ||||
---|---|---|---|---|
| ||||
(qemu) info network Devices not on any VLAN: n1: net=192.168.11.0, restricted=n peerVLAN 1 devices: net1: ifname=vnic1 virtio-net-pci.0: model=virtio-net-pci.0,macaddr=02:08:20:80:8e:d3 VLAN 2 devices: net2: ifname=vnic2 virtio-net-pci.01: model=virtio-net-pci,macaddr=02:08:20:8078:8e:d3 peer=n16f:55 Devices not on any VLAN: (qemu) system_powerdown (qemu) |
...