DaemonForums  

Go Back   DaemonForums > Miscellaneous > Guides

Guides All Guides and HOWTO's.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 3rd December 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,335
Thanked 182 Times in 149 Posts
Default Create OpenBSD guest for Linux KVM (Kernel-based Virtual Machine) with 'virt-install'

Create OpenBSD guest for Linux KVM (Kernel-based Virtual Machine) with 'virt-install'

After playing with the Virtual Manager GUI, I concluded that it is nice, but that a command line approach suited me better. From the virt-install(1) man page:
Quote:
virt-install is a command line tool for creating new KVM, Xen, or Linux container guests using the "libvirt" hypervisor management library. See the EXAMPLES section at the end of this document to quickly get started.

virt-install tool supports graphical installations using (for example) VNC or SPICE, as well as text mode installs over serial console. The guest can be configured to use one or more virtual disks, network interfaces, audio devices, physical USB or PCI devices, among others.

The installation media can be held locally or remotely on NFS, HTTP, FTP servers. In the latter case "virt-install" will fetch the minimal files necessary to kick off the installation process, allowing the guest to fetch the rest of the OS distribution as needed. PXE booting, and importing an existing disk image (thus skipping the install phase) are also supported.

Given suitable command line arguments, "virt-install" is capable of running completely unattended, with the guest 'kickstarting' itself too. This allows for easy automation of guest installs. An interactive mode is also available with the --prompt option, but this will only ask for the minimum required options.
Initially I used a shell script, but switched to a Makefile approach. The first part defines some variables to allow easy customization

Code:
# - Makefile to create OpenBSD guest VM with serial console and second disk
# - for '/usr/ports'

# - DOMAIN name is also used as disk image file ....

DOMAIN  	= OBSD-x3
IMAGEDIR	= /var/lib/libvirt/images
IMAGEFILE 	= ${IMAGEDIR}/${DOMAIN}.img
DEBUG   	= --dry-run
DEBUG   =
The first Makefile target is 'create':
Code:
create  :
        virt-install \
        --connect=qemu:///system \
        --name="${DOMAIN}" \
        --ram=2048 \
        --vcpus=2 \
        --description 'OpenBSD virt-install with serial' \
        --os-type=unix \
        --os-variant=openbsd4 \
        --cdrom=http://hercules.utp.xnet/snapshots/amd64 \
        --disk path=${IMAGEFILE},size=8,bus=virtio \
        --disk path=${IMAGEDIR}/${DOMAIN}_ports,size=8,bus=virtio \
        --network bridge=br0,model=virtio \
        --graphics vnc \
        --serial dev,path=/dev/ttyS0 \
        ${DEBUG}
An explanation of the options, where the quotes are from the virt-install(1) man page :
  • --connect=qemu:///system

    Although not strictly needed for KVM, I put it there because the --connect option allows you to use for example Xen
    with xen:///.
  • --name="${DOMAIN}"

    Quote:
    Name of the new guest virtual machine instance. This must be unique amongst all guests known to the hypervisor on the connection, including those not currently active. To re-define an existing guest, use the virsh(1) tool to shut it down ('virsh shutdown') & delete ('virsh undefine') it prior to running "virt-install".
  • --ram=2048
    Quote:
    Memory to allocate for guest instance in megabytes. If the hypervisor does not have enough free memory, it is usual for it to automatically take memory away from the host operating system to satisfy this allocation.
  • --vcpus=2
    Quote:
    Number of virtual cpus to configure for the guest. If 'maxvcpus' is specified, the guest will be able to hotplug up to MAX vcpus while the guest is running, but will startup with VCPUS.

    CPU topology can additionally be specified with sockets, cores, and threads. If values are omitted, the rest will be autofilled preferring sockets over cores over threads.
  • --description 'OpenBSD virt-install with serial'
    Quote:
    Human readable text description of the virtual machine. This will be stored in the guests XML configuration for access by other applications.
  • --os-type=unix
    Quote:
    Optimize the guest configuration for a type of operating system (ex. 'linux', 'windows'). This will attempt to pick the most suitable ACPI & APIC settings, optimally supported mouse drivers, virtio, and generally accommodate other operating system quirks.

    By default, virt-install will attempt to auto detect this value from the install media (currently only supported for URL installs). Autodetection can be disabled with the special value 'none'
  • --os-variant=openbsd4
    Quote:
    Further optimize the guest configuration for a specific operating system variant (ex. 'fedora8', 'winxp'). This parameter is optional, and does not require an "--os-type" to be specified.

    By default, virt-install will attempt to auto detect this value from the install media (currently only supported for URL installs). Autodetection can be disabled with the special value 'none'.

    If the special value 'list' is passed, virt-install will print the full list of variant values and exit. The printed format is not a stable interface, DO NOT PARSE IT.

    If the special value 'none' is passed, no os variant is recorded and OS autodetection is disabled.
    A sample of the these variants:
    Code:
    # virt-install --os-variant=list
    ...
    win2k3               : Microsoft Windows Server 2003
    openbsd4             : OpenBSD 4.x
    freebsd8             : FreeBSD 8.x
    freebsd7             : FreeBSD 7.x
    freebsd6             : FreeBSD 6.x
    solaris9             : Sun Solaris 9
    solaris10            : Sun Solaris 10
    opensolaris          : Sun OpenSolaris
    ...
  • --cdrom=http://hercules.utp.xnet/snapshots/amd64
    Quote:
    File or device use as a virtual CD-ROM device for fully virtualized guests. It can be path to an ISO image, or to a CDROM device. It can also be a URL from which to fetch/access a minimal boot ISO image. The URLs take the same format as described for the "--location" argument. If a cdrom has been specified via the "--disk" option, and neither "--cdrom" nor any other install option is specified, the "--disk" cdrom is used as the install media.

    -l LOCATION, --location=LOCATION
    Distribution tree installation source. virt-install can recognize certain distribution trees and fetches a bootable kernel/initrd pair to launch the install.

    With libvirt 0.9.4 or later, network URL installs work for remote connections. virt-install will download kernel/initrd to the local machine, and then upload the media to the remote host. This option requires the URL to be accessible by both the local and remote host.
    This gave me quite some trouble because the OpenBSD ftp/http layout, that I copied to my local webserver 'hercules', is not recognized. The nginx access log illustrates what is attempted:
    Code:
    # cut -d ' ' -f '6-'  nginx-log.txt
    
    "HEAD /snapshots/amd64/.treeinfo HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/Fedora HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/Server HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/Client HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/RedHat HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/CentOS HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/SL HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/directory.yast HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/current/images/MANIFEST HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/daily/MANIFEST HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/current/images/MANIFEST HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/install/netboot/version.info HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/initrd.gz HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/VERSION HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/VERSION HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/boot/platform/i86xpv/kernel/unix HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/platform/i86xpv/kernel/unix HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/STARTUP/XNLOADER.SYS HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/images/pxeboot/vmlinuz HTTP/1.1" 404 0 "-" "Python-urllib/2.7"
    "HEAD /snapshots/amd64/images/boot.iso HTTP/1.1" 200 0 "-" "Python-urllib/2.7"
    "GET /snapshots/amd64/images/boot.iso HTTP/1.1" 200 7710720 "-" "urlgrabber/3.9.1"
    As you can see some very Linux specific boot file configurations are probed.
    The work around was to create a sub-directory images and within this directory a boot.iso link to the OpenBSD cd56.iso

    Code:
    /home/www/snapshots/amd64/images:
    lrwxr-xr-x  1 root  wheel  34 Dec  1 17:54 boot.iso -> /home/www/snapshots/amd64/cd56.iso
    My kvm-image.sh script to automate this boring task:
    Code:
    #!/bin/sh
    
    # create proper directory for virt-install
    
    ARCH=amd64
    ISO=cd56.iso
    
    WEB_DIR="/home/www/snapshots/${ARCH}"
    
    mkdir -p ${WEB_DIR}/images
    ln -s ${WEB_DIR}/${ISO} ${WEB_DIR}/images/boot.iso
    
    ls -lR ${WEB_DIR}
    ls -nT ${WEB_DIR} > ${WEB_DIR}/index.txt
  • --disk path=${IMAGEFILE},size=8,bus=virtio
    --disk path=${IMAGEDIR}/ports,size=8,bus=virtio

    Quote:
    --disk=DISKOPTS

    Specifies media to use as storage for the guest, with various options. The general format of a disk string is

    --disk opt1=val1,opt2=val2,...

    To specify media, the command can either be:

    --disk /some/storage/path,opt1=val1

    or explicitly specify one of the following arguments:

    path
    A path to some storage media to use, existing or not. Existing media can be a file or block device. If installing on a remote host, the existing media must be shared as a libvirt storage volume.

    Specifying a non-existent path implies attempting to create the new storage, and will require specifying a 'size' value. If the base directory of the path is a libvirt storage pool on the host, the new storage will be created as a libvirt storage volume. For remote hosts, the base directory is required to be a storage pool if using this method.

    bus
    Disk bus type. Value can be 'ide', 'sata', 'scsi', 'usb', 'virtio' or 'xen'. The default is hypervisor dependent since not all hypervisors support all bus types.
  • --network bridge=br0,model=virtio
    Quote:

    -w NETWORK, --network=NETWORK,opt1=val1,opt2=val2
    Connect the guest to the host network. The value for "NETWORK" can take one
    of 3 formats:

    bridge=BRIDGE

    Connect to a bridge device in the host called "BRIDGE". Use this option if the host has static networking config & the guest requires full outbound and inbound connectivity to/from the LAN. Also use this if live migration will be used with this guest.

    network=NAME

    Connect to a virtual network in the host called "NAME". Virtual networks can be listed, created, deleted using the "virsh" command line tool. In an unmodified install of "libvirt" there is usually a virtual network with a name of "default". Use a virtual network if the host has dynamic networking (eg NetworkManager), or using wireless. The guest will be NATed to the LAN by whichever connection is active.

    [snip]

    Other available options are:

    model

    Network device model as seen by the guest. Value can be any nic model supported by the hypervisor, e.g.: 'e1000', 'rtl8139', 'virtio', ...

    mac

    Fixed MAC address for the guest; If this parameter is omitted, or the value "RANDOM" is specified a suitable address will be randomly generated. For Xen virtual machines it is required that the first 3 pairs in the MAC address be the sequence '00:16:3e', while for QEMU or KVM virtual machines it must be '52:54:00'.
    The mac option is useful to assign a fixed IP address/hostname through a DHCPD configuration file entry like:
    Code:
            host static-client {
                    hardware ethernet  a0:1d:48:97:5b:74 ;
                    #fixed-address ml310e.utp.xnet ;
                    fixed-address 192.168.222.222 ;
            }
  • --graphics vnc
    Quote:
    Specifies the graphical display configuration. This does not configure any virtual hardware, just how the guest's graphical display can be accessed. Typically the user does not need to specify this option, virt-install will try and choose a useful default, and launch a suitable connection.

    vnc

    Setup a virtual console in the guest and export it as a VNC server in the host. Unless the "port" parameter is also provided, the VNC server will run on the first free port number at 5900 or above. The actual VNC display allocated can be obtained using the "vncdisplay" command to "virsh" (or virt-viewer(1) can be used which handles this detail for the use).
  • --serial dev,path=/dev/ttyS0

    Quote:
    Host device. For serial devices, this could be /dev/ttyS0. For parallel devices, this could be /dev/parport0.
    This is the option that allows the KVM guest (OpenBSD) to use the serial port of the KVM host (Linux Mint). I use a HP Proliant, which like most real servers still features a serial port. By connecting a serial cable from my OpenBSD workstation to the Proliant, I can use tip(1) to capture output during the install. Or login. Or provide trace output in case of a crash.
  • --dry-run

    Quote:
    Proceed through the guest creation process, but do NOT create storage devices, change host device configuration, or actually teach libvirt about the guest. virt-install may still fetch install media, since this is required to properly detect the OS to install.
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 7th December 2014 at 11:57 PM. Reason: Added 'bus=virtio" to "--disk" options.
Reply With Quote
  #2   (View Single Post)  
Old 3rd December 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,335
Thanked 182 Times in 149 Posts
Default

The remainder of the Makefile:
Code:
lsimg   :      
        ls -ltr ${IMAGEDIR}

list    :
        virsh list --all

start   :
        virsh start ${DOMAIN} 

shutdown:
        virsh shutdown ${DOMAIN}

undefine:
        virsh undefine ${DOMAIN} 
        rm -rf ${IMAGEFILE} 

info:
        virsh dominfo ${DOMAIN}

dumpxml:
        virsh dumpxml ${DOMAIN}

sysinfo:
        virsh sysinfo

version:
        libvirtd --version
        virsh --version
        virt-install --version
        virt-xml-validate --version
        virt-clone --version
        virt-manager --version
        #virt-top --version
        #virt-df --version
Some examples of using it:
Code:
# make
virt-install \
        --prompt \
        --connect=qemu:///system \
        --name="OBSD-x3" \
        --ram=2048 \
        --vcpus=2 \
        --description 'OpenBSD virt-install with serial' \
        --os-type=unix \
        --os-variant=openbsd4 \
        --cdrom=http://hercules.utp.xnet/snapshots/amd64 \
        --disk path=/var/lib/libvirt/images/OBSD-x3.img,size=8 \
        --disk path=/var/lib/libvirt/images/OBSD-x3_ports,size=8 \
        --network bridge=br0,model=virtio \
        --graphics vnc \
        --serial dev,path=/dev/ttyS0 \
        

Starting install...
Retrieving file boot.iso...                              |  15 MB     00:00 ... 
Allocating 'OBSD-x3.img'                                 | 8.0 GB     00:00     
Allocating 'OBSD-x3_ports'                               | 8.0 GB     00:00     
Creating domain...                                       |    0 B     00:00

Code:
# make lsimg
ls -ltr /var/lib/libvirt/images
total 106381868
-rw------- 1 root root  8589971456 nov  7 05:11 FreeBSD-amd64-9.3-clone.img
-rw------- 1 root root  8589934592 nov 12 01:18 FreeBSD-amd64-9.3.img
-rw------- 1 root root  8589934592 nov 12 07:52 NetBSD-6.1.5.img
-rw------- 1 root root 17179869184 nov 16 02:32 OpenBSD-current-nov15.img
-rw------- 1 root root 10737418239 nov 22 02:20 OpenBSD56-current.img
-rw------- 1 root root  8589934592 nov 22 04:24 OpenBSD-current-nov-3.img
-rw------- 1 root root 21474836480 nov 25 04:42 FreeBSD-10.1-release.img
-rw------- 1 root root 16106127360 nov 26 22:21 OpenBSD-release-5.6.img
-rw------- 1 root root 21474836480 dec  1 18:14 OpenBSD-test.img
-rw------- 1 root root  4294967296 dec  1 18:54 OpenBSD-current-nov11.img
-rw------- 1 root root  8589934592 dec  1 23:22 ports
-rw------- 1 root root  8589934592 dec  1 23:22 OBSD-x2
-rw------- 1 root root  8589934592 dec  2 09:41 OBSD-x3_ports
-rw------- 1 root root  8589934592 dec  2 09:41 OBSD-x3.img
Code:
# make list
virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     FreeBSD-10.1-release           shut off
 -     FreeBSD-amd64-9.3              shut off
 -     FreeBSD-amd64-9.3-clone        shut off
 -     NetBSD-6.1.5                   shut off
 -     OBSD-x3                        shut off
 -     OBSD56-ports-current           shut off
 -     OpenBSD-5.6-openvpn            shut off
 -     OpenBSD-current-nov-3          shut off
 -     OpenBSD-current-nov11          shut off
 -     OpenBSD-current-nov15          shut off
 -     OpenBSD-release-5.6            shut off
 -     OpenBSD56-release-patched      shut off
Code:
# make info
virsh dominfo OBSD-x3
Id:             -
Name:           OBSD-x3
UUID:           652aa7a7-7449-f682-b3a4-361269166339
OS Type:        hvm
State:          shut off
CPU(s):         2
Max memory:     2097152 KiB
Used memory:    2097152 KiB
Persistent:     yes
Autostart:      disable
Managed save:   no
Security model: none
Security DOI:   0
Code:
# make dumpxml
virsh dumpxml OBSD-x3

<domain type='kvm'>
  <name>OBSD-x3</name>
  <uuid>652aa7a7-7449-f682-b3a4-361269166339</uuid>
  <description>OpenBSD virt-install with serial</description>
  <memory unit='KiB'>2097152</memory>
  <currentMemory unit='KiB'>2097152</currentMemory>
  <vcpu placement='static'>2</vcpu>
  <os>
    <type arch='x86_64' machine='pc-i440fx-trusty'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <pae/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/OBSD-x3.img'/>
      <target dev='hda' bus='ide'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
[snip]
    <interface type='bridge'>
      <mac address='52:54:00:60:44:b8'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
    </interface>
    <serial type='dev'>
      <source path='/dev/ttyS0'/>
      <target port='0'/>
    </serial>
    <console type='dev'>
      <source path='/dev/ttyS0'/>
      <target type='serial' port='0'/>
    </console>
[snip]
You also can edit this XML definition and use it to create a new guest, as explained in virsh(1):
Code:
  virsh dumpxml <domain> > domain.xml
  vi domain.xml 
  virsh create domain.xml
Code:
# make sysinfo
virsh sysinfo
<sysinfo type='smbios'>
  <bios>
    <entry name='vendor'>HP</entry>
    <entry name='version'>P78</entry>
    <entry name='date'>09/01/2013</entry>
  </bios>
  <system>
    <entry name='manufacturer'>HP</entry>
    <entry name='product'>ProLiant ML310e Gen8 v2</entry>
    <entry name='version'>Not Specified</entry>
    <entry name='serial'>CZ140400EP      </entry>
    <entry name='uuid'>31343237-3036-5A43-3134-303430304550</entry>
    <entry name='sku'>724160-425      </entry>
    <entry name='family'>ProLiant</entry>
  </system>
  <processor>
    <entry name='socket_destination'>Proc 1</entry>
    <entry name='type'>Central Processor</entry>
    <entry name='family'>Xeon</entry>
    <entry name='manufacturer'>Intel</entry>
    <entry name='signature'>Type 0, Family 6, Model 60, Stepping 3</entry>
    <entry name='version'>Intel(R) Xeon(R) CPU E3-1220 v3 @ 3.10GHz</entry>
    <entry name='external_clock'>100 MHz</entry>
    <entry name='max_speed'>4800 MHz</entry>
    <entry name='status'>Populated, Enabled</entry>
    <entry name='serial_number'>Not Specified</entry>
    <entry name='part_number'>Not Specified</entry>
  </processor>
  <memory_device>
    <entry name='size'>4096 MB</entry>
    <entry name='form_factor'>DIMM</entry>
    <entry name='locator'>PROC  1 DIMM  2</entry>
    <entry name='bank_locator'>Not Specified</entry>
    <entry name='type'>DDR3</entry>
    <entry name='type_detail'>Synchronous Unbuffered (Unregistered)</entry>
    <entry name='speed'>1333 MHz</entry>
    <entry name='manufacturer'>HP</entry>
    <entry name='serial_number'>Not Specified</entry>
    <entry name='part_number'>647657-071</entry>
  </memory_device>
</sysinfo>
Code:
# make version
libvirtd --version
libvirtd (libvirt) 1.2.2
virsh --version
1.2.2
virt-install --version
0.600.4
virt-xml-validate --version
/usr/bin/virt-xml-validate (libvirt) 1.2.2
virt-clone --version
0.600.4
virt-manager --version
0.9.5
#virt-top --version
#virt-df --version
Code:
# make DOMAIN=OpenBSD-5.6-openvpn start
virsh start OpenBSD-5.6-openvpn 
Domain OpenBSD-5.6-openvpn started

# make list
virsh list --all
 Id    Name                           State
----------------------------------------------------
 2     OpenBSD-5.6-openvpn            running
 -     FreeBSD-10.1-release           shut off
 -     FreeBSD-amd64-9.3              shut off
...
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 3rd December 2014 at 04:20 AM.
Reply With Quote
  #3   (View Single Post)  
Old 3rd December 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,335
Thanked 182 Times in 149 Posts
Default

The Makefile for downloading.
Added a second version where with bus=virtio added to the --disk option.
Now we get virtualized sd disks instead of the old IDE wd ones:
Code:
# df -h                                                      
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/sd0a      129M   52.4M   70.0M    43%    /
/dev/sd0k      1.4G   15.3M    1.3G     1%    /home
/dev/sd0d      198M    8.0K    188M     0%    /tmp
/dev/sd0f      935M    363M    526M    41%    /usr
/dev/sd0g      534M    191M    316M    38%    /usr/X11R6
/dev/sd0h      2.1G   44.9M    1.9G     2%    /usr/local
/dev/sd0j      1.3G    2.0K    1.2G     0%    /usr/obj
/dev/sd0i      1.0G    2.0K    974M     0%    /usr/src
/dev/sd0e      209M    4.7M    193M     2%    /var
Attached Files
File Type: txt Makefile.txt (1.4 KB, 11 views)
File Type: txt Makefile-virtio-bus.txt (1.4 KB, 7 views)
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 5th December 2014 at 11:55 PM. Reason: Added Makefile with virtio disks
Reply With Quote
  #4   (View Single Post)  
Old 3rd December 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,335
Thanked 182 Times in 149 Posts
Default

RESERVED
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 3rd December 2014 at 05:30 AM.
Reply With Quote
  #5   (View Single Post)  
Old 11th December 2014
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 3,335
Thanked 182 Times in 149 Posts
Default

The create target for PXE or network booting an OpenBSD install. It sets the boot order to:
  1. hard disk
  2. network
Also new is defining the MAC address of the network interface. For QEMU this has to start with 52:54:00.

Code:
create  :
        virt-install \
        --prompt \
        --connect=qemu:///system \
        --name="${DOMAIN}" \
        --ram=2048 \
        --vcpus=2 \
        --description 'OpenBSD virt-install with serial' \
        --os-type=unix \
        --os-variant=openbsd4 \
        --boot hd,network \
        --disk path=${IMAGEFILE},size=4,bus=virtio \
        --disk path=${IMAGEDIR}/${DOMAIN}_ports,size=8,bus=virtio \
        --network bridge=br0,mac=52:54:00:aa:aa:01,model=virtio \
        --graphics vnc \
        --serial dev,path=/dev/ttyS0 \
        ${DEBUG}
In order to PXE boot and to give this VM a fixed IP address I used this entry in /etc/dhcpd.conf:
Code:
        host pxe-client {
                hardware ethernet  52:54:00:aa:aa:01 ;
                fixed-address 192.168.222.230;
                filename "pxeboot";
                next-server 192.168.222.20;
        }
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply

Tags
kvm, makefile, openbsd virtualization, virsh, virt-install, virtualization

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Researchers create stealth virtual machine that can run alongside insecure VMs J65nko News 0 8th October 2011 12:56 PM
FreeNAS 0.7.2 adds virtual machine guest support J65nko News 1 16th June 2011 02:10 PM
Remote OpenBSD ssh-based install problems artix OpenBSD Installation and Upgrading 7 13th March 2009 08:52 PM
Networking on virtual machine satimis General software and network 4 29th November 2008 02:16 PM
USB support in virtual machine? Sunnz OpenBSD Packages and Ports 2 16th November 2008 04:00 AM


All times are GMT. The time now is 09:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick