Howto: Enable TUN module on a VPS for VPN

October 16, 2009    |   Posted by admin   |    Category: VPS Management

TUN module is required to configure VPN (Virtual Private Network) tunneling on a VPS,. The TUN module has to be enabled on the Hardware node as well as on the VPS from the node itself.  Login to your Host server and execute the following command:

First check if the TUN module is enabled on the hardware node:

lsmod | grep tun

If not, load the module using modprobe:

modprobe tun

Now, enable the TUN module on a VPS:

vzctl set VEID --devices c:10:200:rw --save
vzctl exec VEID mkdir -p /dev/net
vzctl exec VEID  mknod /dev/net/tun c 10 200
vzctl exec VEID  chmod 600 /dev/net/tun

where, VEID is the VPS ID you want to enable the TUN module on. Once done, you can configure VPN on the VPS using any available vpn server like OpenVPN.

Comments Off on Howto: Enable TUN module on a VPS for VPN

Ftp: 425 Unable to build data connection

October 16, 2009    |   Posted by admin   |    Category: Linux Administration

Error Message:

LIST
425 Unable to build data connection: Connection timed out
PASV
227 Entering Passive Mode (xx,xx,xx,xx,xx,xxx).
connecting data channel to xx.xxx.xx.xxx:54963

The above error message is received while you Ftp to an account successfully but it does not list the files and directories within it. The reason for the error message is, the kernel modules that are required for Ftp “i.e. to keep track of every Ftp connection and carry out the data transfer of it on another port” is not loaded.

The modules are “ip_conntrack” and “ip_conntrack_ftp” which has to be loaded using the ‘modprobe’ command.

SSH to your server as user root and execute the following commands:

# /sbin/modprobe ip_conntrack
# /sbin/modprobe ip_conntrack_ftp

To verify if the modules are loaded properly, execute

# lsmod | grep ftp

This should list the modules you just loaded. Once they appear, ftp should list the files/directories on successful login.

Comments Off on Ftp: 425 Unable to build data connection

Howto: deny/allow IP using iptables

October 16, 2009    |   Posted by admin   |    Category: Linux Administration

How to block an IP using iptables?

iptables -A INPUT -s xx.xx.xx.xx -j DROP

How to block an IP for a specific port:

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j DROP

How to allow access to an IP?

iptables -A INPUT -s xx.xx.xx.xx -j ACCEPT

How to allow access to an IP to a specific port using iptables?

iptables -A INPUT -p tcp -s xx.xx.xx.xx --dport PORT -j ACCEPT

where, xx.xx.xx.xx is the remote IP address and PORT is the port number you wish to allow/deny access to.

How to block a scanner on your server for example “w00tw00t.at.ISC.SANS” using iptables?

iptables -I INPUT -p tcp --dport 80 -m string --algo bm  \
--string 'GET /w00tw00t.at.ISC.SANS.' -j DROP
Comments Off on Howto: deny/allow IP using iptables

How to upgrade PHP on a Plesk server?

October 13, 2009    |   Posted by admin   |    Category: Plesk Management

How to upgrade PHP on a Plesk server? You will have to download a script from ww.atomicorp.com and have to install it which will then allow you to upgrade PHP using yum.

1) Download the script:

wget -q -O – http://www.atomicorp.com/installers/atomic.sh

2) Install the script:

sh atomic.sh

3) Now upgrade PHP using yum:

yum upgrade php

Once it is installed, restart the httpd service.

Comments Off on How to upgrade PHP on a Plesk server?

Howto: Re-create/re-install a VPS

October 13, 2009    |   Posted by admin   |    Category: VPS Management

How to re-create/re-install a OpenVZ VPS?

1) Make a backup of the configuration file:

cp -p /etc/sysconfig/vz-scripts/VEID.conf  /etc/sysconfig/vz-scripts/VEID.conf_old

2) Stop the VPS:

vzctl stop VEID

3) Destroy/Terminate the VPS:

vzctl destroy VEID

4) Create the VPS using the OS templates stored under /vz/template/cache directory:

vzctl recreate VEID –ostemplate os-template-name

5) Copy the original configuration file back to have the original parameters:

cp -p /etc/sysconfig/vz-scripts/VEID.conf_old /etc/sysconfig/vz-scripts/VEID.conf

6) Start the VPS and reset the password

vzctl start VEID
vzctl set VEID –userpasswd root:password –save

Comments Off on Howto: Re-create/re-install a VPS