Re: [LARTC] Problem with Howto

Linux Advanced Routing and Traffic Control

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

 



On Tue, Apr 15, 2003 at 12:55:52PM -0500, Dr Aldo Medina wrote:

> In the LART Howto, section 9.6.1 it says: "...we want to assign all
> traffic from and to port 22 to the highest priority band...",

Please excuse my newbie-ness in this matter, but in the case of SSH,
would it not be much better to say "...we want to assign all traffic
from port 22 with TOS of Minimal Delay to the highest priority band..."?

This is because of applications such as scp, which also use port 22, and
is bulk data. I know at least OpenSSH sets TOS appropriately (Only
turned on for interactive stuff, not for scp).

If anyone is interested, I wrote a wrapper script for tcpdump to show
what's happening wrt TOS. I call it tosaudit. To use it, just do (as
root)

tosaudit dst port 22

========================================================================
#!/bin/sh
#
# Audit the use of TOS based on a pcap filter provided by the user.
# 
# Cameron Kerr
# 13 Apr 2003

umask 077

report=/tmp/tosaudit$$
count=1000

echo "#Capture file is $report"
echo "#Capturing $count packets..."

tcpdump -c $count -w $report $*

echo "#Processing..."
tcpdump -r $report -v | \
	sed -e '/\[tos 0x..\]/s/.*\[tos \(0x..\)\].*/\1/' \
		-e 't' -e 's/.*/0x00/' | \
	uniq -c | \
	awk '
	BEGIN {
		sum00 = 0
		sum10 = 0
		sum20 = 0
		sum40 = 0
		sum80 = 0
		suminv = 0
	}

	$2 == "0x00" { sum00 += $1; next }
	$2 == "0x10" { sum10 += $1; next }
	$2 == "0x20" { sum20 += $1; next }
	$2 == "0x40" { sum40 += $1; next }
	$2 == "0x80" { sum80 += $1; next }

	{ suminv += $1 }
	
	END {
		printf( "No TOS                 0x00 = %d\n", sum00 )
		printf( "Minimum Delay          0x10 = %d\n", sum10 )
		printf( "Maximise Throughput    0x20 = %d\n", sum20 )
		printf( "Maximise Reliability   0x40 = %d\n", sum40 )
		printf( "Mimimise Monetary Cost 0x80 = %d\n", sum80 )
		printf( "Others (Non-Standard)  0x?? = %d\n", suminv )
	}'

echo "#Actual TOS values found..."
tcpdump -r $report -v | \
	sed -e 's/.*\[tos \(0x..\)\].*/\1/' -e t -e 's/.*/0x00/' | \
	sort | uniq -c
========================================================================

By the way, is it still wrong to have multiple TOS bits set?

I'll be putting this script on my website in due course, when its a bit
more polished. (Option for reading from capture file, instead of from
network.)

-- 
Cameron Kerr
Email:   cameron.kerr@xxxxxxxxxxxxxxx
Website: http://nzgeeks.org/cameron/



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux