Tuesday 26 March 2013

MYSQL PROCESSESS LISTING AND KILL

MYSQL PROCESSES LISTING AND KILL

# mysql -uroot -p

mysql> show processlist\G
     Id: 1359
   User: root
   Host: localhost
     db: contentanalysis
Command: Query
   Time: 346
  State: Copying to tmp table
   Info: SELECT  SQL_CALC_FOUND_ROWS id, filepath FROM content WHERE filepath IN (  SELECT filepath
FROM cont

mysql> kill 1359;

mysql> show processlist;

Friday 22 March 2013

AUDITD CONFIGURATION TO MONITOR ADDITION AND DELETION IN /VAR/WWW

Install auditd to monitor addition and deletion in /var/www
#To install auditd in ubuntu
apt-get install auditd

nano /etc/audit/audit.rules

# This file contains the auditctl rules that are loaded
# whenever the audit daemon is started via the initscripts.
# The rules are simply the parameters that would be passed
# to auditctl.

# First rule - delete all
-D

# Increase the buffers to survive stress events.
# Make this bigger for busy systems
-b 1024

-a exit,always -S unlink -S rmdir
-a exit,always -S stime.*
-a exit,always -S setrlimit.*
-w /var/www -p wa
-w /etc/group -p wa
-w /etc/passwd -p wa
-w /etc/shadow -p wa
-w /etc/sudoers -p wa

# Disable adding any additional rules - note that adding *new* rules will require a reboot
-e 2


Reboot the System and it will be working fine

To search addition or deletion activity on /var/www
ausearch -f /var/www

Wednesday 20 March 2013

UBUNTU IPTABLES LOAD AUTO AT START

Auto Saving IP Tables and Auto Loading in UBUNTU

Although the IP tables are effective, they will automatically be deleted if the server reboots. To make sure that they remain in effect, we can use a package called IP-Tables persistent.

We can install it using apt-get:

sudo apt-get install iptables-persistent

During the installation, you will be asked if you want to save the iptable rules to both the IPv4 rules and the IPv6 rules. Say yes to both.

Your rules will then be saved in /etc/iptables/rules.v4 and /etc/iptables/rules.v6.

Once the installation is complete, start iptables-persistent running:

sudo service iptables-persistent start

After any server reboot, you will see that the rules remain in place. 


/etc/init.d/iptables-persistent {start|restart|reload|force-reload|save|flush}

UBUNTU UPDATE AND UPGRADE

First run update, then upgrade. Neither of them automatically runs the other.

  • apt-get update updates the list of available packages and their versions, but it does not install or upgrade any packages.

  • apt-get upgrade actually installs newer versions of the packages you have. After updating the lists, the package manager knows about available updates for the software you have installed. This is why you first want to update.

Thursday 14 March 2013

SQUID DELAY POOLS

This defines the parameters for a delay pool.  Each delay pool has
 a number of "buckets" associated with it, as explained in the
 description of delay_class.

 For a class 1 delay pool, the syntax is:
  delay_pools pool 1
  delay_parameters pool aggregate

 For a class 2 delay pool:
  delay_pools pool 2
  delay_parameters pool aggregate individual

 For a class 3 delay pool:
  delay_pools pool 3
  delay_parameters pool aggregate network individual

 For a class 4 delay pool:
  delay_pools pool 4
  delay_parameters pool aggregate network individual user

 For a class 5 delay pool:
  delay_pools pool 5
  delay_parameters pool tagrate

 The option variables are:

  pool  a pool number - ie, a number between 1 and the
    number specified in delay_pools as used in
    delay_class lines.

  aggregate the speed limit parameters for the aggregate bucket
    (class 1, 2, 3).

  individual the speed limit parameters for the individual
    buckets (class 2, 3).

  network  the speed limit parameters for the network buckets
    (class 3).

  user  the speed limit parameters for the user buckets
    (class 4).

  tagrate  the speed limit parameters for the tag buckets
    (class 5).

 A pair of delay parameters is written restore/maximum, where restore is
 the number of bytes (not bits - modem and network speeds are usually
 quoted in bits) per second placed into the bucket, and maximum is the
 maximum number of bytes which can be in the bucket at any time.

 There must be one delay_parameters line for each delay pool.

 For example, if delay pool number 1 is a class 2 delay pool as in the
 above example, and is being used to strictly limit each host to 64Kbit/sec
 (plus overheads), with no overall limit, the line is:

  delay_parameters 1 -1/-1 8000/8000

 Note that 8 x 8000 KByte/sec -> 64Kbit/sec.

 Note that the figure -1 is used to represent "unlimited".

 And, if delay pool number 2 is a class 3 delay pool as in the above
 example, and you want to limit it to a total of 256Kbit/sec (strict limit)
 with each 8-bit network permitted 64Kbit/sec (strict limit) and each
 individual host permitted 4800bit/sec with a bucket maximum size of 64Kbits
 to permit a decent web page to be downloaded at a decent speed
 (if the network is not being limited due to overuse) but slow down
 large downloads more significantly:

  delay_parameters 2 32000/32000 8000/8000 600/8000

 Note that 8 x 32000 KByte/sec -> 256Kbit/sec.
    8 x  8000 KByte/sec ->  64Kbit/sec.
    8 x   600 Byte/sec  -> 4800bit/sec.

 Finally, for a class 4 delay pool as in the example - each user will
 be limited to 128Kbits/sec no matter how many workstations they are logged into.:

  delay_parameters 4 32000/32000 8000/8000 600/64000 16000/16000
 
## Dealy Pool 1 complete configuration 
delay_pools 1
delay_class 1 1
delay_parameters 1 384000/384000  #3MB link aggregate
delay_access 1 allow localnet
delay_access 1 deny all 

Monday 11 March 2013

LINUX/UNIX TIMESTAMP CONVERTER

Open Terminal and run below command
## put time stamp after @

date -d @1362982446

Mon Mar 11 11:14:06 PKT 2013
 

Saturday 9 March 2013

UBUNTU BONDING (teaming) NETWORK INTERFACES

## Install ifenslave
sudo apt-get install ifenslave-2.6

## add bonding module
sudo vi /etc/modules
kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.

loop
lp
rtc
bonding


## Stop network to load bonding module
/etc/init.d/networking stop

## Load bonding module
sudo modprobe bonding

## Edit interfaces file and add as you required
vi /etc/network/interfaces
auto eth1
iface eth1 inet manual
bond-master bond0

auto eth2
iface eth2 inet manual
bond-master bond0

auto bond0
iface bond0 inet static
address 192.168.1.2

netmask 255.255.255.0
network 192.168.1.0
bond-mode balance-rr
bond-miimon 100
bond-downdelay 200
bond-updelay 200
bond-slaves eth1 eth2


## Create bonding.conf file and add two lines below
vi /etc/modprobe.d/bonding.conf
alias bond0 bonding
options bonding mode=0 downdelay=200 updelay=200


## Start network
/etc/init.d/networking start

## To verify bond working 
cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding Mode: load balancing (round-robin)
MII Status: up
MII Polling Interval (ms): 100
Up Delay (ms): 200
Down Delay (ms): 200

Slave Interface: eth2
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: e0:69:95:ab:2c:54
Slave queue ID: 0

Slave Interface: eth1
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 90:f6:52:03:49:7e
Slave queue ID: 0


## Descriptions of bonding modes
Mode 0
balance-rr
Round-robin policy: Transmit packets in sequential order from the first available slave through the last. This mode provides load balancing and fault tolerance.
Mode 1
active-backup
Active-backup policy: Only one slave in the bond is active. A different slave becomes active if, and only if, the active slave fails. The bond's MAC address is externally visible on only one port (network adapter) to avoid confusing the switch. This mode provides fault tolerance. The primary option affects the behavior of this mode.
Mode 2
balance-xor
XOR policy: Transmit based on [(source MAC address XOR'd with destination MAC address) modulo slave count]. This selects the same slave for each destination MAC address. This mode provides load balancing and fault tolerance.
Mode 3
broadcast
Broadcast policy: transmits everything on all slave interfaces. This mode provides fault tolerance.
Mode 4
802.3ad
IEEE 802.3ad Dynamic link aggregation. Creates aggregation groups that share the same speed and duplex settings. Utilizes all slaves in the active aggregator according to the 802.3ad specification.
  • Prerequisites:
    1. Ethtool support in the base drivers for retrieving the speed and duplex of each slave.
    2. A switch that supports IEEE 802.3ad Dynamic link aggregation. Most switches will require some type of configuration to enable 802.3ad mode.
  • Mode 5
    balance-tlb
Adaptive transmit load balancing: channel bonding that does not require any special switch support. The outgoing traffic is distributed according to the current load (computed relative to the speed) on each slave. Incoming traffic is received by the current slave. If the receiving slave fails, another slave takes over the MAC address of the failed receiving slave.
  • Prerequisites:
    • Ethtool support in the base drivers for retrieving the speed of each slave.
  • Mode 6
    balance-alb
Adaptive load balancing: includes balance-tlb plus receive load balancing (rlb) for IPV4 traffic, and does not require any special switch support. The receive load balancing is achieved by ARP negotiation. The bonding driver intercepts the ARP Replies sent by the local system on their way out and overwrites the source hardware address with the unique hardware address of one of the slaves in the bond such that different peers use different hardware addresses for the server.

Thursday 7 March 2013

PANASONIC PHOTOCOPIER IP CHANGE

GOTO 
1. Function
2. General Settings
3. Key operator mode
4. Put 4 digit code (default is 0000)
5. TCP/IP Address (scroll down menu)

Tuesday 5 March 2013

UBUNTU TECH TIPS

To enable root user in UBUNTU
# sudo passwd

Sudo will prompt you for your password, and then ask you to supply a new password for root as shown below:
sudo password for username: user password
enter new UNIX password: password for root
retype new UNIX password: password for root

To disable root user
# sudo passwd -l root

To add or delete users
# adduser username
# deluser username

To add or delete group
# addgroup groupname
# delgroup groupname

To view directory space usage in human readable format
# du -sh /directory

To add or remove network interfaces
# vi /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
address 110.xxx.xx.xx
netmask 255.255.255.xxx

gateway 110.xxx.xx.xx

auto eth1
iface eth1 inet static
address 192.168.1.x
netmask 255.255.255.0
network 192.168.1.0


auto eth2
iface eth2 inet dhcp

## GUI PACKAGE MANAGEMENT TOOL
$ synaptic &

## TO REMOVE PACKAGES USING TERMINAL

For example remove package called mplayer, enter:
$ sudo apt-get remove mplayer



##To list all installed package
dpkg --list
dpkg --list | less
dpkg --list | grep -i 'squid3'


Remove package called squid3 along with all configuration files, enter:
$ sudo apt-get --purge remove squid3

Friday 1 March 2013

PANASONIC DP-3520 SCANNER CONFIGURATION

USE PHOTOCOPIER AS A SCANNER

Function --> Scanner Settings --> Add address 192.168.1.100 --> OK

1. Add static ip in your laptop and install Panasonic Communication Utility.

2. Panasonic Communication Utility also have a windows firewall setting tool. Run this tool and allow Panasonic communication utility through firewall.