Friday, June 12, 2009

Monday, June 8, 2009

View actual physical memory usage on Linux

free

free command displays amount of total, free and used physical memory (RAM) in the system, as well as shoing information on shared memory, buffers, cached memory and swap space used by the Linux kernel.

Syntax of free

free -[options]

Example usage of free

free -m

The command will display information about physical memory in MB.

free -m -s 5

The command will activate continuous polling delay at 5 seconds apart, and then display memory status in megabytes on terminal. Any floating point number for delay can be specified.

free -t -m

Same with “free -m”, but -t switch will display a line containing the totals of physical memory and swap space.

Friday, June 5, 2009

Passwordless ssh login

1 Generate keys

Type:

   ssh-keygen -t rsa

And do not enter a passphrase unless you wanted to be prompted for one during file copying.

Here is what you will see:

   $ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/User/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):

Enter same passphrase again:

Your identification has been saved in /home/User/.ssh/id_rsa.
Your public key has been saved in /home/User/.ssh/id_rsa.pub.
The key fingerprint is:
5a:cd:2b:0a:cd:d9:15:85:26:79:40:0c:55:2a:f4:23 User@JEFF-CPU
2 Copy public to machines you want to upload to

id_rsa.pub is your public key. Copy it to ~/.ssh on target machine.

Put a copy of the public key file on each machine you want to log into. Name the copy authorized_keys (some implementations name this file authorized_keys2)

Then type:

     chmod 600 authorized_keys

Then make sure your home dir on the remote machine is not group or world writeable.

Wednesday, June 3, 2009

Keeping a Log Of Daily Network Traffic for ADSL or Dedicated Remote Linux Server

Almost a year ago, I wrote about Linux MRTG configuration how-to. However, some user seems to confused with MRTG, most users would like to know - how much traffic actually generated by ADSL/Cable service provider on daily and monthly basis.

MRTG is for network monitoring and it can be use to see how much traffic your server or ADSL router actually generated, however it will not tell you how much megabytes or gigabytes the daily traffic was. For all such home user and people having dedicated single Linux box hosted somewhere remote at IDC/ISP there is a tool called vnStat:

  • It is a console-base network traffic monitor for Linux (perfect tool for remote Linux box hosted at ISP)
  • It keeps a log of daily and monthly network traffic for the selected network interface(s).
  • It collects all data from /proc file system it means normal user can monitor traffic (no need to run vnstat as a root user)
  • Easy to setup & configure
  • Ease of use

Step # 1: Install vnstat

Debian / Ubuntu Linux user can install vnstat using apt-get command, enter:

# apt-get install vnstat 

Step # 2: Enable vnstat

Once installed, you need to create a database with the following command:

# vnstat -u -i eth0

Where,

  • -u :forces a database update for interface or creates the database if it doesn’t exist
  • -i eth0 : use to specify interface

Please note that it will start to collect data via cronjob:

0-55/5 * * * *   root    /usr/bin/vnstat -u

You do not have to install cronjob yourself; it should be automatically configure by apt-get.

Step # 3 View statistics

Display default traffic statistics

$ vnstat

Display daily traffic statistics

$ vnstat -d


Display monthly traffic statistics:

$ vnstat -m

Display all time top10 traffic days:

$ vnstat -t 


Try help option to get all query options:

$ vnstat --help


Source:- http://www.cyberciti.biz/tips/keeping-a-log-of-daily-network-traffic-for-adsl-or-dedicated-remote-linux-box.html

Linux display bandwidth usage on network interface by host

iftop command listens to network traffic on a named network interface, or on the first interface it can find which looks like an external interface if none is specified, and displays a table of current bandwidth usage by pairs of hosts. iftop is a perfect tool for remote Linux server over ssh session.

iftop must be run by the root or the user who has sufficient permissions to monitor all network traffic on the network interface.

Type iftop command at tge shell prompt to display traffic:
# iftop

However, iftop works best when you use filters. For example, if you want to find out how much bandwidth users are wasting or trying to figure out why the network is slow,
# iftop -f icmp
You can display or analyses packet flowing in and out of the 192.168.1.0/24 network:
# iftop -F 192.168.1.0/24
Disable output for DNS traffic by using filter code such as:
# iftop -f 'not port domain'

iftop has many options read man page for further information.

Source: http://www.cyberciti.biz/tips/linux-display-bandwidth-usage-on-network-interface-by-host.html

Restricting Weak SSL Ciphers, F5 BigIP

v9.x Software

SSL functions are performed and configured using SSL client and server profiles. Replace the clientssl parameter to serverssl to configure server SSL profiles.

Image:Applications-internet2-small.png Using the GUI

Assuming you use it as the parent profile, modify the built in clientssl profile cipher list as follows;
  1. Browse to Local TrafficProfilesSSLClient
  2. Select the clientssl profile
  3. Select ConfigurationAdvanced
  4. Enter the following in the Ciphers text box: -ALL:!ADH:!LOW:!EXP:!SSLv2:!NULL:RC4:RSA:HIGH:MEDIUM
  5. Click Update

All profiles using the clientssl parent profile are automatically updated.

Profiles not using this parent profile will have to be manually updated, selecting the relevant profile at step 2.

Image:Utilities-terminal-small.png Using the CLI

bigpipe profile clientssl clientssl \{ ciphers \-ALL:\!ADH:\!LOW:\!EXP:\!SSLv2:RC4:RSA:HIGH:MEDIUM\ \}


Source:- http://www.routerzone.eu/wiki/index.php/Restricting_Weak_SSL_Ciphers,_F5_BigIP