Showing posts with label xen. Show all posts
Showing posts with label xen. Show all posts

Friday, April 6, 2012

Change Hypervisor memory for Domain-0

Change Hypervisor memory:

vi /boot/grub/grub.conf (default is 512M)
You can change it to 4096 fro better performance.

 restart the host


Wednesday, October 19, 2011

Port Forwarding



Masquerade :
/sbin/iptables -t nat -A POSTROUTING -o xenbr0 -j MASQUERADE

Port Forwarding :
  iptables -t nat -A PREROUTING -p tcp -s 0.0.0.0/0 -d  10.228.1.120  --dport 2221 -j DNAT --to-destination 192.168.1.1:22


Note : In this case Xenbr0 is listening externally. 

Anyone connecting to hypervisor on 10.228.1.120:2221 will be forwarded to VM 192.168.1.1:22

Default DHCP on xen

Xen has its own DHCP server which uses virbr0 bridge,

For DHCP server to be ready, you need to make sure that libvirtd service is running.

To use any VM as dhcp client on Xen :

In the vm.cfg add the below entries :
========================
dhcp = "dhcp"
vif = ['bridge=virbr0,mac=00:16:3E:76:D6:7D,type=netfront']


mac is the mac address of eth0 configured in Virtual Machine.

Always hardcode the mac address by defining it in the
/etc/sysconfig/network/ifcfg-eth0 script in the VM machine

The line would be :

HWADDR=00:16:3E:76:D6:7D
BOOTPROTO=dhcp













Thursday, January 27, 2011

Creating Soft Partitioning in Linux

Order :
  1. Create an image file
  2. Create a loopback device for the file
  3. Run pvcreate on the loopback device
  4. Run vgcreate on the "physical" volume
  5. Run lvcreate on the volume group
  6. Create a filesystem on the logical volume
  7. Mount the logical volume



1) Create an image file
===============
#dd if=/dev/zero of=/FAW/vms/linux_vm/disk2.img bs=1 count=1024 seek=500G

2)Create a loopback device for the file
===========================
#losetup -f /FAW/vms/linux_vm/disk2.img


# losetup -a
/dev/loop0: [fd01]:49160 (/FAW/vms/linux_vm/disk2.img)

3) Run pvcreate on the loopback device
===============================
# pvcreate /dev/loop0 (initialise disk created)
Physical volume "/dev/loop0" successfully created

4)Run vgcreate on the "physical" volume
===============================
#vgcreate xen-vm /dev/loop0
Volume group "xen-vm" successfully created

5) Run lvcreate on the volume group
============================
#lvcreate -L450G -nxen_prov xen-vm

Logical volume "xen_prov" created

6)Create a filesystem on the logical volume
===================================
#mkfs.ext3 /dev/xen-vm/xen_prov
mke2fs 1.39 (29-May-2006)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
58982400 inodes, 117964800 blocks
5898240 blocks (5.00%) reserved for the super user
First data block=0
......................
.........................................


7) Mount the logical volume
========================

mount /dev/xen-vm/xen_prov /FMW/xen_vm