Pages

Tuesday, May 13, 2014

Multiple subnets on a single ethernet interface under OpenVZ

You can't simply install OpenVZ and configure your containers to use IP addresses on either block.  By default, OpenVZ will not broadcast ARP packets for IP blocks that it doesn't have a venet interface for - even though you may be bridging your containers to your ethernet device.

Fix:
Edit your /etc/vz/vz.conf file and change the 'NEIGHBOUR_DEVS=detect' to 'NEIGHBOUR_DEVS=all', save and reboot and everything should work beautifully.

Monday, May 12, 2014

Postfix Virtual mailbox for a user

(1) Create a system user and set password.
Here it is: linux

(2) Install postfix

#yum install postfix

(3) Made the following changes in the postfix configuration

mydestination = $myhostname, $mydomain, example.com
virtual_alias_maps = hash:/etc/postfix/virtual

(4) Specify the virtual mailbox in the file.

root@server]#tail -2 /etc/postfix/virtual

mail@example.com linux
                                                                    VIRTUAL(5)
[root@server]#

Saturday, May 3, 2014

Check Load average with OpenVZ

#!/bin/bash
# This script checks the load average for the vps and reboot it if any of the vps load average goes higher than 7

load=`/usr/sbin/vzlist -o veid,laverage | /bin/sort -nrk 2 | awk '{ print $2 }' | cut -d / -f 1 | /usr/bin/head -1 | awk '{ print $1 }' | cut -d . -f 1`
if [ "$load" -gt "7" ]
then
line=`/usr/sbin/vzlist -o veid,laverage | /bin/sort -nrk 2 | /usr/bin/head -1 | awk '{ print $1 }'`
/usr/sbin/vzctl restart $line 2>/dev/null 1>&2
mail -s "The VPS $line has been rebooted due to the high load on the server $HOSTNAME"    alert@domain.com
fi

Friday, May 2, 2014