Mailing List Archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [tlug] Latency thru firewall



Quoth Mike Gauthier (Thu 2002-09-19 08:34:50PM +0900):
> On Wed, 18 Sep 2002, Sven Simon wrote:
> 
> > The firewall I'm sitting behind doesn't let ICMP traffic thru and I
> > only have the ssh port open, so ping obviously times out. Is there
> > another way to determine the latency to the machine I connect to
> > via ssh other than using ping?
> 
> Try this command.
> 
> time nmap -n -sT -p 22 -P0 <ip address to "ping">

Great suggestion. You could add a little Perl to give you a quick average
latency:

i=0
while [ $i -lt 100 ]; do
	/usr/bin/time -a -o /tmp/latency.data nmap -n -p 22 -P0 -sT ip_addr >/dev/null
	let i+=1
done
cat /tmp/latency.data | perl -e \
'my $tot = 0;
my $num = 100;
while( <> )
{
	if( $_ =~ /\s+(\d+\.\d+)\suser/ )
	{
		$tot+=$1;
	}
}
print "Ave: ". $tot/$num."s\n";'


Obviously, you can change the number of iterations by changing the '-lt 100' to
'-lt num' and changing the 'my $num = 100' to 'my $num = num', where num is the
number of iterations desired.

Also remember that since this is a TCP connect() scan, it is going to show up
in the logs of the remote host. If you do not own said machine, you may want to
notify the administrator of it that you are doing some latency scanning.


-- 
Josh Glover <jmglov@example.com>

Associate Systems Administrator
INCOGEN, Inc.
http://www.incogen.com/

GPG keyID 0x62386967 (7479 1A7A 46E6 041D 67AE  2546 A867 DBB1 6238 6967)
gpg --keyserver pgp.mit.edu --recv-keys 62386967

Attachment: pgp00139.pgp
Description: PGP signature


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links