Important steps to have xen dom0 with HVM running:
(works also on raid1 disk mirror)
$ cat /boot.cfg
menu=Boot normally:rndseed /var/db/entropy-file;boot netbsd
menu=Boot Xen:load /netbsd.dom0 console=pc;multiboot /xen dom0_mem=1024M noreboot
menu=Boot single user:rndseed /var/db/entropy-file;boot netbsd -s
menu=Disable ACPI:rndseed /var/db/entropy-file;boot netbsd -2
menu=Disable ACPI and SMP:rndseed /var/db/entropy-file;boot netbsd -12
menu=Drop to boot prompt:prompt
default=1
timeout=5
clear=1
$ cat /usr/pkg/etc/xen/win7.cfg
name = "win7"
memory = "880"
# for windows we need HVM kind of xen - complete virtualization
kernel = "hvmloader"
builder = 'hvm'
vcpus=1
pae=1
acpi=1
apic=1
# for some reason this is the best working network card
vif = [ 'type=ioemu, mac=00:2d:ff:00:0d:03, 'bridge=bridge0' , model=e1000']
#specify disks, for me the cd0 did not work so I had to create an image of DVD
#like this:# dd if=/dev/cd0a of=install_win7.iso
disk = [ 'file:/home/robin/win.img,hda,w', 'file:/home/robin/install_win7.iso,hdc:cdrom,r' ]
usbdevice = 'tablet' #this makes mouse pointer more friendly
boot="adc"
# sequence of devices to boot domU
sdl=0 #the default command line console will not appear
opengl=1
vnc=1 #this lets you open a vnc console
stdvga=0
soundhw='sb16' # this should bring up the sound
on_reboot = 'destroy' #This is good for possible debugging
on_crash = 'destroy'
$ cat /etc/ifconfig.bridge0
create
!brconfig $int add wm0 up
The harder, but network independent way is to nat over tap0. You have to do several system changes
1. run dhcp server for the machines
2. run nat with ipf or pf (pf needs to recompile kernel)
That all can be done as follows:
Configure tap0 before bridge0. Put these lines in /etc/rc.conf:
auto_ifconfig=NO
net_interfaces="`/sbin/ifconfig -l` tap0 bridge0"
Create a tap0 interface and assign it e.g., 192.168.0.1. Put this in /etc/rc.conf:
ifconfig_tap0="192.168.0.1 netmask 255.255.0.0"
Create /etc/ifconfig.bridge0 with this contents:
create
!brconfig $int add tap0 up
net.inet.ip.forwarding=1
ext_if=XXX
ext_addr=X.Y.Z.T
nat on $ext_if from 192.168.0.0/16 to any -> $ext_addr
in /etc/pf.conf and set pf=YES in /etc/rc.conf.# xm list
- shows running guests and host VMs
# xm create /usr/pkg/etc/xen/win7.cfg
- starts a VM configured in the file
# xm vcpus-list - shows usage of CPUs and virtual CPUs
# xm shutdown -F win7
- acpi shutdown
# xm destroy win7
- forced manual shutdown, may result in data loss
- HOME
~~~~~~~~~~~~~~~
- OpenBSD
- NetBSD
- FreeBSD
- Linux
- Solaris
- Windows
~~~~~~~~~~~~~~~
- Git
- Ansible
- Atlassian
- Network tools
- Qemu
- Virtualbox
- Vim
- Tmux
- Mutt
- STar
~~~~~~~~~~~~~~~
- MySQL
- PostgreSQL
- Postfix
- OpenSSL
- tcpdump
- SSH
~~~~~~~~~~~~~~~
- Packet Filter
- IP Filter
~~~~~~~~~~~~~~~
- Bash
- web-dev
- Hacking
- LINUX DAYS