Thursday, January 31, 2008

Asterisk Installation

I install an Asterisk PBX from source code on a newly installed Debian system.I am using Debian Etch (4.0) . login as root during the whole process in order to complete all installations properly.

upgrade the system to the latest package versions:
# apt-get update
# apt-get dist-upgrade

To make things install properly, please install the following packages:
# apt-get install acpid \
apache2 \
apache2.2-common \
apache2-mpm-prefork \
apache2-utils \
bison \
bzip2 \
doxygen \
festival \
festival-dev \
gcc \
graphviz \
gsfonts \
less \
libapache2-mod-php5 \
libcurl3 \
libcurl3-dev \
libdbd-mysql-perl \
libedit2 \
libedit-dev \
libeditline0 \
libeditline-dev \
libgcrypt11 \
libmcrypt4 \
libmcrypt-dev \
libmhash2 \
libmysqlclient15-dev \
libmysqlclient15off \
libncurses5 \
libncurses5-dev \
libnewt0.52 \
libnewt-dev \
libspeex1 \
libspeex-dev \
libssl0.9.7 \
libssl-dev \
linux-headers-2.6-686 \
linux-image-2.6-686 \
lrzsz \
make \
mc \
mcrypt \
mysql-server \
ngrep \
openssh-server \
openssl \
patch \
php5-cgi \
php5-cli \
php5-common \
php5-gd \
php5-mcrypt \
php5-mysql \
phpmyadmin \
php-pear \
tofrodos \
zlib1g-dev
Download

We now continue to download the recent sources to "/var/download" and unpack them to "/usr/src"

Compile and Install

ZapTel

The first package I have to install is zaptel. Zaptel is a collection of kernel drivers and configuration utilities for Digium hardware such as analog and digital telephony interface cards. Zaptel also offers the ztdummy kernel module which allows you to run Asterisk without any telephony hardware, it makes use of the kernel realtime clock (RTC) interface. This has to be used when using Asterisk installations with multiple concurrent calls.

LibPri

LibPri is a mandatory library, Asterisk makes use of when taking to telephony hardware or timing interfaces, even if it is the ztdummy interface.

Asterisk

This is the Asterisk software itself, I build and install it with the following commands


Asterisk-AddOns

The Asterisk-addons are needed to
- offer MySQL storage of CDRs
- enable ARA (Asterisk Realtime Architecture) to store SIP and IAX users/peers in MySQL
- enabling MP3 format in soundfiles and voicemail

Installation of Asterisk GUI

In order to install "Asterisk GUI" you'll need:
Concurrent Versions System (CVS)
asterisk 1.4 - and all modules needed to compile and install asterisk 1.4

Go to your installation directory (for example '/usr/src') and download the latest version of asterisk-gui. To do this just execute the command:
svn checkout http://svn.digium.com/svn/asterisk-gui/trunk asterisk-gui

Enter this directory and compile the sources by executing the command `make`
Then distribute the compiled code by executing the command `make install`. With this step you will finish the installation of the asterisk-gui.

Configuration

It is recommended to back up your configuration files before you continue. To achieve this just copy /etc/asterisk under different name:
cp -r /etc/asterisk /etc/asterisk.backup
It is recommended to `install samples`. This command will modify some of your Asterisk configuration files. After that you'll have finish the configuration modification manually.

There are two files which you should modify:
`manager.conf`
[general]
displaysystemname = yes
enabled = yes
webenabled = yes
port = 5038
httptimeout = 60
bindaddr = 0.0.0.0

We will have to add a new user to `manager.conf`:
[administrator]
secret = pubudu
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config


`http.conf`
enabled=yes
enablestatic=yes
bindaddr=0.0.0.0
bindport=8088

After that run `make checkconfig` in your asterisk-gui directory. This script will check if your GUI is correctly configured.

Running asterisk-gui

In order to load the asterisk-gui, asterisk must restart/reload. You can reload your Asterisk server from your CLI console by executing the command `reload`. You can use asterisk-gui from these addresses (10.100.100.75 is our Asterisk server IP address):
http://10.100.100.75:8088/asterisk/static/config/cfgbasic.html
http://10.100.100.75:8088/asterisk/static/config/cfgadvanced.html





Introduction to Asterisk

In my internship I got chance to deal with AVAYA products,which are utilized in call centers.I did some projects on AVAYA as real customer solutions.Knowledge of Avaya systems leads me to develop a soft pbx system call Asterisk.

Asterisk is an “Open Source PBX software”.Asterisk can also be used as an application server for the existing PBX or it can be directly connected to PSTN. Asterisk can do services like voicemail, fax reception, call recording, IVR connected to a database, and audio conferencing server.The main feature of the Asterisk hardware is the use of the PC CPU to process media streaming, echo cancellation and transcoding.

Signaling protocols Asterisk supports:

  • SIP
  • H323
  • IAXv1 e v2
  • MGCP
  • SCCP (Cisco Skinny)
  • Nortel unistim
Asterisk is an open source PBX that acts like a hybrid PBX, integrating technologies such as TDM and IP telephony. Asterisk is ready for IVR (Interactive Voice Response) functionality and ACD (Automatic call distribution).

NetApp active/active storage controller configuration

I have connected new disk shelf to the john keels SAN.So I learn about how to loop them and use the method multi-path storage.The controlling node was a 3050 controller.
Each of the two identical storage controllers within the active/active configuration serves data independently during normal operation, but in the event of individual storage controller failure, the data service process transfers from the failed storage controller to the surviving
partner(work also in hardware failures).

The active/active controller configuration consists of a pair of matching FAS storage controllers (local node and partner node); each of these nodes must be connected to the other’s disk shelves.The Data ONTAP and interconnect adapters on each node must be identical and configured with the same firmware version.Data ONTAP on each node monitors the availability status of its partner by means of a heartbeat signal transmitted between the storage controllers,then stores this information on specialized mailbox disks.The NVRAM data of each controller node is always mirrored on the partner node.Only half of the NVRAM in the controller is dedicated to the local node,other half reserves for the partner node’s data to ensure that exactly the same data exists in NVRAM on both storage controllers. If fail over occurs, when the surviving node takes over the failed node, all WAFL checkpoints stored in NVRAM are flushed to disk. The surviving node then combines the split NVRAM and recovers the lost performance.
Once the surviving node restores disk control and data processing to the recovered failed node, all NVRAM data belonging to the partner node is flushed to disk during the course of the giveback operation.

Active controller configuration methods

1.standard active controller
2.active controller with syncmirror
3.Metro cluster
4.Multi-path HA storage

Multi-path HA storage

The Multi path HA Storage solution significantly improves data availability and performance consistency by providing multiple redundant paths to the storage shelves.This prevents fail overs and increase bandwidth of shelves.Multipath support is provided with Data ONTAP 7.1.1, 7.2.1, and higher(FAS3050 supports but FAS270c is not).Here Primary and secondary loops must use separate Fiber Channel adapters.Storage shelves must be equipped with controller modules providing auto-termination functionality(ESH2).Also we have to set software-based disk ownership (SANOWN).
NetApp storage controllers and disk shelves are equipped with redundant power supply modules. By connecting each of the two power supplies within a device to separate power circuits or PDUs (power distribution units), devices are protected from single circuit power failures.

Thursday, January 17, 2008

Configure Squid

The main Squid configuration file is squid.conf(/etc/squid/squid.conf), and, like most Linux applications, Squid needs to be restarted for changes to the configuration file

# service squid start
# service squid stop
# service squid restart

Some basic configurations are to be done. Uncomment and edit the following lines in the configuration file found default at "/usr/local/squid/etc/squid.conf".
cache_dir this direcitve specifies the cache directory storage format and its size as given below.
cache_dir ufs /usr/local/squid/cache 100 16 256
The value 100 denotes 100MB cache size. This can be adjusted to the required size.

http_port
Check http_port, 3128 is a default.

http_access
By default http_access is denied. The ACL rules should be modified to allow access only to the trusted clients. This is important because it prevents people from stealing your network resources.

cache_effective_user & cache_effective_ group
Set these directive to the user and group by which squid will run. This user should have the permission to read and write in the cache directory and to the log files.

Each Access list(ACL) line defines a particular type of activity, such as an access time or source network, they are then linked to an http_access statement that tells Squid to deny or allow traffic that matches the ACL.
Squid matches each Web access request by checking the http_access list from top to bottom.We should not to place a deny statement in the list that blocks a similar allow statement below it.so when placing a new http_access statements better to place it above the final http_access statement.

To restrict the usage with in bussiness hours
#
acl our_network src 192.168.10.0/24
acl business_hours time M T W H F 8:30-17:00
acl RestrictedHost src 192.168.1.23

# Add this at the top of the http_access section of squid.conf
#
http_access deny RestrictedHost
http_access allow our_network business_hours

Allowing 192.168.10.0 subnet to acess

acl home_network src 192.168.10.0/255.255.255.0
http_access allow home_network

For Configuring squid for proxy

By default, squid is configured as a direct proxy . In order to cache web traffic with squid, the browser must be configured to use the squid proxy. This needs the following information

i. the proxy server's host name
ii. the port by which the proxy server accepts connections.

Air-conditioner


An air conditioner is basically a refrigerator without the insulated box.The mechanics of the Freon evaporation cycle are the same in a refrigerator as in an air conditioner.

  1. The compressor compresses cool Freon gas, causing it to become hot, high-pressure Freon gas (red in the diagram above).
  2. This hot gas runs through a set of coils so it can dissipate its heat, and it condenses into a liquid.
  3. The Freon liquid runs through an expansion valve, and in the process it evaporates to become cold, low-pressure Freon gas (light blue in the diagram above).
  4. This cold gas runs through a set of coils that allow the gas to absorb heat and cool down the air inside the building.
A window air conditioner unit implements a complete air conditioner in a small space.

Storage networking appliance

In my internship I got chance to deal closely with netapp systems.There I find interesting feature call snapshot,which is very useful to administrators to restore systems when something goes wrong.

Benefits of storage appliances


  1. Easy to administration- File systems grow automatically when new disk are added.Logical partitions can be expanded and shrunk dynamically.Can take snapshots anytime(read only view of WAFL volume).
  2. Increase performance by reducing complexity at a reasonable cost.
  3. Data availability-RAID is used to protect data against data loss occured by disk failures.Snapshot, SnapMirror, SnapRestore can used as instant recovery.
  4. development and scalability.
Storage appliance architecture

The storage appliance provides block-level data access over a Fiber Channel SAN fabric using FCP and over an IP-based Ethernet network using iSCSI. File access protocols such as NFS, CIFS, HTTP, or FTP provide file-level access over an IP-based Ethernet network.WAFL(the storage appliance's file system) and RAID were designed together to avoid the performance problems that most file systems cause with RAID.WAFL makes RAID4 operate efficiently,WAFL always writes blocks to stripes that are near each other, eliminating long seeks on the parity disk.

WAFL(Write anywhere file layout)
  1. WAFL is block based, using 4KB blocks with no fragments.
  2. WAFL uses inodes to describe its files.
  3. Directories are specially formatted files.
WAFL uses files to store meta data,which allows mata-data blocks to be written anywhere on disk.WAFL introduced a new building block known as flexible volumes.

Snapshot technology

This is a benefit of the WAFL write anywhere approach. A Snapshot copy is an online, read-only copy of the entire file system(it takes less than 1 second time).A Snapshot copy can be used as an online backup capability(to tape), allowing users to recover their own files.

(a) is a simplified diagram of the file system, with a root structure at the top pointing to disk blocks.
(b) Snapshot copy being created by duplicating the root structure.
(c) shows block C being updated, so that the file system points to new data in C' while the Snapshot copy still points to the original data in C.

Every directory in the file system contains a special subdirectory that allows users to access the Snapshot copy.And the .snapshot directories are "hidden" in the sense that they do not show up in directory listings.
At least once every 10 seconds WAFL generates an internal Snapshot copy called a consistency point.When the storage appliance boots, WAFL always uses the most recent consistency point on disk, which means that even after power loss or system failure there is no need for time consuming file system checks.And also uses battery-backed up non-volatile RAM (NVRAM) to avoid losing any data input/output requests that might have occurred after the most recent consistency point.

RAID: Redundant Array of Inexpensive Disks

The storage appliance uses either RAID Level 4, which stores all parity information on a single disk, or RAID-DP, which stores all parity information on two disks to protect against disk failures.With RAID 4,when a disk fails the parity disk is used to recalculate its contents automatically after the disk is replaced.
The parity block is basically the sum of the blocks in the stripe.
Parity=15 Data 1=4 Data 2=5 Data 3=6
The RAID system uses EXCLUSIVE-OR instead of addition and subtraction.RAID-DP can recover from double disk-failure while allowing the RAID group to continue serving data and recreate data lost from up to two failed disks.

Other RAID levels

RAID 3,uses a single parity disk and systems often keep the disk heads synchronized to reduce latency.So RAID 3 is a good fit for applications that require a very high data rate for a single large file(super-computing and graphics processing).
RAID5 is like RAID4, but it cycles parity among all of the disks in the array.The primary disadvantage is that it is not practical to add a single disk to a RAID5 array because to add new disks,a new array must be added.

Monday, January 14, 2008

The squid Proxy Server

The squid proxy server is a caching proxy server compatible with FTP,
HTTP, and SSL.
1.Reduce bandwidth demands due to multiple requests for popular
Web pages.
2.Control access to external Web sites by means of Access Control Lists
(ACLs).
3.Accelerate an HTTP server.

To accelerate an HTTP server, the proxy typically runs on port 80, the
usual HTTP port.The default configuration file is /etc/squid/squid.conf.

To start the service:
service squid start

To configure a Web browser to use squid, set the browser’s proxy host to the host name of the system running squid and set the proxy port to the port on which squid is running, generally 3128.

Setting hostname

Squid will fail to start if you don't give your server a hostname.Here, I set the hostname to the real name of the server pubudu.
If you have a static IP address, then /etc/hosts is configured as follows:

127.0.0.1 localhost.localdomain localhost
192.168.10.110 pubudu.mydomain.com pubudu

After updating the /etc/hosts file correctly, the "hostname" command should be run as follows to set your hostname:

hostname pubudu.mydomain.com

test using hostname -a

Since this is a static IP address, then /etc/sysconfig/network is configured as follows:

NETWORKING=yes
HOSTNAME="mybox.mydomain.com"

This is checked with the following command:

cat /proc/sys/kernel/hostname

Friday, January 11, 2008

FTP server

FTP server lets users upload and download files and directories.
The FTP daemon is named /usr/sbin/in.ftpd.
Three levels of FTP access are provided:
1.User access, access by users who have a login account on the server host.
2.Guest access, access by users who have a special guest account that
provides only FTP access.
3.Anonymous access, access by users who have no defined account on the
server host.

FTP server is distributed as two packages:
1. wu-ftpd, which contains the FTP server
2. nonftp, which contains the anonymous FTP server

The FTP service has three basic configuration files:
1. /etc/ftpaccess, which specifies global options and user permissions
2. /etc/ftphosts, which specifies client hosts that may or may not
access the FTP service
3. /etc/ftpusers, which specifies users who may not access the FTP service.

By default, the FTP service is run as an inetd service. Thus, it is not necessary
to start, restart, or stop the service.

BIND Name Server

The Berkeley Internet Name Daemon (BIND) resolves IP addresses to host names and host names to IP addresses. This service is often called Domain
Name Service (DNS).
Red Hat Linux includes these BIND-related packages:
1. bind, which provides a regular DNS server
2. bind-utils, a set of useful utilities for administering BIND.
3. caching-nameserver, which configures BIND to provide a cachingonly name server.

BIND Configuration

To establish DNS,/etc/named.conf should be configured.We must also configure a set of files known as zone files.The contents of a correct named.ca hint file can be obtained via FTP from
ftp://ftp.rs.internic.net/domain/named.root.

The server administration script for named is /etc/rc.d/init.d/named.

service named start
service named restart
service named stop
service named reload
service named status

Apache web server

Apache Web Server

The configuration files for Apache reside in /etc/httpd/conf. They are:
1. access.conf
2. httpd.conf
3. srm.conf

The httpd.conf file has three main sections, which are marked off by comments:
1. the global environment
2. the main server configuration
3. virtual host configurations

The server administration script for Apache is /etc/rc.d/init.d/httpd.

service httpd start
service httpd restart
service httpd stop
service httpd reload
service httpd status

Troubleshooting the Service

To check the virtual host configuration:
/usr/sbin/httpd -S

If apache-manual package as installed,can access local documentation stored in HTML format in the /home/httpd/html/manual directory.

Network file system(NFS)

NFS provides shared access to files and directories(shares which have been exported by the server).NFS share can be mounted by a client system in the same way local file system is mounted.
NFS server runs 3 NFS related daemons:
1.portmap,which forwards client requests to the correct nfs process.
2.rpc.nfsd,translates remote file access e\request to a local file access request.
3.rpc.mounted,mounts and unmounts file systems.
To use NFS we need 2 packages:
1.nfs-utils,contain utilities needed for using NFS.
2.portmap,contain file relates to portmap.

Server configuration

The NFS server configuration file is /etc/exports, each line of directives specify a share and associate access permissions.The general form of directive is:

absolute_path host_list (rw,sync,no_root_squash)
/export/database 192.168.10.115 (rw,sync,no_root_squash)

Host_list is a list of one or more hosts which can access the shares.Each host should be separated by a space.Wild card(*) can be used to match part of the host name or file name.By default clients are permitted read only(ro) access,to allow read-write access follow the host specifier with(rw).By default client is logged in as root,to permit root access,specify no_root_squash option.

service nfs restart
service nfs stop

exportfs -v lists shared directories
exportfs -a export all shares listed in /etc/exports
ecportfs -ua unexports all shares
exportfs -r refreshes the share list

Client configuration

shared directory can mounted in this way:
mount nfs_server:/exports/database /mnt
mount 192.168.10.108:/exports/database /mnt

We can also mount the NFS share in the boot time:
192.168.10.108:/exports/database /mnt nfs defaults 0 2

NFS administration

To check the status of the NFS server:
service nfs status

To check the status of a remote NFS server:
rpcinfo -p 192.168.10.115

To list the shares exported by a server:
showmount -e 192.168.10.115

Thursday, January 10, 2008

Dynamic Host Configuration Protocol (DHCP)

The DHCP configuration file is /etc/dhcpd.conf.But this is not originally in the /etc,I had to copy it from /usr/share/doc/dhcp-3.0.1/dhcpd.conf.sample.In most cases the DHCP installation doesn't create a "dhcpd.leases" file. Before you start the server, you must create an empty file(once DHCP starts this stores the assignment it makes):

touch /var/lib/dhcp/dhcpd.leases

To starts the DHCP server:

service dhcpd start
service dhcpd restart

Create and edit /etc/dhcpd.conf

ddns-update-style interim;
ignore client-updates;

subnet 192.168.10.0 netmask 255.255.255.0 {

# --- default gateway
option routers 192.168.10.1;
option subnet-mask 255.255.255.0;

#option nis-domain "whitebox";
#option domain-name "whitebox";


# If you specify a WINS server for your Windows clients,
# you need to include the following option in the dhcpd.conf file:
#option netbios-name-servers 192.168.123.104;

option time-offset -18000; # Eastern Standard Time
# option ntp-servers 192.168.123.104;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.10.100 192.168.10.120;
default-lease-time 86400;
max-lease-time 86400;

# we want the nameserver to appear at a fixed address
host pubudu {
hardware ethernet 00:34:56:78:AB:CD;
fixed-address 192.168.10.104;
default-lease-time 86400;
}
}

The DHCP client

launch linuxconf and choose Config->Networking->Client Tasks->Basic Host Information.
Set the following options:
1. Enabled
2. Config Mode = DHCP

Wednesday, January 9, 2008

Global positioning system(GPS)

Mobile that we using can be used to locate all the people in the case of emergency.that's why GPS(global positioning receiver) located chip was inserted in new phone.Newer phones can be used to track people in 30ft range.cell phone essentially radio.When cell phone is on it sends radio signals to it's cell tower to know where the phone is,this will help a person to move one cell to another cell with out loosing a call.At the same time GPS system receives signal from outer space specifically at least 3 geosynchronous satellites.Using geometric method called tridimentional trilateration,the GPS chip using the satellite signal to calculate its exact location on earth.
If we put a sniffer on a node we can track someone.Node is something which takes all calls coming to a cell tower and release those signals to where they are going.but sniffer is a electronic device that detect specific calls then send that signal to a phone that we are using to tracking.

Global positioning system(GPS)

GPS is a satellite based navigation system.GPS works anywhere in the world under any weather conditions.GPS constellation consist of 24 satellites in 6 near circular orbits.An on board GPS receiver must locked in to at least 3 satellite to calculate 2D position or the movement,if 4 satellites or more receiver can determine the 3D position.Once the user position has been determined GPS unit will start to calculate other information such as speed,track,trip distance,time.These parameters are continually updated by a master control station,which transmits them up to the satellites where they are broadcast as part of a navigational message from each satellite.Civilian GPS uses L1 frequency of 1.5754 GHz in the UHF band(signal travels by line of sight,it can pass clouds,glass and plastic but fail to pass through solid objects).Defense GPS uses L2 frequency of 1.2276 GHz in the UHF band.In the GPS system the modulation used is direct sequence spread spectrum and it is one way transmission system(from satellite to user only,user does not require a transmitter).Modulation method makes GPS system jam resistant,secure and addressable.The in phase component is being C/A (coarse acquisition) code while quadrature component is P-code(precision code).
GPS signal contains 3 different bits of information:
  1. Pseudorandom code,simply an ID code to identify which satellite is transmitting th signal.
  2. Ephemeris data,which is constantly transmitted by each satellite,contains information sbout its status and this is essential to determine its position.
  3. Almanac data,tells the GPS receiver about the position(orbital information) of each GPS satellite throughout the day.
Dilution of precision (DOP) is measure of the quality of the GPS data being received fro the satellite.The effect of DOP can be resolved in to horizontal DOP(HDOP),vertical DOP(VDOP),time DOP(TDOP) and position DOP(PDOP).

Tuesday, January 8, 2008

Played for John Keels hockey team

My first game in Mercantile tournament was against Browns pvt ltd in 08/01/08 at Ovel ground(0-1).I played as a forward for the john keels hockey team.I was really exhosted because I played after 4 months.I'm fortunate to be selected to the company team even if i was joing the company for my 6 months internship.There are players from all the division in the john keels group.Namely transport(DHL),Food and beverages,Hotel management and IT sector(kbsl) etc.I am in my internship at kbsl.But we played the game as team under the same group.It is another opportunity for me to develop my team work skills.John keels have a good hockey team,I'm fortunate to get that exposure.I had played hockey for my school and for the university,now I already had play for a company also.After the match I had some friendly chat with the team members about there role in the group.Now I have friends not only in kbsl but also in the whole group.

Gnuzip

The gzip sources, written in C, are available here in various formats:
  • tar
  • shar
  • zip
  • tar.gz
  • tar.Z
If a file ends in .zip (for example, file.zip) type:
unzip file.zip

If a file ends in .tar (e.g., file.tar) type:
tar -xvf file.tar

tar -zxvpf my_tar_file.tar.gz

I've used my preferred options. I'll explain them:
-z - unzip the file first
-x - extract the files from the tarball
-v - "verbose" (i.e tar tells you what files it's extracting)
-p - preserves dates, permissions of the original files
-f - use the file in question (if you don't specify this, tar just sort of sits around doing nothing)
The files are extracted and your original tarball is preserved (my_tar_file.tar.gz).

If a file ends in .gz (for example, file.gz) type:
gzip -d file.gz

If a file ends in .tar.gz (e.g. file.tar.gz) type:
gzip -d file.tar.gz
and then
tar -xvf file.tar

If a file ends in .tgz (e.g. file.tgz) type:
tar -xvzf file.tgz

If file ends in tar.bz2(file.tar.bz2)type:
bzip2 -d file.bz2

Monday, January 7, 2008

configuring Samba

Samba is open source implementation of the System Message Block(SMB) service used by Microsoft windows 9x and NT,which is known as CIFS.Samba enables windows client to access Linux file systems and printers by using network Neighborhood facility of the windows manager. SMB is high level protocol built on Microsoft 's NetBIOS protocol,which can be run over TCP/IP network.Samba has 2 associated services:
SMB server acts as the browse master(maintains information on available servers and respond to client discover servers) for a network served by SMB.Linux client can access SMB share in 2 ways:
print tool utility lets us to configure access to Samba printers.

Samba is contain in 3 packages
  • samba-common, which contains files needed by samba clients and servers.
  • samba,which contains the samba server.
  • samba-client,which contains the samba smbclient,smbmount and smbprint.
Samba is in such popular use that many Unix distributions come with it already installed.Samba is already installed on my RHEL 4, I checked the version by using the command:

$ smbd -V
Version 3.0.10-1.4E.2

On Red Hat Linux, I use the rpm command to query the installed packages for Samba:

$ rpm -qa | grep samba
samba-client-3.0.10-1.4E.2
samba-3.0.10-1.4E.2
samba-common-3.0.10-1.4E.2

Administration
the main server administratrion script for samba is /etc/init.d/smb.By invoking this with proper arguments we can control the samba server.

to start samba server:
/etc/init.d/smb start or
service smb start

to restart the samba server:
/etc/init.d/smb restart or
service smb restart

to stop samba server:
/etc/init.d/smb stop or
service smb stop

to check samba status:
/etc/init.d/smb status

Basic server configuration

The main Samba configuration file is /etc/smb.conf, which contains two types of directives:
  1. Global directives, which configure the server.
  2. Service directives, which configure shared files and printers.
Samba Global Directives

The host allow directive identifies the client host permitted to access the server.The localhost address 127.0.0.1,should generally be included in the list of hosts.
#specify the hosts that can access the server
host allow = 192.168.1 192.168.2 127. (partial IP addresses note the trailing dot)

For Windows 9x and NT clients,I specify user as the value of the security parameter.For handling authorization on a per-share basis,value can be specified as share.To handle authorization by primary domain controller(PDC) in another server security value must be specified as server.If the client participate in a domain,value should be domain.
#specify the security is imposed at the user level
security = server

Samba service directives

To create a publicly available share,omit the valid user directive and specify public = yes.
To create access to all members of the group,specify public = @group_name.
To avoid to be in a browse list,specify browseable = no.

Client configuration and use

To access a samba share or a windows 9x/NT share from a linux host:
smbmount //server/share /mount_point

To access a share using smbclient //server/share


Troubleshooting

Testparm tests my configuration file(smb.conf) and report any unknown parameters or incorrect syntax. It also performs a check for common misconfiguration and will issue a warning if one is found.
testparm /etc/samba/smb.conf

To list available shares on the server:
smbclient -L localhost -N

If no shares are visible,the WINS server may not be responding,to investigate that:
nmblookup -B localhost __SAMBA__

to check whether SMB clients are properly configured to use WINS:
nmblookup -d 2 '*'

Friday, January 4, 2008

Interesting mathematics 1

Bayesian Spam filter

Bayesian email filters take advantage of Bayes' theorem.Spam filters use Bayesian spam filter to filter out junk email from the record email.Calculate the probability that mail will be a junk taking some key words in to
consideration(refinance,stock,Viagra...these words may have high Bayesian probability).Here you get statistics on how often tokens show up in two bodies of mail, (spam and good,) and then calculate the a statistical value that a single mail is spam by looking at the tokens in it. The more mail in the good and spam mail bodies, the better the filter is "trained".
Bayes' theorem, in the context of spam, says that the probability that an email is spam, given that it has certain key words in it is:

π

It represents the ratio of any circle's circumference to its diameter,approximately equal to 3.14159.π itself has an infinite decimal expansion; because π is an irrational number, its decimal expansion never ends and does not repeat. Simple way of calculating π is by drawing a large circle, then measuring its diameter and circumference, since the circumference of a circle is always π times its diameter.
when we find some thing we can't explain in math we said it is π(pi).So there is question to answer why pi appears many places in Physics, Relativity and number theory seemly unrelated places.
when we droop needles randomly to a sheet of line paper probability of needle will cross a line is equal to the pi(Buffon's needle).
Let the length of the needle is one unit and the distance between the lines is also one unit. There are two variables, the angle at which the needle falls (theta) and the distance from the center of the needle to the closest line (D).


To calculate pi from the needle drops, simply take the number of drops and multiply it by two, then divide by the number of hits, or
2(total drops)/(number of hits) = pi (approximately).

Car Remote


The system consists of a remote, commonly called a "keyfob" and a reciever module located somewhere on the car.When you press the keyfob button, a signal is sent out by the keyfob. This signal includes a numeric pass code.car remote has one to one mapping with the car.but all remotes are in the same frequency.every remote emit numerical code only one car identifies it.Rolling code.every time hit the key it sends different signal to the car.If the combination agrees with the stored information that has been programmed into the receiver module, the doors unlock, lock, or whatever allocated happens.The change is predictable as long as we know the algorithm,it may be simple as adding a 1.

Gambling

Math applies to gambling. Booky wanted to take equal amount of money on each side of the game. Booky always balance two side.But sometime one team is better than the other,he have to adjust the point spread.He have to drop bets to the weak side and keep the balance.He keep the balance he doesn't have to pay for the winner from his own pocket,they get paid from the losers money.For his balance spread he makes 4 1/2% profit for the all the action he takes.

PEMS

PEMS-freeway performance evaluation monitoring system
PEMS is designed to predict optimum traffic route and travel time.There are sensors buried in the roads,that count cars,trucks traffic on the road.And that information is sent to a computer.
constructional theory,point area point volume of flows.Traffic flew like any other fluid system,there are imperfection obstacles,that proves the system to optimize it by reducing its resistance.

Fairy Sequence

Fraction specially a fairy sequence.Say we begin slicing oranges to lot of oranges,but the rule is we can never repeat a cut.First orange cut to a 1/2.Next orange we take 1/3.next 1/4 and next 1/5.In the end we left many orange slices with vary in size.When you place smallest to largest the form a fairy sequence.
F1=(0/1,1/1)
F2=(0/1,1/2,1/1)
F3=(0/1,1/3,1/2,2/3,1/1)
F4=(0/1,1/4,1/3,1/2,2/3,3/4,1/1)
F5=(0/1,1/5,1/4,1/3,2/5,1/2,3/5,2/3,3/4,4/5,1/1)
this is used in book keeping.

why there is no Nobel Prize for Maths

Since 1901, the Nobel Prize has been honoring men and women from all corners of the globe for outstanding achievements in physics, chemistry, medicine, literature, and for work in peace.But there is no Nobel price for mathematics.Mathematicians says Nobel's wife or his mistress had an affair with the mathematician Mittag-Leffler and he doesn't want to share his price with his rivals.But this can't be truth because Alfred Nobel never married.
There are several possible reasons why Nobel did not create a prize for mathematics.Nobel price is for those inventions or discoveries of greatest practical benefit to mankind,but mathematics is not considered as practical science,this would explain the lack of a Mathematics prize.Another possible reason is that there was already a well known Scandinavian prize for mathematicians.And several prizes in Mathematics have similarities to the Nobel Prize.

Wireless networks

Modern wireless communication systems

Wireless communication networks have become much more pervasive than any one could have imagine when the cellular concept was first developed in the 1960s and 1970s.The wide spread success of cellular has led to the development of newer wireless systems and standards for many other types of telecommunication traffic.
Personal communication networks (PCN) refers to a wireless networking concept where any user can make or receive call,no matter where they are, using a light weight,personalized communicator.Personal communication services (PCS) refers to new wireless system that incoperate more network features and more personalized than existing cellular radio systems.



Second Generation(2G) Cellular networks


Unlike first generation cellular systems that relied on FDMA/FDD and analog FM,second generation standards use digital modulation formats and TDMA/FDD and CDMA/FDD multiple access techniques.The most popular 2G standard includes 3 TDMA standards and one CDMA standards:
1.Global System Mobile (GSM),which supports 8 time slotted users for each 200kHz radio channel.(in the PCS spectrum band only)
2.Interim Standard 136 (IS-136),wich support 3 time slotted users for each 30kHz radio channel.
3.Pacific Digital cellular(PDC), a japanese TDMA standards that is similar to IS-136.
4.Interim Standard 95 Code devision Multiple access(IS-95),also known as cdmaone, which supports up to 64 users that are orthogonally coded and simultaneously transmitted on each 1.25 channel.
All 2G technologies offer at least a 3 times increase in spectrum efficiency as compared to the first generation analog technologies.

Evolution to 2.5 Mobile Radio Networks

The 2G technology use circuit switched data modems that limit data users to single circuit-switched voice channel.2G networks only support single user data rates on the order of 10 kilobits per second,which is too low for rapid email and internet browsing applications.This is because 2G standards were designed before the wide spread use of internet.
Even with relatively small user data rates, 2G standards are able to support limited internet browsing and sophisticated short messaging(SMS) capabilities using circuit-switched approach.The new technology 2.5G allow existing 2G equipment to be modified and supplemented with new base station add-ons and subscriber unit software upgrades to support higher data rate transmission for web browsing and e-mail traffic. 2.5G also support new web browsing format language,called wireless application protocol(WAP),that allow standard web pages to be viewed in compressed format specially designed for small hand held potable wireless devices.Japan introduced its own propriety wireless data service and internet micro browser technology called I-mode,on its PDC.I-mode supports games,color graphics and interactive web page browsing using 2G PDC data rate 0f 9.6 kilobits per second.

Evolution for 2.5G TDMA Standards

Three TDMA upgrade option include:
1.High Speed Circuit Switched Data (HSCSD)
2.General Packet Radio Service (GPRS)
3.Enhanced Data rates for GSM Evaluation (EDGE)
These option provide significant improvement in internet access speed over GSM and IS-136 and support the creation of new internet-ready cell phones.

HSCSD for 2.5G GSM

HSCSD allows single mobile subscriber to use consecutive user time slots in GSM standard,in order to obtain high speed data access.HSCSD relaxes the error control coding algorithm that specified in GSM for data transmission and increase data rate to 14.4 kbps.By running up to 4 consecutive time slots,HSCSD able to provide rate up to 57.6 kbps to individual users.Service provider has to implement a software change at existing GSM base station to activate HSCSD.HSCSD is ideal for streaming internet access and real-time interactive web sessions.

GPRS for 2.5G

GPRS is packet based data network,wich is well suited for non-real time internet usage,and applications where the user downloads much more data than its uploads(like retrieval of email,faxes).GPRS supports multi-user network sharing of individual radio channels and time slots.GPRS can support many users than HSCSD but in bursty manner.GPRS subscriber units are automatically instructed to tune to dedicated GPRS radio channels and particular time slot for "always on"access to the network.Implementation of GPRS merely requires the GSM operator to install new router and internet gateway at the base station,along with new software that redefines the base station air interface and time slots,no new RF hardware needed.As the case of packet network throughput experience by user may decreases as more users attempt to use the network or due to poor propagation conditions.GPRS allow dedicated peak 21.4kbps per channel data rate,if all 8 time slots of GSM used for GPRS,an individual user is able to achieve 171.2 kbps (8x21.4).GPRS originally designed to provide packet data access over GSM networks,but later extended to work with IS-136 as well.

EDGE for 2.5G

EDGE requires new hardware and software upgrades to the existing base station.EDGE introduce a new digital format,8-PSK(octal phase shift keying) in addition to existing GMSK modulation.EDGE allows for 9 different air interface formats,known as multiple modulation and coding schemes(MCS),with varying degree of error control protection.So each user connection may adaptively determine the best MCS setting(incremental redundancy) for the particular radio propagation condition and data access requirement of the user.EDGE is sometimes referred to as Enhansed GPRS,EGPRS.Incremental redundancy,is packets transmitted first with maximum error protection and data rate throughput,but subsequent packets are transmitted with less error protection and less throughput.If all 8 time slots are dedicated to EDGE,raw peak throughput data rate of 547.2kbps can be provided.

IS-95B for 2.5 CDMA

IS-95B provides high speed packet and circuit switched data access on a common CDMA radio channel by dedicating multiple orthogonal user channels(Walsh function).IS-95B supports medium data rate(MDR) service by allowing a dedicated user to command up to 8 different user Walsh code simultaneously and in parallel throughput of 115.2kbps per user(8 x 14.4kbps).IS-95B also specifies hard hand off procedure that allow subscriber unit to search different radio channels in the network with out instruction from the switch,and maintain link quality.

Wednesday, January 2, 2008

My Linux trainning

Exiting vi tutor

Press esc then enter

:q -Quit VI. If there have been changes made, the editor will issue a warning message.
:q! -Quit VI without saving changes.
:w -Write out the current file.
:w filename -Write the buffer to the filename specified.
:w >> filename -Append the contents of the buffer to the filename.
:wq -Write the buffer and quit.

Reset root password


  • Reboot the machine
  • Press e to edit the commands before booting, at Red Hat Enterprise Linux ES (2.6.9-22.EL)
  • The entered to the GNU GRUB,where I got three options.
1.root(hd0,0)
2.kernel
3.intitrd
  • Choose kernel and select e to edit.In the grub edit place 1 in the end and enter.
kernel /vmlinuz-2.6.9-22.EL ro root=LABEL=/ rhgb quiet 1
  • then press b for boot from there.
  • I entered to the shell mode,enter passwd there
sh-3.00# passwd
changing password for user root.
New UNIX password:

Auto Mount

Auto mount is useful for nfs, samba, and boot mounts/partitions. Think of having file exist on a central nfs capable server and all of your client machines are then able to automatically mount that file whenever you access them.If the filesystem is unmounted, and a user attempts to access it, it will be automatically (re)mounted. This is especially useful in large networked environments and for crossmounting filesystems between a few machines.
Autofs master configuration file lists one or more directories to take control over. This directory (mount point) will be controlled by the autofs daemon.Each line in the master configuration file gives autofs a mount point,can add any number of mount points, but we will only need one.

#ls /etc/auto* :main file is /etc/auto.master
#vi /etc/auto.master
auto.today --timeout=1s
#vi /etc/auto.today
autodir -fstype=etc3 :/dev/hda14
#service autofs restart


#cd /fsat
#ls
#mount :to check mounting
#ls autodir :auto mount happens
#ls :files can be seen .but after 1s seconds,if no activity happens it will get auto unmounted.Check with date command


#vi /etc/exports
#service nfs restart

use of auto mount

Allow non root people to mount files (specially CD roms)

eg: Host 192.168.10.224 has linux rpm package available in /var/ftp/pub (nfs enabled)
arrange auto mount the above directory as /fsat/pkgs

pkgs -fsat=nfs 192.168.10.224:/var/ftp/pub

How to add a disk file to swap

create a file with a required size.
#dd if=/dev/zero(input file) of=/tmp/myswap(output file) bs=1024k(block size) count=10(10 blocks)
#od -c /tmp/myswap | less
#mkswap /tmp/myswap
#swapon /tmp/myswap
#swapon -s


#useradd :create a new user
#id hnd
#tail /etc/passwd

#newgp :create a new group
#chown hnd /newdir :change the ownership of the new directory to the new user.Inlinux to change the ownership we should be a super user

#groupadd sand :to add a group with out a user
#usermod -g sands hnd :to see how arguments are given just type usermod and enter

#chgrp sands newdir

Allocating user disk quotas

To use quota, file system must be mounted with quota option
#mount -o userquota /dev/hda11 /home/mynewdir
#qutacheck -c /home/mynewdir
#qutaon /home/mynewdir
#usemod -d /home/mynewdir/hnd -m hnd :just changing the home directory
#edquota hnd
#repquota /home/mynewdir :to see
#dv :disk usage


MIrroring

Write the same thiing to both disks,both have same image.
create 2 50 MB partitions hda12 and hda13
:fd linux raid autodetect

#mdadm -C(create) /dev/md0 -l | -n 2(no of devices) /dev/hda12 /dev/hda13
#ls -l /dev/md0 : created
#mdadm --details /dev/md0
#mkfs.ext3 /dev/md0
#mount /dev/md0 /mnt
#mdadm --manage /dev/md0 -f /dev/hda13 :creating a faulty disk
#mdadm -D /dev/md0 :to display
#mdadm -S /dev/md0 :to stop
#mdadm -r /dev/md0 :to remove
the mirror divice is /dev/md0
#mdadm --manage /dev/md0 -a /dev/hda13 :adding another partion hda13


Logical volumes

iF disk 1 has 500MB free available and disk 2 has 300 MB available,in LVM by combining two we can have 800 MB space.

creating a logical volume
:t
:8e
:w

#pvcreate /dev/hda14 /dev/hda15 :physical volume create
#vgcreate vg0 /dev/hda14 /dev/hda15 :volume group creation
#vgdisplay
#lvcreate -L(length) 56m(size) -n(name) lv1 vg0(from)
this created logical volumegoes to /dev/mapper/vg0 -lv1 created from /dev/vg0/lv1

#lvdisplay
#mkfs.ext3 /dev/vg0/lv1
#mount /dev/vg0/lg1 /mnt
#df -h

#lvexpand -L +16m /dev/vg0/lv1 :expanding lv1
#df -h
#ext2online /dev/vg0/lv1 :start using expanded area

Removing

#lvremove /dev/vg0/lv1
#vgremove vg0
#pvremove /dev/hda14
#pvremove /dev/hda15