Friday, September 4, 2009

MP3 Encoder LAME







I was planning a trip to Virginia beach on this long weekend. As I am traveling alone (nothing unusual in this ..I am a lonely wanderer), music is best way to enjoy myself. I had bunch of music files on computer most of them I copied from Abhyant's music collection. Grrrrrr... all of these are in .wav and .aiff format. I was looking for a tool to do the conversion. Lovely tool LAME here to help me.


bbaby@luttappi:~/Songs-Abhyant/CD2$ for i in *.aiff; do j=`echo $i | sed -e 's/\.aiff/.mp3/'`; lame -b 128 -B 256 --vbr-new $i /home/bbaby/ToCD/cd2/$j;done;

I got the files in new folder. Ready to go :)

Monday, August 10, 2009

PostgreSQL Installation


I have started using Postgresql database from today. In my limited DB knowledge itself, I was able make out the strength of this open source DB. Unlike MySQL, its tough to get clear cut documentation about Postgres from a single source. I have installed Postgres on my devel box running on Ubuntu 9.04 (64 bit edition) . Here is the logs from my console.

1. Installation:
****************
root@luttappi:~/perl# apt-get install postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libpq5 postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common
Suggested packages:
oidentd ident-server postgresql-doc-8.3
The following NEW packages will be installed:
libpq5 postgresql postgresql-8.3 postgresql-client-8.3 postgresql-client-common postgresql-common
0 upgraded, 6 newly installed, 0 to remove and 184 not upgraded.
Need to get 5245kB of archives.
After this operation, 21.4MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
<---- snipped ---------->

2. Testing the Installation:
*****************************
root@luttappi:~/perl# su - postgres
postgres@luttappi:~$ psql template1
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

template1=#
template1=# \l
List of databases
Name | Owner | Encoding
-----------+----------+----------
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(3 rows)

template1=# \q
postgres@luttappi:~$

3. New User addition
************************
root@luttappi:~/perl# useradd mayavi
root@luttappi:~/perl# passwd mayavi
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

root@luttappi:~/perl# su - postgres
postgres@luttappi:~$ psql template1
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

template1=# CREATE USER mayavi WITH PASSWORD 'password';
CREATE ROLE

template1=# create database kuttoosan;
CREATE DATABASE

template1=# GRANT ALL PRIVILEGES ON DATABASE kuttoosan to mayavi;
GRANT
template1=#

root@luttappi:~/perl# su - mayavi
mayavi@luttappi:~$ psql -d kuttoosan -U mayavi
Welcome to psql 8.3.7, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

kuttoosan=>


4. Installing perl db modules:
*********************************
root@luttappi:~# apt-get install libapache2-mod-perl2 apache2 libdbi-perl libdbd-pg-perl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-worker apache2-utils apache2.2-common libapache2-reload-perl libapr1 libaprutil1 libbsd-resource-perl libdevel-symdump-perl libmysqlclient15off libnet-daemon-perl libplrpc-perl
mysql-common
Suggested packages:
apache2-doc apache2-suexec apache2-suexec-custom dbishell
The following NEW packages will be installed:
apache2 apache2-mpm-worker apache2-utils apache2.2-common libapache2-mod-perl2 libapache2-reload-perl libapr1 libaprutil1 libbsd-resource-perl libdbd-pg-perl libdbi-perl libdevel-symdump-perl
libmysqlclient15off libnet-daemon-perl libplrpc-perl mysql-common
0 upgraded, 16 newly installed, 0 to remove and 184 not upgraded.
Need to get 5719kB of archives.
After this operation, 17.4MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com jaunty-updates/main libapr1 1.2.12-5ubuntu0.1 [114kB]
Get:2 http://us.archive.ubuntu.com jaunty-updates/main mysql-common 5.1.30really5.0.75-0ubuntu10.2 [62.9kB]
Get:3 http://us.archive.ubuntu.com jaunty-updates/main libmysqlclient15off 5.1.30really5.0.75-0ubuntu10.2 [1878kB]
Get:4 http://us.archive.ubuntu.com jaunty-updates/main libaprutil1 1.2.12+dfsg-8ubuntu0.3 [79.1kB]
Get:5 http://us.archive.ubuntu.com jaunty-updates/main apache2-utils 2.2.11-2ubuntu2.2 [151kB]
Get:6 http://us.archive.ubuntu.com jaunty-updates/main apache2.2-common 2.2.11-2ubuntu2.2 [827kB]
Get:7 http://us.archive.ubuntu.com jaunty-updates/main apache2-mpm-worker 2.2.11-2ubuntu2.2 [258kB]
Get:8 http://us.archive.ubuntu.com jaunty-updates/main apache2 2.2.11-2ubuntu2.2 [46.3kB]
Get:9 http://us.archive.ubuntu.com jaunty/main libdevel-symdump-perl 2.08-1 [16.4kB]
Get:10 http://us.archive.ubuntu.com jaunty/main libapache2-mod-perl2 2.0.4-5ubuntu1 [1147kB]
Get:11 http://us.archive.ubuntu.com jaunty/main libapache2-reload-perl 0.10-2 [19.9kB]
Get:12 http://us.archive.ubuntu.com jaunty/main libnet-daemon-perl 0.43-1 [46.9kB]
Get:13 http://us.archive.ubuntu.com jaunty/main libplrpc-perl 0.2020-1 [36.0kB]
Get:14 http://us.archive.ubuntu.com jaunty/main libdbi-perl 1.607-1 [793kB]
Get:15 http://us.archive.ubuntu.com jaunty/universe libdbd-pg-perl 2.11.7-1 [212kB]
Get:16 http://us.archive.ubuntu.com jaunty/main libbsd-resource-perl 1.2901-1 [31.8kB]
Fetched 5719kB in 10s (523kB/s)
Selecting previously deselected package libapr1.
(Reading database ... 103255 files and directories currently installed.)
Unpacking libapr1 (from .../libapr1_1.2.12-5ubuntu0.1_amd64.deb) ...
Selecting previously deselected package mysql-common.
Unpacking mysql-common (from .../mysql-common_5.1.30really5.0.75-0ubuntu10.2_all.deb) ...
Selecting previously deselected package libmysqlclient15off.
Unpacking libmysqlclient15off (from .../libmysqlclient15off_5.1.30really5.0.75-0ubuntu10.2_amd64.deb) ...
Selecting previously deselected package libaprutil1.
Unpacking libaprutil1 (from .../libaprutil1_1.2.12+dfsg-8ubuntu0.3_amd64.deb) ...
Selecting previously deselected package apache2-utils.
Unpacking apache2-utils (from .../apache2-utils_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2.2-common.
Unpacking apache2.2-common (from .../apache2.2-common_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2-mpm-worker.
Unpacking apache2-mpm-worker (from .../apache2-mpm-worker_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package apache2.
Unpacking apache2 (from .../apache2_2.2.11-2ubuntu2.2_all.deb) ...
Selecting previously deselected package libdevel-symdump-perl.
Unpacking libdevel-symdump-perl (from .../libdevel-symdump-perl_2.08-1_all.deb) ...
Selecting previously deselected package libapache2-mod-perl2.
Unpacking libapache2-mod-perl2 (from .../libapache2-mod-perl2_2.0.4-5ubuntu1_amd64.deb) ...
Selecting previously deselected package libapache2-reload-perl.
Unpacking libapache2-reload-perl (from .../libapache2-reload-perl_0.10-2_all.deb) ...
Selecting previously deselected package libnet-daemon-perl.
Unpacking libnet-daemon-perl (from .../libnet-daemon-perl_0.43-1_all.deb) ...
Selecting previously deselected package libplrpc-perl.
Unpacking libplrpc-perl (from .../libplrpc-perl_0.2020-1_all.deb) ...
Selecting previously deselected package libdbi-perl.
Unpacking libdbi-perl (from .../libdbi-perl_1.607-1_amd64.deb) ...
Selecting previously deselected package libdbd-pg-perl.
Unpacking libdbd-pg-perl (from .../libdbd-pg-perl_2.11.7-1_amd64.deb) ...
Selecting previously deselected package libbsd-resource-perl.
Unpacking libbsd-resource-perl (from .../libbsd-resource-perl_1.2901-1_amd64.deb) ...
Processing triggers for man-db ...
Processing triggers for ufw ...
Setting up libapr1 (1.2.12-5ubuntu0.1) ...

Setting up mysql-common (5.1.30really5.0.75-0ubuntu10.2) ...
Setting up libmysqlclient15off (5.1.30really5.0.75-0ubuntu10.2) ...

Setting up libaprutil1 (1.2.12+dfsg-8ubuntu0.3) ...

Setting up apache2-utils (2.2.11-2ubuntu2.2) ...
Setting up apache2.2-common (2.2.11-2ubuntu2.2) ...
Enabling site default.
Enabling module alias.
Enabling module autoindex.
Enabling module dir.
Enabling module env.
Enabling module mime.
Enabling module negotiation.
Enabling module setenvif.
Enabling module status.
Enabling module auth_basic.
Enabling module deflate.
Enabling module authz_default.
Enabling module authz_user.
Enabling module authz_groupfile.
Enabling module authn_file.
Enabling module authz_host.

Setting up apache2-mpm-worker (2.2.11-2ubuntu2.2) ...
* Starting web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
...done.

Setting up apache2 (2.2.11-2ubuntu2.2) ...
Setting up libdevel-symdump-perl (2.08-1) ...
Setting up libapache2-mod-perl2 (2.0.4-5ubuntu1) ...
Enabling module perl.
Run '/etc/init.d/apache2 restart' to activate new configuration!

Setting up libapache2-reload-perl (0.10-2) ...
Setting up libnet-daemon-perl (0.43-1) ...
Setting up libplrpc-perl (0.2020-1) ...
Setting up libdbi-perl (1.607-1) ...
Setting up libdbd-pg-perl (2.11.7-1) ...
Setting up libbsd-resource-perl (1.2901-1) ...
Processing triggers for libc6 ...
ldconfig deferred processing now taking place
root@luttappi:~#


5. Web based administration - PhpPgAdmin
***********************************************
root@luttappi:~# apt-get install phppgadmin
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common php5-pgsql postgresql-doc postgresql-doc-8.3
Suggested packages:
php-pear slony1-bin
The following packages will be REMOVED:
apache2-mpm-worker
The following NEW packages will be installed:
apache2-mpm-prefork libapache2-mod-php5 php5-common php5-pgsql phppgadmin postgresql-doc postgresql-doc-8.3
0 upgraded, 7 newly installed, 1 to remove and 184 not upgraded.
Need to get 6157kB of archives.
After this operation, 24.1MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://us.archive.ubuntu.com jaunty-updates/main apache2-mpm-prefork 2.2.11-2ubuntu2.2 [253kB]
Get:2 http://us.archive.ubuntu.com jaunty-updates/main php5-common 5.2.6.dfsg.1-3ubuntu4.1 [372kB]
Get:3 http://us.archive.ubuntu.com jaunty-updates/main libapache2-mod-php5 5.2.6.dfsg.1-3ubuntu4.1 [2615kB]
Get:4 http://us.archive.ubuntu.com jaunty-updates/main php5-pgsql 5.2.6.dfsg.1-3ubuntu4.1 [57.8kB]
Get:5 http://us.archive.ubuntu.com jaunty/main postgresql-doc-8.3 8.3.7-1 [1963kB]
Get:6 http://us.archive.ubuntu.com jaunty/main postgresql-doc 8.3.7-1 [3408B]
Get:7 http://us.archive.ubuntu.com jaunty/universe phppgadmin 4.2.2-1 [894kB]
Fetched 6157kB in 13s (463kB/s)
dpkg: apache2-mpm-worker: dependency problems, but removing anyway as you request:
apache2 depends on apache2-mpm-worker (>= 2.2.11-2ubuntu2.2) | apache2-mpm-prefork (>= 2.2.11-2ubuntu2.2) | apache2-mpm-event (>= 2.2.11-2ubuntu2.2); however:
Package apache2-mpm-worker is to be removed.
Package apache2-mpm-prefork is not installed.
Package apache2-mpm-event is not installed.
(Reading database ... 104442 files and directories currently installed.)
Removing apache2-mpm-worker ...
* Stopping web server apache2
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting ...done.
Selecting previously deselected package apache2-mpm-prefork.
(Reading database ... 104434 files and directories currently installed.)
Unpacking apache2-mpm-prefork (from .../apache2-mpm-prefork_2.2.11-2ubuntu2.2_amd64.deb) ...
Selecting previously deselected package php5-common.
Unpacking php5-common (from .../php5-common_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package libapache2-mod-php5.
Unpacking libapache2-mod-php5 (from .../libapache2-mod-php5_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package php5-pgsql.
Unpacking php5-pgsql (from .../php5-pgsql_5.2.6.dfsg.1-3ubuntu4.1_amd64.deb) ...
Selecting previously deselected package postgresql-doc-8.3.
Unpacking postgresql-doc-8.3 (from .../postgresql-doc-8.3_8.3.7-1_all.deb) ...
Selecting previously deselected package postgresql-doc.
Unpacking postgresql-doc (from .../postgresql-doc_8.3.7-1_all.deb) ...
Selecting previously deselected package phppgadmin.
Unpacking phppgadmin (from .../phppgadmin_4.2.2-1_all.deb) ...
Processing triggers for doc-base ...
Processing 23 changed, 1 added doc-base file(s)...
Registering documents with scrollkeeper...
Setting up apache2-mpm-prefork (2.2.11-2ubuntu2.2) ...
* Starting web server apache2
apache2: Syntax error on line 278 of /etc/apache2/apache2.conf: Could not open configuration file /etc/apache2/conf.d/phppgadmin: No such file or directory
...fail!
invoke-rc.d: initscript apache2, action "start" failed.

Setting up php5-common (5.2.6.dfsg.1-3ubuntu4.1) ...
Setting up libapache2-mod-php5 (5.2.6.dfsg.1-3ubuntu4.1) ...

Creating config file /etc/php5/apache2/php.ini with new version
Your apache2 configuration is broken, so we're not restarting it for you.

Setting up php5-pgsql (5.2.6.dfsg.1-3ubuntu4.1) ...

Setting up postgresql-doc-8.3 (8.3.7-1) ...

Setting up postgresql-doc (8.3.7-1) ...
Setting up phppgadmin (4.2.2-1) ...
* Reloading web server config apache2
root@luttappi:~#

6. PhpPgAdmin configuration file:
**************************************

root@luttappi:/usr/share/phppgadmin/conf# pwd
/usr/share/phppgadmin/conf
root@luttappi:/usr/share/phppgadmin/conf# ls -l config.inc.php
lrwxrwxrwx 1 root root 30 2009-08-10 13:24 config.inc.php -> /etc/phppgadmin/config.inc.php
root@luttappi:/usr/share/phppgadmin/conf#

7. Access:
************
http://localhost/phppgadmin

Tuesday, July 7, 2009

Menu Based - Time changing Script

I was working with few testers who need to change the system time occasionally on a linux box. Most of the time, they had problem while issuing the date command. Below one is a menu based shell script to update time on a linux box (xen guest in this case)

#!/bin/bash

Author : basil@
Purpose : Menu based date/time change of Linux boxes with ntpdate
Date : 04-20-2009

# Below kernel parameter is to allow xen guest take independent decision about its clock.

echo 1 > /proc/sys/xen/independent_wallclock

while :
do
clear
echo "-------------------------------------"
echo " Main Menu "
echo "-------------------------------------"
echo "[1] Show Todays date/time"
echo "[2] Change System time"
echo "[3] Show calendar"
echo "[4] Change System time to Current time"
echo "[5] Exit/Stop"
echo "======================="
echo -n "Enter your menu choice [1-5]: "
read yourch

case $yourch in
1) echo "Today is `date` , press Enter/Return key. . ." ; read ;;
2) echo "Enter new date and time [Format: MMDDHHMMYYYY]: ";read newtime ; date $newtime;echo "Today is `date`, , press Enter/Return key. . ." ; read ;;
3) /usr/bin/cal; echo "Press a key. . ." ; read ;;
4) echo "Updating to Current time..."; `/usr/sbin/ntpdate -s clock.redhat.com`;echo "Today is `date`, , press Enter/Return key. . ." ; read ;;
5) exit 0 ;;
*) echo "Opps!!! Please select choice 1,2,3 or 4";
echo "Press Enter/Return key. . ." ; read ;;

esac
done

Monday, July 6, 2009

Time Sync issues - VMware Guest Hosts




I was damn tired of time sync issues related to guest hosts running on top of VMware ESX 3.5 host. Even though I have installed ntp client on all the servers, but still the guest OS's are running out of Sync.





NTP Recommendations

Note: In all cases use NTP instead of VMware Tools periodic time synchronization. Also, you may need to open the firewall (UPD 123) to allow NTP traffic.
The following is a sample /etc/ntp.conf :
tinker panic 0
restrict 127.0.0.1
restrict default kod nomodify notrap
server 0.vmware.pool.ntp.org
server 1.vmware.pool.ntp.org
server 2.vmware.pool.ntp.org
driftfile /var/lib/ntp/drift
The following is a sample /etc/ntp/step-tickers :
0.vmware.pool.ntp.org
1.vmware.pool.ntp.org
The configuration directive tinker panic 0 instructs NTP not to give up if it sees a large jump in time. This is important for coping with large time drifts and also resuming virtual machines from their suspended state.
Note: The directive tinker panic 0 must be at the top of the ntp.conf file.
It is also important not to use the local clock as a time source, often referred to as the Undisciplined Local Clock. NTP has a tendency to fall back to this in preference to the remote servers when there is a large amount of time drift.
An example of such a configuration is:
server 127.127.1.0
fudge 127.127.1.0 stratum 10
Comment out both lines.
After making changes to NTP configuration, the NTP daemon must be restarted. Refer to your operating system vendor’s documentation.

VMware Tools time synchronization configuration

When using NTP in the guest, disable VMware Tools periodic time synchronization.
To disable VMware Tools periodic time sync you use one of the following options:
  1. Set tools.syncTime = "0" in the configuration file (.vmx file) of the virtual machine.

    OR

  2. Deselect Time synchronization between the virtual machine and the host operating system in the VMware Tools toolbox GUI of the guest operating system.

    OR

  3. Run the vmware-guestd --cmd "vmx.set_option synctime 1 0" command in the guest operating system.
These options do not disable one-time synchronizations done by VMware Tools for events such as tools startup, taking a snapshot, resuming from a snapshot, resuming from suspend, or VMotion. These events synchronize time in the guest operating system with time in the host operating system, so it is important to make sure that the host operating system's time is correct.
To do this for VMware ACE, VMware Fusion, VMware GSX Server, VMware Player, VMware Server, and VMware Workstation run time synchronization software such as NTP or w32time in the host. For VMware ESX run NTP in the service console. For VMware ESXi, run NTP in the VMkernel.

Virtual Hardware clock configuration

When configuring the Linux guest operating system, if you are given a choice between keeping the “hardware” clock (that is, the virtual CMOS time of day clock) in UTC or local time, choose UTC. This avoids any confusion when your local time changes between standard and daylight saving time (in England, "summer time").


64bit Kernels

Linux Flavor
Version
Kernel Parameters
Notes
RHEL

RHEL 5.3 notsc divider=10
RHEL 5.2
notsc divider=10
RHEL 5.1 with RHSA-2007:0993-13
notsc divider=10
RHEL 5.1 without RHSA-2007:0993-13
notsc


32bit Kernels

Linux Flavor Version Kernel Parameters Notes
RHEL



RHEL 5.3 divider=10 clocksource=acpi_pm

RHEL 5.2 divider=10 clocksource=acpi_pm

RHEL 5.1 divider=10 clocksource=acpi_pm

RHEL 5.0 clocksource=acpi_pm

Editing Kernel Configuration

Kernel command line parameters are specified in the /etc/lilo.conf or /boot/grub/grub.conf file, depending on your choice of boot loader.

For LILO, put the kernel command line parameters at the end of the "append" line. For example, if the append line looks like:

append="resume=/dev/hda6 splash=silent"

and you want to add "clock=pmtmr divider=10" the updated text is:

append="resume=/dev/hda6 splash=silent clock=pmtmr divider=10"

Remember to run /sbin/lilo after editing lilo.conf , so that your edits take effect.

For GRUB, put the kernel command line parameters at the end of the "kernel" line. For example if the kernel line looks like:

kernel /vmlinuz-2.6.18 ro root=/dev/hda2

and you want to add "clock=pmtmr divider=10" the updated text is:

kernel /vmlinuz-2.6.18 ro root=/dev/hda2 clock=pmtmr divider=10


Below given is the best practice, for time related issues on VMware guests.

http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006427

Wednesday, June 17, 2009

TCP - CONNECTION

Connection State Definition:
----------------------------------

ESTABLISHED – both hosts are connected
CLOSING – the remote host is closing the connection
LISTENING – the host is listening for incoming connections
SYN_RCVD – a remote host has asked to start a connection
SYN_SENT – the host is starting a new connection
LAST_ACK – the host must send a report before closing the connection
TIMED_WAIT, CLOSE_WAIT – a remote host is terminating the connection
FIN_WAIT 1 – the client is terminating the connection
FIN_WAIT 2 – both hosts are closing the connection

TCP cutter : http://www.cyberciti.biz/tips/cutting-the-tcpip-network-connection-with-cutter.html
TCPKILL : http://www.cyberciti.biz/howto/question/linux/kill-tcp-connection-using-linux-netstat.php

Parameters which can be configured on Kernel:
-----------------------------------------------------------

From the link :http://www.cs.uwaterloo.ca/~brecht/servers/ip-sysctl.txt

/proc/sys/net/ipv4/* Variables:

ip_forward - BOOLEAN
0 - disabled (default)
not 0 - enabled

Forward Packets between interfaces.

This variable is special, its change resets all configuration
parameters to their default state (RFC1122 for hosts, RFC1812
for routers)

ip_default_ttl - INTEGER
default 64

ip_no_pmtu_disc - BOOLEAN
Disable Path MTU Discovery.
default FALSE

IP Fragmentation:

ipfrag_high_thresh - INTEGER
Maximum memory used to reassemble IP fragments. When
ipfrag_high_thresh bytes of memory is allocated for this purpose,
the fragment handler will toss packets until ipfrag_low_thresh
is reached.

ipfrag_low_thresh - INTEGER
See ipfrag_high_thresh

ipfrag_time - INTEGER
Time in seconds to keep an IP fragment in memory.

INET peer storage:

inet_peer_threshold - INTEGER
The approximate size of the storage. Starting from this threshold
entries will be thrown aggressively. This threshold also determines
entries' time-to-live and time intervals between garbage collection
passes. More entries, less time-to-live, less GC interval.

inet_peer_minttl - INTEGER
Minimum time-to-live of entries. Should be enough to cover fragment
time-to-live on the reassembling side. This minimum time-to-live is
guaranteed if the pool size is less than inet_peer_threshold.
Measured in jiffies.

inet_peer_maxttl - INTEGER
Maximum time-to-live of entries. Unused entries will expire after
this period of time if there is no memory pressure on the pool (i.e.
when the number of entries in the pool is very small).
Measured in jiffies.

inet_peer_gc_mintime - INTEGER
Minimum interval between garbage collection passes. This interval is
in effect under high memory pressure on the pool.
Measured in jiffies.

inet_peer_gc_maxtime - INTEGER
Minimum interval between garbage collection passes. This interval is
in effect under low (or absent) memory pressure on the pool.
Measured in jiffies.

TCP variables:

tcp_syn_retries - INTEGER
Number of times initial SYNs for an active TCP connection attempt
will be retransmitted. Should not be higher than 255. Default value
is 5, which corresponds to ~180seconds.

tcp_synack_retries - INTEGER
Number of times SYNACKs for a passive TCP connection attempt will
be retransmitted. Should not be higher than 255. Default value
is 5, which corresponds to ~180seconds.

tcp_keepalive_time - INTEGER
How often TCP sends out keepalive messages when keepalive is enabled.
Default: 2hours.

tcp_keepalive_probes - INTEGER
How many keepalive probes TCP sends out, until it decides that the
connection is broken. Default value: 9.

tcp_keepalive_interval - INTEGER
How frequently the probes are send out. Multiplied by
tcp_keepalive_probes it is time to kill not responding connection,
after probes started. Default value: 75sec i.e. connection
will be aborted after ~11 minutes of retries.

tcp_retries1 - INTEGER
How many times to retry before deciding that something is wrong
and it is necessary to report this suspection to network layer.
Minimal RFC value is 3, it is default, which corresponds
to ~3sec-8min depending on RTO.

tcp_retries2 - INTEGER
How may times to retry before killing alive TCP connection.
RFC1122 says that the limit should be longer than 100 sec.
It is too small number. Default value 15 corresponds to ~13-30min
depending on RTO.

tcp_orphan_retries - INTEGER
How may times to retry before killing TCP connection, closed
by our side. Default value 7 corresponds to ~50sec-16min
depending on RTO. If you machine is loaded WEB server,
you should think about lowering this value, such sockets
may consume significant resources. Cf. tcp_max_orphans.

tcp_fin_timeout - INTEGER
Time to hold socket in state FIN-WAIT-2, if it was closed
by our side. Peer can be broken and never close its side,
or even died unexpectedly. Default value is 60sec.
Usual value used in 2.2 was 180 seconds, you may restore
it, but remember that if your machine is even underloaded WEB server,
you risk to overflow memory with kilotons of dead sockets,
FIN-WAIT-2 sockets are less dangerous than FIN-WAIT-1,
because they eat maximum 1.5K of memory, but they tend
to live longer. Cf. tcp_max_orphans.

tcp_max_tw_buckets - INTEGER
Maximal number of timewait sockets held by system simultaneously.
If this number is exceeded time-wait socket is immediately destroyed
and warning is printed. This limit exists only to prevent
simple DoS attacks, you _must_ not lower the limit artificially,
but rather increase it (probably, after increasing installed memory),
if network conditions require more than default value.

tcp_tw_recycle - BOOLEAN
Enable fast recycling TIME-WAIT sockets. Default value is 1.
It should not be changed without advice/request of technical
experts.

tcp_max_orphans - INTEGER
Maximal number of TCP sockets not attached to any user file handle,
held by system. If this number is exceeded orphaned connections are
reset immediately and warning is printed. This limit exists
only to prevent simple DoS attacks, you _must_ not rely on this
or lower the limit artificially, but rather increase it
(probably, after increasing installed memory),
if network conditions require more than default value,
and tune network services to linger and kill such states
more aggressively. Let me to remind again: each orphan eats
up to ~64K of unswappable memory.

tcp_abort_on_overflow - BOOLEAN
If listening service is too slow to accept new connections,
reset them. Default state is FALSE. It means that if overflow
occurred due to a burst, connection will recover. Enable this
option _only_ if you are really sure that listening daemon
cannot be tuned to accept connections faster. Enabling this
option can harm clients of your server.

tcp_syncookies - BOOLEAN
Only valid when the kernel was compiled with CONFIG_SYNCOOKIES
Send out syncookies when the syn backlog queue of a socket
overflows. This is to prevent against the common 'syn flood attack'
Default: FALSE

Note, that syncookies is fallback facility.
It MUST NOT be used to help highly loaded servers to stand
against legal connection rate. If you see synflood warnings
in your logs, but investigation shows that they occur
because of overload with legal connections, you should tune
another parameters until this warning disappear.
See: tcp_max_syn_backlog, tcp_synack_retries, tcp_abort_on_overflow.

syncookies seriously violate TCP protocol, do not allow
to use TCP extensions, can result in serious degradation
of some services (f.e. SMTP relaying), visible not by you,
but your clients and relays, contacting you. While you see
synflood warnings in logs not being really flooded, your server
is seriously misconfigured.

tcp_stdurg - BOOLEAN
Use the Host requirements interpretation of the TCP urg pointer field.
Most hosts use the older BSD interpretation, so if you turn this on
Linux might not communicate correctly with them.
Default: FALSE

tcp_max_syn_backlog - INTEGER
Maximal number of remembered connection requests, which are
still did not receive an acknowledgement from connecting client.
Default value is 1024 for systems with more than 128Mb of memory,
and 128 for low memory machines. If server suffers of overload,
try to increase this number. Warning! If you make it greater
than 1024, it would be better to change TCP_SYNQ_HSIZE in
include/net/tcp.h to keep TCP_SYNQ_HSIZE*16<=tcp_max_syn_backlog
and to recompile kernel.

tcp_window_scaling - BOOLEAN
Enable window scaling as defined in RFC1323.

tcp_timestamps - BOOLEAN
Enable timestamps as defined in RFC1323.

tcp_sack - BOOLEAN
Enable select acknowledgments (SACKS).

tcp_fack - BOOLEAN
Enable FACK congestion avoidance and fast restransmission.
The value is not used, if tcp_sack is not enabled.

tcp_dsack - BOOLEAN
Allows TCP to send "duplicate" SACKs.

tcp_ecn - BOOLEAN
Enable Explicit Congestion Notification in TCP.

tcp_reordering - INTEGER
Maximal reordering of packets in a TCP stream.
Default: 3

tcp_retrans_collapse - BOOLEAN
Bug-to-bug compatibility with some broken printers.
On retransmit try to send bigger packets to work around bugs in
certain TCP stacks.

tcp_wmem - vector of 3 INTEGERs: min, default, max
min: Amount of memory reserved for send buffers for TCP socket.
Each TCP socket has rights to use it due to fact of its birth.
Default: 4K

default: Amount of memory allowed for send buffers for TCP socket
by default. This value overrides net.core.wmem_default used
by other protocols, it is usually lower than net.core.wmem_default.
Default: 16K

max: Maximal amount of memory allowed for automatically selected
send buffers for TCP socket. This value does not override
net.core.wmem_max, "static" selection via SO_SNDBUF does not use this.
Default: 128K

tcp_rmem - vector of 3 INTEGERs: min, default, max
min: Minimal size of receive buffer used by TCP sockets.
It is guaranteed to each TCP socket, even under moderate memory
pressure.
Default: 8K

default: default size of receive buffer used by TCP sockets.
This value overrides net.core.rmem_default used by other protocols.
Default: 87380 bytes. This value results in window of 65535 with
default setting of tcp_adv_win_scale and tcp_app_win:0 and a bit
less for default tcp_app_win. See below about these variables.

max: maximal size of receive buffer allowed for automatically
selected receiver buffers for TCP socket. This value does not override
net.core.rmem_max, "static" selection via SO_RCVBUF does not use this.
Default: 87380*2 bytes.

tcp_mem - vector of 3 INTEGERs: min, pressure, max
low: below this number of pages TCP is not bothered about its
memory appetite.

pressure: when amount of memory allocated by TCP exceeds this number
of pages, TCP moderates its memory consumption and enters memory
pressure mode, which is exited when memory consumtion falls
under "low".

high: number of pages allowed for queueing by all TCP sockets.

Defaults are calculated at boot time from amount of available
memory.

tcp_app_win - INTEGER
Reserve max(window/2^tcp_app_win, mss) of window for application
buffer. Value 0 is special, it means that nothing is reserved.
Default: 31

tcp_adv_win_scale - INTEGER
Count buffering overhead as bytes/2^tcp_adv_win_scale
(if tcp_adv_win_scale > 0) or bytes-bytes/2^(-tcp_adv_win_scale),
if it is <= 0.
Default: 2

ip_local_port_range - 2 INTEGERS
Defines the local port range that is used by TCP and UDP to
choose the local port. The first number is the first, the
second the last local port number. Default value depends on
amount of memory available on the system:
> 128Mb 32768-61000
< 128Mb 1024-4999 or even less.
This number defines number of active connections, which this
system can issue simultaneously to systems not supporting
TCP extensions (timestamps). With tcp_tw_recycle enabled
(i.e. by default) range 1024-4999 is enough to issue up to
2000 connections per second to systems supporting timestamps.

icmp_echo_ignore_all - BOOLEAN
icmp_echo_ignore_broadcasts - BOOLEAN
If either is set to true, then the kernel will ignore either all
ICMP ECHO requests sent to it or just those to broadcast/multicast
addresses, respectively.

icmp_destunreach_rate - INTEGER
icmp_paramprob_rate - INTEGER
icmp_timeexceed_rate - INTEGER
icmp_echoreply_rate - INTEGER (not enabled per default)
Limit the maximal rates for sending ICMP packets to specific targets.
0 to disable any limiting, otherwise the maximal rate in jiffies(1)
See the source for more information.

icmp_ignore_bogus_error_responses - BOOLEAN
Some routers violate RFC 1122 by sending bogus responses to broadcast
frames. Such violations are normally logged via a kernel warning.
If this is set to TRUE, the kernel will not give such warnings, which
will avoid log file clutter.
Default: FALSE

(1) Jiffie: internal timeunit for the kernel. On the i386 1/100s, on the
Alpha 1/1024s. See the HZ define in /usr/include/asm/param.h for the exact
value on your system.

conf/interface/*:
conf/all/* is special and changes the settings for all interfaces.
Change special settings per interface.

log_martians - BOOLEAN
Log packets with impossible addresses to kernel log.

accept_redirects - BOOLEAN
Accept ICMP redirect messages.
default TRUE (host)
FALSE (router)

forwarding - BOOLEAN
Enable IP forwarding on this interface.

mc_forwarding - BOOLEAN
Do multicast routing. The kernel needs to be compiled with CONFIG_MROUTE
and a multicast routing daemon is required.

proxy_arp - BOOLEAN
Do proxy arp.

shared_media - BOOLEAN
Send(router) or accept(host) RFC1620 shared media redirects.
Overrides ip_secure_redirects.
default TRUE

secure_redirects - BOOLEAN
Accept ICMP redirect messages only for gateways,
listed in default gateway list.
default TRUE

send_redirects - BOOLEAN
Send redirects, if router. Default: TRUE

bootp_relay - BOOLEAN
Accept packets with source address 0.b.c.d destined
not to this host as local ones. It is supposed, that
BOOTP relay daemon will catch and forward such packets.

default FALSE
Not Implemented Yet.

accept_source_route - BOOLEAN
Accept packets with SRR option.
default TRUE (router)
FALSE (host)

rp_filter - BOOLEAN
1 - do source validation by reversed path, as specified in RFC1812
Recommended option for single homed hosts and stub network
routers. Could cause troubles for complicated (not loop free)
networks running a slow unreliable protocol (sort of RIP),
or using static routes.

0 - No source validation.

Default value is 0. Note that some distributions enable it
in startip scripts.



Wednesday, April 15, 2009

VMware: vmware-vdiskmanager utility

vmware-vdiskmanager utility usages:
***********************************

vmware-vdiskmanager -r source.vmdk -t 0 dest.vmdk

-k for shrinking

Use the vmware-vdiskmanager -x command to set the correct size of the volume you want.

Usage: vmware-vdiskmanager OPTIONS diskName | drive-letter:

Offline disk manipulation utility
Options:
-c : create disk; need to specify other create options
-d : defragment the specified virtual disk
-k : shrink the specified virtual disk
-n : rename the specified virtual disk; need to
specify destination disk-name
-p : prepare the mounted virtual disk specified by
the drive-letter for shrinking
-q : do not log messages
-r : convert the specified disk; need to specify
destination disk-type
-x : expand the disk to the specified capacity

Additional options for create and convert:
-a : (for use with -c only) adapter type(ide, buslogic or lsilogic)
-s : capacity of the virtual disk
-t : disk type id

Disk types:
0 : single growable virtual disk
1 : growable virtual disk split in 2Gb files
2 : preallocated virtual disk
3 : preallocated virtual disk split in 2Gb files

The capacity can be specified in sectors, Kb, Mb or Gb.
The acceptable ranges:
ide adapter : [100.0Mb, 128.0Gb]
scsi adapter: [100.0Mb, 256.0Gb]
ex 1: vmware-vdiskmanager.exe -c -s 850Mb -a ide -t 0 myIdeDisk.vmdk
ex 2: vmware-vdiskmanager.exe -d myDisk.vmdk
ex 3: vmware-vdiskmanager.exe -r sourceDisk.vmdk -t 0 destinationDisk.vmdk
ex 4: vmware-vdiskmanager.exe -x 36Gb myDisk.vmdk
ex 5: vmware-vdiskmanager.exe -n sourceName.vmdk destinationName.vmdk
ex 6: vmware-vdiskmanager.exe -k myDisk.vmdk
ex 7: vmware-vdiskmanager.exe -p m:
(A virtual disk first needs to be mounted at m:
using the VMware Diskmount Utility.)

Thursday, April 9, 2009

Mitel 3300 ICP and Polycom IP7000





It was a tough day for a me to plug IP 7000 on Mitel 3300 ICP. Even though mitel support the SIP protocols, it was not just a plug and play game.

Steps are pretty simple

1. Go to ' Licensing and Option Selection' of controller - Make sure that you have enough SIP licenses on Mitel ICP
2. Multiline IP set configuration - Add a new device as 'Generic SIP' - Include a security pin number and intended Phone number
3. Next one is a tedious task - Create a "Class of Service Assignment" - Need to spend some time on this to enable the features needed for your phone. Few docs are available on Mitel site for this.
4. Then do some adjustments in "Sip Device Capability assignment" - There is a catch here! If you are not using the latest ICP version (Above 9.0), you will not be seeing all the SIP features avaiable on IP 7000. I had tough time while configuring IP 7000 for multi line conferencing capability because of the unavailable options on the older version.
Disable Reliable Provisional Responses (Yes)

Force sending SDP in initial Invite message (Yes)
Suppress Use of SDP Inactive Media Streams (No)
Renegotiate SDP To Enforce Symmetric Codec (No)
Allow Device To Use Multiple Active M-Lines (Yes) --> This option need to be enabled (which is available on 9.0 UR1 version)

5. "Multi Line Set Key Assignment" - To configure multiple lines on the phone - a straight forward process.
6. "Station Service Assignment" - Assign the configured "Sip Capabilities" to the newly configured device
7. Boot up IP7000
Go to the Status and TCP Parameters and find the IP of the device.
Access the Device using http://x.x.x.x and follow the simple configuration available on Polycom Site
8. Change the dial plan if necessary to match your ICP settings

www.polycom.com/global/documents/support/setup_maintenance/products/voice/soundstation_ip_7000_qsg_english_rev_b.pdf

It is bit more tougher than these simple steps...;) ..
Enjooy.