Vmware ESXi NAT Networking

The case: You have multiple virtual machines that you don’t want to expose directly to the internet and you prefer routing them through a single virtual machine. This is also handy if you are short on IPs. Our case is OVH specific and it will give you a guide on how to set things up on OVH weird network topology. Reason why we use ipcop instead of pfsense is because pfsense doesn’t support a 32bit net mask. No matter what i’ve tried i could get it to work with a 32 bit netmask and gateway on separate network. So IpCop was the next best thing and it does the job quite well.

ESXi Configuration:

Login to your Vsphere client and go to Configuration -> Networking.

On Network Access select “Create a vSphere standard switch” without select any vmnic .

Proceed to Connection Settings and name your new nic under “Network Label” . “Vlan ID” select None.

Proceed on creating a new VM including both NICs the one that you just created and the one that connects you to the outside world.

Then move on with standard installation of IPcop. Keep in mind that your RED network will be the one connecting outside and the GREEN one will be your internal nat network. If you are not sure of the network settings while installing proceed and will edit network config later on anyways.

After installation login to the machine and now let’s edit the files needed for proper networking under OVH routers.

vi /var/ipcop/ethernet/settings

DEFAULT_GATEWAY=Dedicated Server IP but end in .254
GREEN_1_MAC=Your Virtual Mac Address
RED_1_MAC=Your Virtual Mac Address

vi /etc/rc.d/rc.event.local

route add Dedicated Server IP but end in .254 dev wan-1
route add default gw Dedicated Server IP but end in .254

Reboot and you are done! You can now login to the web interface under


#esxi, #ipcop, #nat, #ovh, #pfsense, #virtual-machine, #vmware-2

Android Studio Installation: Error, “failed to find java version for ‘C:\windows\system32\java.exe”

So this is quite simple to solve.

Goto http://www.oracle.com/technetwork/java/javase/downloads/index.html and download the latest jdk for your architecture x32 or x64.

Install as usual and then goto Control Panel -> “Advanced System Settings”

Click on the “Enviroment Variables” and under “System Variables” click “New..”

Then create a new entry with Variable Name: “JAVA_HOME” and Variable Value: “C:\Program Files\Java\jdk1.7.0_21” (this differs according to the version and system).

Save and restart android studio installation and it should identify the correct pat.

#android, #android-studio, #development, #error, #failed, #java

Bash: Script to monitor hard disk health and send an e-mail on error.

Here is a simple script to test for reallocated sector count and report through mail if it finds any.
Reallocated sectors means your disk has sectors where it can’t read/write thus it uses a reserved space to reallocate those sectors.
In general reallocated sectors are bad news for your disk and you should consider a backup and send to warranty.
The script reads the smart value and reports. It should be self explanatory to use it just type ./scriptname.sh nameofthehost. Afterwards set a cron to run daily.
Credits to Thorsten Rhau for the base script.

# This script checks the health of disks

#Define a friendly name for this machine

#Location to temporary store the error log
#Set default for not sendig mails

# Disks to check

# Setting up path

# variable containing all needed commands
needed_commands="smartctl awk mail"

# Checking if all needed programs are available on system
for command in $needed_commands
  if ! hash "$command" > /dev/null 2>&1
    echo "$command not found on system" 1>&2
    exit 1

# Checking disk
for disk in $disks
  # Creating a array with results
  declare -a status=(`smartctl -a -d ata $disk | awk '/Reallocated_Sector_Ct/ || /Seek_Error_Rate/ { print $2" "$NF }'`)
  # Checking that we do not have any Reallocated Sectors
  if [ "${status[1]}" -ne 0 ]
    echo "$mname Warning: Disk $disk has errors! ${status[0]} ${status[1]} ${status[2]} ${status[3]}. Following complete smartctl output." >> diskerror.log
    smartctl -a -d ata $disk >> $logloc/diskerror.log
    failed=("${failed[@]}" "$disk")

#Send an e-mail if needed containing the failed diks (fdisks) info.
if [ $sendm == 1 ]; then
  mail -s "$mname Disks $fdisks are about to fail." user@localhost < $logloc/diskerror.log
  rm -rf $logloc/diskerror.log

#bash-2, #disk, #hard-disk, #health, #mail-2, #s-m-a-r-t, #script, #sda, #smart, #smartctl

Building Android on Gentoo

Ok, it is generally best practice to use Ubuntu  for building android but if you are a Gentoo fan and don’t want to mess with a vm you’ll have to bypass some bumps first.

So let’s start. Firstly you need sun-jdk6. icedtea-jdk won’t do the trick. So let’s get sun-jdk6 firstly. I’m going to just pass the commands you need and it should be self explanatory if you know what you are doing.

Download java and put it at /usr/portage/distfiles/

cd /usr/portage/distfiles
wget http://uni-smr.ac.ru/archive/dev/java/SDKs/sun/j2se/6/jdk-6u45-linux-x64.bin

Then copy paste the exact same lines as below to auto-accept all licenses.

cat >> /etc/make.conf <<END

Then let’s unmask sun-jdk. It’s masked for security reason but we really need this. So edit  package.unmask with your favorite editor ( vi /etc/portage/package.unmask ) and add at the bottom


Ok we’re ready let’s emerge

emerge dev-java/sun-jdk

After you’ve done select the appropriate package by issuing

java-config --set-system-vm sun-jdk-1.6

Afterwards let’s emerge all the packages we need to compile android.

emerge git app-crypt/gnupg flex bison gperf libsdl wxGTK squashfs-tools curl ncurses zlib schedtool perl-Switch zip unzip emul-linux-x86-baselibs emul-linux-x86-compat emul-linux-x86-cpplibs

You should be all done expect one last thing. repo sync etc. and before you start your build goto core/config.mk and comment out the following lines.

+#ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
+#$(error Error: could not find jdk tools.jar, please install JDK6, \
+#    which you can download from <a href="http://java.sun.com" target="_blank">java.sun.com</a>)

You are good to go! Happy android building!

#android, #building, #endif, #gentoo, #ifeq, #requires_openjdk, #sun-jdk

Virtualbox: Kernel driver not installed (rc=-1908) CentOS/Fedora

Virtualbox Error

Virtualbox Error

This happens after a kernel update. Just install the following meta-package and reboot.


sudo yum install kmod-VirtualBox.x86_64

or for 32bit

sudo yum install kmod-VirtualBox.i686

#1908, #centos, #error, #fedora, #kernel-driver, #virtualbox, #virtualization

Joomla: 500 internal server error on administrator panel.

The solution is rather simple.
You need to set the right permissions for log , cache, tmp and administrator/cache.
So goto your joomla root dir and

chmod 755 log cache tmp administrator/cache

Also make sure the file ownerships are correct.

chown -R myuser myjoomladir

And last to get rid of “500 – An error has occurred” while logging to the admin read the error_log which should be like this

[16-Nov-2013 10:00:37 Europe/Athens] PHP Warning:  fopen(/home/myuser/www/logs/error.php) [<a href='function.fopen'>function.fopen</a>]: failed to open stream: Permission denied in /home/myuser/www/libraries/joomla/log/loggers/formattedtext.php on line 248

Meaning you have to

chmod 777 /home/myuser/www/logs/error.php

Also one last thing to keep in mind is you need to have the correct path for log and tmp at your configuration.php file. Something like that.

 public $log_path = '/home/myuser/public_html/logs';
 public $tmp_path = '/home/myuser/public_html/tmp';

All set!

[Ubuntu] WARNING: gnome-keyring:: couldn’t connect to: /tmp/keyring-*****/pkcs11


sudo gedit /etc/xdg/autostart/gnome-keyring-pkcs11.desktop





#gnome, #keyring, #linux, #openbox, #ubuntu