Monday, 11 June 2012

Monitoring tcp connections using Tcptrack

Install Tcptrack to monitor TCP connections. Tcptrack is an excellent tool to monitor your server network connections and bandwidth quickly, installation is pretty easy and can be done either via rpm or source.

# cd /usr/src/

# wget http://packages.sw.be/tcptrack/tcptrack-1.1.5-1.2.el5.rf.i386.rpm

# rpm -ivh tcptrack-1.1.5-1.2.el5.rf.i386.rpm

 OR

 # tar zxvf tcptrack-1.3.0.tar.gz

 # cd tcptrack-1.3.0

 # ./configure ; make & make install

 tcptrack -h
 
 TCPtrack can monitor only one nic at once with only one parameter to run (if you have two nic ie.. eth0 & eth1 )

    # tcptrack -i eth0
   # tcptrack -i eth1

 
The following example will only show connections from host 68.36.45.78:

    # tcptrack -i eth0 src or dst 68.36.45.78

To monitor the specific ports (ie..port 80 and 22):

    # tcptrack -i eth0 port 80
   # tcptrack -i eth0 port 22



Network bandwidth monitoring bmon

bmon is a portable bandwidth monitor and rate estimator running on various operating systems.

# sudo apt-get install bmon

# bmon


Bandwidth monitoring using bwm-ng

small and simple console-based bandwidth monitor.Bandwidth Monitor NG is a small and simple console-based live bandwidth monitor. 

# sudo apt-get install bwm-ng

# bwm-ng

OR

# cd /usr/src      

# wget http://www.gropp.org/bwm-ng/bwm-ng-0.6.tar.gz

# tar zxvf bwm-ng-0.6.tar.gz

# cd bwm-ng-0.6

# ./configure && make && make install

Type bwm-ng -h and make sure you are able to see the command help menu.
* Network Monitoring using bwm-ng....
  # bwm-ng -u bits -d
  # bwm-ng -u bytes -d 

Options to see all the NIC status in bits and bytes and -d is for dynamic output which displays in the KB/s and MB/s dynamically.
 
 * Disk I/O monitoring using bwn-ng
    Monitoring disk I/O is pretty simple with bwn-ng

  # bwm-ng -u bytes  -i disk

Monitoring bandwidth using iftop

iftop does for network usage what top does for CPU usage. It listens to network traffic on a named interface and displays a table of current bandwidth usage by pairs of hosts.

# iftop

Bandwidth Monitoring using cbm

the Color Bandwidth Meter — displays the current traffic on all network devices.

# sudo apt-get install cbm

$ cbm

Network monitoring using tcptrack

tcptrack is a sniffer which displays information about TCP connections it sees on a network interface. It passively watches for connections on the network interface, keeps track of their state and displays a list of connections in a manner similar to the unix ‘top’ command. It displays source and destination addresses and ports, connection state, idle time, and bandwidth usage.

# sudo apt-get install tcptrack

# tcptrack -i eth0

# tcptrack -i eth0 port 80


How to add a new user in ubuntu


# sudo useradd -d /home/scott -m scott

Changing default shell in ubuntu

2. Use chsh command
a) type chsh

    $ chsh

b) You will be asked for password. Enter your password
c) This screen will appear

    Enter the new value, or press ENTER for the default
    Login Shell [/bin/sh]:

d) Put /bin/bash at the menu and press Enter.