Giter VIP home page Giter VIP logo

illumos-kvm-cmd's Introduction

  ___  _____ __  __ _   _
 / _ \| ____|  \/  | | | |
| | | |  _| | |\/| | | | |
| |_| | |___| |  | | |_| |
 \__\_\_____|_|  |_|\___/

For full documentation on all the various options for QEMU please see the html docs.

BUILDING

Preparing:

Edit build.sh and change the --kerneldir option to point to the directory of the kvm repository and change the --prefix option to whatever you want.

$ ./build.sh
$ make install

USING

Follow the qemu documentation for all of the various options available. The rest of this will be examples and specific pieces about how to use things with a VNIC and a ZVOL. The following is a sample configuration for qemu running a Linux VM.

$ /smartdc/bin/qemu-system-x86_64 \
    -enable-kvm \
    -nographic \
    -drive file=smartdc.iso,media=cdrom,if=ide \
    -boot order=cd \
    -smp 4 \
    -m 1024 \
    -vnc 0.0.0.0:0 \
    -net nic,vlan=0,name=net0,model=virtio,macaddr=90:b8:d0:c0:ff:ee\
    -net vnic,vlan=0,name=net0,ifname=eth0,macaddr=90:b8:d0:c0:ff:ee,\
         ip=10.88.88.50,netmask=255.255.255.0,gateway_ip=10.88.88.2,\
         server_ip=10.88.88.200,dns_ip0=8.8.4.4,dns_ip1=8.8.4.4,\
     hostname=host1,lease_time=3600 \
    -no-hpet \
    -chardev socket,id=serial0,path=/tmp/vm.console,server,nowait \
    -serial chardev:serial0 \
    -drive file=/dev/zvol/rdsk/zones/rec-8,if=virtio,index=0

ZVOLs

It is highly desirable to be able to give a virtual machine a zvol to use as a disk. This is accomplished via the -drive option. Simply pass the block device that corresponds to the zvol.

To create a zvol use a command similar to:

$ zfs create -V 10g tank/vm-hdd

VNICs

We have added an option to have a virtual machine's network interface card directly correspond to a Crossbow vnic on the system. The -net vnic has several mandatory arguments:

  • vlan must be specified and correspond to a single -net nic line
  • name must be specified and correspond to a single -net nic line
  • macaddr must be specified if the MAC Address of the VNIC does not match the MAC address on the -net nic line.
  • ifname must be specified and correspond to the name of the crossbow vnic.

To set up the crossbow vnic, simply create it. There is no need to plumb it. The device will be opened up in promiscuous mode.

To create a vnic you'll want something akin to:

$ dladm create-vnic -l e1000g0 vnic0

The -net vnic option also supports configuring networking on the virtual machine via dhcp. In this mode, qemu acts as a DHCP server for the virtual machine. To enable vnic dhcp, specify the following arguments:

  • ip (eg: 192.168.0.2) must be specified in order to enable dhcp
  • netmask (eg: 255.255.255.0) must be specified
  • gateway_ip (eg: 192.168.0.1) must be specified
  • server_ip (eg: 192.168.0.3) is optional. This allows specifying the IP address of qemu's DHCP server.
  • dns_ip (eg: 8.8.4.4) is optional, and allows specifying the DNS server the virtual machine will use. The default value is 8.8.8.8.
  • dns_ip0, dns_ip1, dns_ip2, and dns_ip3 are optional, and allow specifying a list of DNS servers, rather than just one. These options override the dns_ip option.
  • hostname (eg: myhostname) is optional. This defaults to no hostname.
  • lease_time (eg: 3600) is optional, and allows specifying the DHCP lease time in seconds. The default value is 86400 (or 1 day).

The following is a sample -net vnic line for running with DHCP:

-net vnic,vlan=0,name=net0,ifname=eth0,macaddr=90:b8:d0:c0:ff:ee, \
    ip=10.88.88.50,netmask=255.255.255.0,gateway_ip=10.88.88.2, \
    server_ip=10.88.88.200,dns_ip=8.8.4.4,hostname=host1,lease_time=3600

illumos-kvm-cmd's People

Contributors

bcantrill avatar gongleiarei avatar jasonbking avatar jclulow avatar johnsonnenschein avatar joshwilsdon avatar melloc avatar pfmooney avatar pmatouse avatar rmustacc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.