Difference between pages "Sip.conf" and "Creating VMs"

From Wikislax
(Difference between pages)
Jump to: navigation, search
(Created page with "{{RightTOC}} == sip.conf content == The '''sip.conf''' file contains a '''[general]''' context consisting of global SIP parameters and a separate context for each SIP provid...")
 
(Creating a PV VM)
 
Line 1: Line 1:
 
{{RightTOC}}
 
{{RightTOC}}
  
== sip.conf content ==
+
== the xl tool ==
  
The '''sip.conf''' file contains a '''[general]''' context consisting of global SIP parameters and a separate context for each SIP provider or user. For a complete explanation of the parameters in the [general] context, refer to file '''sip.conf''' itself, which includes very detailed comments. A SIP provider might be configured as :
+
There is a variety of tools and commands to handle virtual machines. Here we will use the Xen '''xl''' command.
  
[general]
+
* '''xl create ''file''''' affords creating a virtual machine based on the configuration in file ''file''. A one-starting sequential domain id is created.
. . .
 
register => 0925325502:mysecret@freephonie.net
 
 
[free]
 
type=peer
 
context=freephonie
 
host=freephonie.net
 
fromuser=0925325502
 
username=0925325502
 
secret=mysecret
 
insecure=invite,port
 
dtmfmode=inband
 
disallow=all
 
allow=alaw
 
  
* '''register''' is to register as a SIP user agent to a SIP proxy (provider).
+
* '''xl destroy ''domid''''' affords destroying a virtual machine with domain id ''domid''. Of course using the system in the VM will be a preferred method to terminate.
* '''context''' is the context to use for incoming calls in ''extensions.conf''.
 
* '''host''' is the fully qualified domain name to connect to.
 
* '''fromuser''' is the username with which to authenticate.
 
* '''username''' is the username with which to attempt contact before it has registered with you.
 
* '''secret''' is the password for the username.
 
* '''insecure'''= invite,port is to not require authentication on the incoming INVITE for the peer.
 
* '''dtmfmode'''=inband is an option to recognize the keypresses from your SIP provider.
 
* '''disallow''' and '''allow''' afford defining which codecs can be used on this link.
 
  
A SIP phone might be configured as :
+
* '''xl help''' affords getting more information on other xm commands.
  
[xlite]
+
Xen supports paravirtualisation and hardware virtualization. Both can be used at the same time on a single Xen system.
type=friend
 
context=internal
 
host=dynamic
 
secret=0987654321
 
  
* '''context''' is the context to use for incoming calls in ''extensions.conf''.
+
== Creating a PV VM ==
* '''host'''=dynamic as device authenticates by name/password rather than by IP.
 
* '''secret''' is the password for the username.
 
  
== Download ==
+
* in paravirtualization (PV) guest operating systems are modified so they are able to interlock with Xen without emulation or virtual emulated hardware. Xen PV guest kernels exist for Linux, NetBSD, FreeBSD, OpenSolaris and Novell Netware. Upstream kernel.org Linux kernels since Linux 2.6.24 include Xen PV guest (domU) support based on the Linux pvops framework, so every upstream Linux kernel can be automatically used as Xen PV guest kernel without any additional patches or modifications.
  
Please find here a real [{{SERVER}}/slax/download/sip.conf sip.conf] file example. No users are configured in this file, though as they will be using LDAP, see next page.
+
Paravirtualization requires storing the kernel to boot in the dom0 filesystem, and populating the system in a virtual partition. The kernel generated must be able to manage [http://wiki.qemu.org/download/qemu-doc.html#QEMU-PC-System-emulator the QEMU devices] and include the .config file [http://wiki.xen.org/wiki/Mainline_Linux_Kernel_Configs#Configuring_the_kernel domU options]. Here is a minimal example of such a [{{SERVER}}/wikislax/download/config-domU .config domU] file. The swap partition and VM filesystem can be created as below. Don't forget to update the root device in fstab :
 +
 
 +
# dd if=/dev/zero of=pv-sl12.swap bs=1024k count=1024
 +
# mkswap pv-sl12.swap
 +
# dd if=/dev/zero of=pv-sl12.img bs=1024k count=8192
 +
# mkfs -t ext3 pv-sl12.img
 +
# mkdir /tmp/loop
 +
# mount -o loop pv-sl12.img /tmp/loop
 +
# cp -ax /mnt/sl12/{0,bin,boot,etc,home,initrd*,lib,lib32,lib64,media,mnt,opt,root,run,sbin,srv,sys,usr,var,vmlinuz*} /tmp/loop
 +
# mkdir /tmp/loop/{dev,proc,tmp}
 +
# chmod 777 /tmp/loop/tmp
 +
# vi /tmp/loop/etc/fstab
 +
# umount /tmp/loop
 +
 
 +
Then a PV config file needs to be created. Samples are available from the /etc/xen directory. Here is an [{{SERVER}}/wikislax/download/sl12 example] running in a X window for slackware 12.1 (32 bits). The main config options to modify are :
 +
 
 +
# Kernel image file in dom0 filesystem
 +
kernel = "/boot/vmlinuz-3.4.2-domU"
 +
# Not using any optional ramdisk
 +
#ramdisk = "/boot/initrd.gz"
 +
# Initial memory allocation (in megabytes) for the new domain.
 +
memory = 2048
 +
# A name for the new domain. All domains have to have different names,
 +
name = "sl12"
 +
# Number of virtual CPUs
 +
vcpus = 2
 +
# Define network interfaces
 +
vif = [ ' ' ]
 +
# Define disk devices. Note the device names xvda and xvdb
 +
disk = [ 'file:/mnt/xen/sl12.img,xvda1,w', 'file:/mnt/xen/sl12.swap,xvdb,w' ]
 +
# Define frame buffer device. Use sdl to view virtual machine in a window
 +
vfb = [ 'sdl=1' ]
 +
# Set root device.
 +
root = "/dev/xvda1 ro"
 +
# Window resolution additional parameters
 +
extra = "xen-fbfront.video=16,1280,768"
 +
 
 +
The VM can then be launched with '''xl create ''file''''' :
 +
 
 +
root@inner:/etc/xen# xl create sl12
 +
Parsing config from sl12
 +
root@inner:/etc/xen#
 +
 
 +
== Creating a HVM ==
 +
 
 +
* in full hardware virtualization (HVM) guests require CPU virtualization extensions from the host CPU (Intel VT-x, AMD-V). Xen uses a modified version of Qemu to emulate full PC hardware, including BIOS, IDE disk controller, VGA graphic adapter, USB controller, network adapter etc for HVM guests. CPU virtualization extensions are used to boost performance of the emulation. Fully virtualized guests do not require kernel support, so for example Windows operating systems can be used as Xen HVM guest. Fully virtualized guests are usually slower than paravirtualized guests, because of the required emulation.
 +
 
 +
Full hardware virtualization requires only a disk image to execute in. Then a HV config file needs to be created. Samples are available from the /etc/xen directory. Here is an [{{SERVER}}/wikislax/download/win7 example] running in a X window for Windows 7. The main config options to modify are :
 +
 
 +
# Initial memory allocation (in megabytes) for the new domain.
 +
memory = 2048
 +
# A name for the new domain. All domains have to have different names,
 +
name = "win7"
 +
# Number of virtual CPUs
 +
vcpus = 4
 +
# Define network interfaces
 +
vif = [ 'type=ioemu, bridge=br0' ]
 +
# Define disk devices. Note the device names xvda and xvdb
 +
disk = [ 'file:/mnt/xen/win7.img,hda,w', 'file:/mnt/xen/win7.iso,hdc:cdrom,r' ]
 +
# enable SDL library for graphics, default = 0
 +
sdl=1
 +
# enable VNC library for graphics, default = 1
 +
vnc=0
 +
# set VNC display number, default = domid
 +
vncdisplay=7
 +
 
 +
The VM can then be launched with '''xl create ''file''''' :
 +
 
 +
root@inner:/etc/xen# xl create win7
 +
Parsing config from win7
 +
root@inner:/etc/xen#
 +
 
 +
== A little screen shot ==
 +
 
 +
The 3 VMs displayed on this slackware 13.37 dom0 are slackware 12.1, windows 7 and windows 8.  
 +
 
 +
[[file:Screenshot.png]]
  
 
<br/>
 
<br/>
  
{{pFoot|[[Asterisk]]|[[Main Page]]|[[Res_ldap.conf]]}}
+
{{pFoot|[[Using Grub2]]|[[Main Page]]|[[OpenSSL]]}}

Revision as of 20:20, 30 July 2018

the xl tool

There is a variety of tools and commands to handle virtual machines. Here we will use the Xen xl command.

  • xl create file affords creating a virtual machine based on the configuration in file file. A one-starting sequential domain id is created.
  • xl destroy domid affords destroying a virtual machine with domain id domid. Of course using the system in the VM will be a preferred method to terminate.
  • xl help affords getting more information on other xm commands.

Xen supports paravirtualisation and hardware virtualization. Both can be used at the same time on a single Xen system.

Creating a PV VM

  • in paravirtualization (PV) guest operating systems are modified so they are able to interlock with Xen without emulation or virtual emulated hardware. Xen PV guest kernels exist for Linux, NetBSD, FreeBSD, OpenSolaris and Novell Netware. Upstream kernel.org Linux kernels since Linux 2.6.24 include Xen PV guest (domU) support based on the Linux pvops framework, so every upstream Linux kernel can be automatically used as Xen PV guest kernel without any additional patches or modifications.

Paravirtualization requires storing the kernel to boot in the dom0 filesystem, and populating the system in a virtual partition. The kernel generated must be able to manage the QEMU devices and include the .config file domU options. Here is a minimal example of such a .config domU file. The swap partition and VM filesystem can be created as below. Don't forget to update the root device in fstab :

# dd if=/dev/zero of=pv-sl12.swap bs=1024k count=1024
# mkswap pv-sl12.swap
# dd if=/dev/zero of=pv-sl12.img bs=1024k count=8192
# mkfs -t ext3 pv-sl12.img
# mkdir /tmp/loop
# mount -o loop pv-sl12.img /tmp/loop
# cp -ax /mnt/sl12/{0,bin,boot,etc,home,initrd*,lib,lib32,lib64,media,mnt,opt,root,run,sbin,srv,sys,usr,var,vmlinuz*} /tmp/loop
# mkdir /tmp/loop/{dev,proc,tmp}
# chmod 777 /tmp/loop/tmp
# vi /tmp/loop/etc/fstab
# umount /tmp/loop

Then a PV config file needs to be created. Samples are available from the /etc/xen directory. Here is an example running in a X window for slackware 12.1 (32 bits). The main config options to modify are :

# Kernel image file in dom0 filesystem
kernel = "/boot/vmlinuz-3.4.2-domU"
# Not using any optional ramdisk
#ramdisk = "/boot/initrd.gz"
# Initial memory allocation (in megabytes) for the new domain.
memory = 2048
# A name for the new domain. All domains have to have different names,
name = "sl12"
# Number of virtual CPUs
vcpus = 2
# Define network interfaces
vif = [ ' ' ]
# Define disk devices. Note the device names xvda and xvdb
disk = [ 'file:/mnt/xen/sl12.img,xvda1,w', 'file:/mnt/xen/sl12.swap,xvdb,w' ]
# Define frame buffer device. Use sdl to view virtual machine in a window
vfb = [ 'sdl=1' ]
# Set root device.
root = "/dev/xvda1 ro"
# Window resolution additional parameters
extra = "xen-fbfront.video=16,1280,768"

The VM can then be launched with xl create file :

root@inner:/etc/xen# xl create sl12
Parsing config from sl12
root@inner:/etc/xen#

Creating a HVM

  • in full hardware virtualization (HVM) guests require CPU virtualization extensions from the host CPU (Intel VT-x, AMD-V). Xen uses a modified version of Qemu to emulate full PC hardware, including BIOS, IDE disk controller, VGA graphic adapter, USB controller, network adapter etc for HVM guests. CPU virtualization extensions are used to boost performance of the emulation. Fully virtualized guests do not require kernel support, so for example Windows operating systems can be used as Xen HVM guest. Fully virtualized guests are usually slower than paravirtualized guests, because of the required emulation.

Full hardware virtualization requires only a disk image to execute in. Then a HV config file needs to be created. Samples are available from the /etc/xen directory. Here is an example running in a X window for Windows 7. The main config options to modify are :

# Initial memory allocation (in megabytes) for the new domain.
memory = 2048
# A name for the new domain. All domains have to have different names,
name = "win7"
# Number of virtual CPUs
vcpus = 4
# Define network interfaces
vif = [ 'type=ioemu, bridge=br0' ]
# Define disk devices. Note the device names xvda and xvdb
disk = [ 'file:/mnt/xen/win7.img,hda,w', 'file:/mnt/xen/win7.iso,hdc:cdrom,r' ]
# enable SDL library for graphics, default = 0
sdl=1
# enable VNC library for graphics, default = 1
vnc=0
# set VNC display number, default = domid
vncdisplay=7

The VM can then be launched with xl create file :

root@inner:/etc/xen# xl create win7
Parsing config from win7
root@inner:/etc/xen#

A little screen shot

The 3 VMs displayed on this slackware 13.37 dom0 are slackware 12.1, windows 7 and windows 8.

Screenshot.png


Using Grub2 Main Page OpenSSL