mercoledì 3 febbraio 2016

pfSense on XenServer: enable VLAN Support for xn ethernet adapter

I was migrating my PfSense boxes from vmware to xenserver and I was disappointed when trying to create a VLAN the XenServer xn interface wasn't listed as capable.

I lurked in forums in search for a solution and found that in stock BSD the xn interface is reported working fine with VLANs, even the vlanmtu is not reported as capable at driver level.

So my idea is to cheat pfsense and report xn network devices as VLAN capable.

Here's the trick:

Go to Diagnostic -> Edit File
Load file /etc/inc/

Locate the function is_jumbo_capable ( in pfsense 2.2.6 starts at line 5181) end edit as is:

/****f* interfaces/is_jumbo_capable
 *   is_jumbo_capable - Test if interface is jumbo frame capable.  Useful for determining VLAN capability.
 *   $int             - string containing interface name
 *   boolean          - true or false
function is_jumbo_capable($iface) {
$iface = trim($iface);
$capable = pfSense_get_interface_addresses($iface);

if (isset($capable['caps']['vlanmtu']))
return true;

// hack for some lagg modes missing vlanmtu, but work fine w/VLANs
if (substr($iface, 0, 4) == "lagg")
return true;

        // hack for XenServer xn interfaces
if (substr($iface, 0, 2) == "xn")
return true;

return false;

Then go to Interfaces->Assign->VLAN and create your VLAN interface on your xn network!

Refers To: Pfsense issue 4103

martedì 26 gennaio 2016

Convert a Linux ESXi Virtual Machine to Xenserver

Since I had to migrate my hypervisor from vmware ESXi to Citrix Xenserver 6.5, I had to convert my Centos Linux 6.x Virtual Machines.
The main difference in Xenserver is that the Linux kernel is paravirtualized.

Tools for the trade:
- vmware vSphere Client
- Xencenter
- Very little Linux terminal skills :)


Optional: take a snapshot

Drop into vSphere Client and take a snapshot.

It's safe to take a snapshot before messing with vms :)
It is safe to take a snapshot prior to daamge your work


Uninstall vmware Tools

Connect to virtual machine console and type as root:

# rpm -e --nodeps $( rpm -qa | grep vmware-tools)


Export the Virtual Machine into an OVF Package.

Shutdown your VM then in VSphere Client Select your VM and click on File->Export->Export OVF Template

vm export
Export your VM - now you can go take some coffee


Import The VM in Xenserver

Now move to Xencenter, right click on the Pool then select Import...

Time to import your VM - now you can go take another coffee

Follow the instructions on wizard


Configure VM for PV.

Power on your VM and login to console as root.

Remove the stock kernel and install the xen-aware kernel by typing

# yum remove kernel
# yum install kernel-xen

Edit the bootloader, add to "kernel=" line


Then shutdown your VM.

Now open a console to your Xenserver host and change boot policy from HVM to PV:

xe vm-list name-label=[NAME-OF-YOUR-VM]
uuid ( RO)           : [UUID-OF-YOUR_VM]
     name-label ( RW): SOGo
    power-state ( RO): halted

xe vm-param-set uuid=[UUID-OF-YOUR_VM] HVM-boot-policy="" PV-bootloader=pygrub PV-args="graphical utf-8"

xe vm-disk-list uuid=[UUID-OF-YOUR_VM]
Disk 0 VBD:
uuid ( RO)             : [UUID-OF-VBD]
    vm-name-label ( RO): SOGo
       userdevice ( RW): 0

xe vbd-param-set uuid=[UUID-OF-VBD] bootable=true

Then Power on your VM and Install XenTools.

Source: CTX121875