<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>108.bz &#187; Switching</title>
	<atom:link href="http://www.108.bz/posts/tag/switching/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.108.bz</link>
	<description>Wandering futilities...</description>
	<lastBuildDate>Fri, 27 May 2011 09:08:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Who ate all the bandwidth?</title>
		<link>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/</link>
		<comments>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/#comments</comments>
		<pubDate>Sun, 28 Mar 2010 17:36:40 +0000</pubDate>
		<dc:creator>Giuliano</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Performance Monitoring]]></category>
		<category><![CDATA[Switching]]></category>
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://www.108.bz/?p=370</guid>
		<description><![CDATA[Today Internet browsing is particularly slow. At seemingly random intervals, available bandwith drops down and people get more and more irritable. How do you find out why this is happening? The possible causes boil down to: Router/Firewall1 is not pleased by &#8220;something&#8221;. Could be an attack or a bug in the device firmware. Too many [...]]]></description>
			<content:encoded><![CDATA[<p>Today Internet browsing is particularly slow.<br />
At seemingly random intervals, available bandwith drops down and people get more and more irritable. <img src='http://www.108.bz/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>How do you find out why this is happening?</p>
<p>The possible causes boil down to:</p>
<ol style="list-style-type: upper-alpha;">
<li style="list-style-type: upper-alpha;">Router/Firewall<sup class='footnote'><a href='#fn-370-1' id='fnref-370-1'>1</a></sup> is not pleased by &#8220;something&#8221;. Could be an attack or a bug in the device firmware.</li>
<li style="list-style-type: upper-alpha;">Too many connections. Maybe they&#8217;re not passing much traffic, but the internet gateway can&#8217;t keep up with their number. I&#8217;ve seen firewalls perform very badly in this respect. E.g.: 3 connections trying to download/upload as fast as they can, and a total, aggregate, b/w of 10Mbps. Those 3 plus 3000 &#8220;normal&#8221; connections and a total b/w of 6Mbps.</li>
<li style="list-style-type: upper-alpha;">A reasonable amount of connections, effectively eating all of the available bandwidth.</li>
</ol>
<p>I&#8217;ll skip case <b>A</b>, for now. <img src='http://www.108.bz/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
In case <b>B</b> you&#8217;ll likely want to know the firewall&#8217;s idea of &#8220;netstat&#8221;, meaning the complete listing of TCP/UDP/other connections. No big deal if the device has got some sort of CLI access: capture its output, import it into a spreadsheet, or use awk/sort/grep<sup class='footnote'><a href='#fn-370-2' id='fnref-370-2'>2</a></sup> to build your stats. Usually, computing total number of connections by source IP address and sorting accordingly, is enough to gain some insight about what&#8217;s going on.<br />
Case <b>C</b>&#8230; For long-running (days) data analysis, you could use a tool like <a href="http://www.ntop.org/">NTOP</a>. But if, like me today, you need to act quickly (perhaps because you know that the issue will disappear soon), <a href="http://www.ex-parrot.com/pdw/iftop/">iftop</a> can hardly be beaten.<br />
Both tools require the machine they run on to be able to &#8220;sniff&#8221; all the traffic passing through the firewall. This can be accomplished by configuring <i>monitoring</i>/<i>monitored</i> port(s) on a switch.  <i>Monitored</i> ports get their inbound/outbound traffic copied to the monitoring one. Different vendors call the thing a different way, <i>port mirroring</i> is also a good keyphrase. Here are a couple of resources:</p>
<ul>
<li>(Old) 3Com Superstack: <a href="http://blog.icewolf.ch/archive/2008/07/08/monitor-port-on-3com-4400.aspx">Monitor Port on 3Com 4400</a></li>
<li>HP ProCurve, pretty straightforward to set up using the &#8220;menu&#8221; interface:  <a href="http://www.hp.com/rnd/support/faqs/sw_208_224.htm#question25">How do I attach a LAN Analyzer to a Switch 208t/224t port to monitor LAN traffic for diagnostic purposes?</a></li>
<li>ProCurve switches are not limited to mirroring ports that belong to the same device/chassis: <a href="http://pro-h40060-hpwpux-pro.atlanta.hp.com/procurve/uk/en/pdfs/application-notes/AN-S14_ProCurve-intelligent-mirroring-final.pdf">How to configure remote and intelligent mirroring on ProCurve switches</a></li>
<li>
Low-end HP switches (like the ProCurve 1800 one I encountered here), though, are only manageable via a web gui:<br />
<div id="attachment_389" class="wp-caption alignnone" style="width: 310px"><a href="http://www.108.bz/wp-content/uploads/2010/03/procurve1800mirroring.png"><img src="http://www.108.bz/wp-content/uploads/2010/03/procurve1800mirroring-300x120.png" alt="Port Mirroring on a ProCurve 1800" title="procurve1800mirroring" width="300" height="120" class="size-medium wp-image-389" /></a><p class="wp-caption-text">Port Mirroring on a ProCurve 1800</p></div>
</li>
<li>Cisco: <a href="http://en.wikipedia.org/wiki/Port_mirroring">Port Mirroring</a>, <a href="http://itprofesionals.blogspot.com/2009/12/configuring-cisco-catalyst-switch-span.html">Configuring a Cisco Catalyst Switch SPAN mirroring port</a>
</li>
</ul>
<p>(You could as well use a hub instead of a switch and get implicit mirroring of any port, to any port of the hub. Just unplug the firewall, link the hub to the switch, plug firewall and monitoring host in the hub. Kludgy but quick and easy, if you can afford the temporary cabling changes, and the bottleneck introduced by the hub&#8230;)</p>
<p>So:
<ul>
<li>Find the switch where the firewall is connected to. Which side of the firewall? It depends on where you believe the issues originates from. Let&#8217;s say the culprit is most likely to lie on the LAN &rarr; switch port A.</li>
<li>Connect your laptop/monitoring machine to the same switch &rarr; port B.</li>
<li>Set up monitoring: port A is <i>monitored</i>, port B is <i>monitoring</i>.</li>
<li>Run iftop, maybe telling it to also show port numbers (&#8220;-P&#8221;, without this switch, you&#8217;ll only see totals by source/destination IP addresses couple), don&#8217;t display hostnames &#8220;-n&#8221;, the interface &#8220;-i eth0&#8243; and provide a meaningful filter (here I&#8217;m selecting packets whose source is not on the LAN<sup class='footnote'><a href='#fn-370-3' id='fnref-370-3'>3</a></sup>. The &#8220;-p&#8221; option instructs iftop to capture packets in <a href="http://en.wikipedia.org/wiki/Promiscuous_mode">promiscuous</a> mode. Without it, iftop won&#8217;t lift off the wire packets that aren&#8217;t addressed to the machine on which it is running.
<div class="codecolorer-container text blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:550px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">iftop -p -P -n -i eth0 -f 'not src net 192.168.200.0/23'</div></div>
<p>Iftop will produce a realtime table of running connections, sorted by how demanding they are in terms of bandwidth (10s average, by default). See the screenshot below; the top connections are due to two running video conference streams stealing 1Mbit/second worth of bandwidth, each.<br />
<div id="attachment_394" class="wp-caption alignnone" style="width: 310px"><a href="http://www.108.bz/wp-content/uploads/2010/03/iftop.png"><img src="http://www.108.bz/wp-content/uploads/2010/03/iftop-300x193.png" alt="iftop output" title="iftop" width="300" height="193" class="size-medium wp-image-394" /></a><p class="wp-caption-text">iftop's output</p></div><br />
Once everything is set up and you&#8217;re able to read iftop&#8217;s output, spotting the &#8220;top talkers&#8221; of your net becomes kids play, enjoy!</p>
<div class='footnotes'>
<div class='footnotedivider'></div>
<ol>
<li id='fn-370-1'>for brevity, I&#8217;ll just say &#8220;firewall&#8221; from now on. <span class='footnotereverse'><a href='#fnref-370-1'>&#8617;</a></span></li>
<li id='fn-370-2'>Yuri is king at doing that. See his <a href="http://yurisk.info/2010/03/08/awk-weekly-checkpoint-anti-spam-statistics-or-viva-la-open-relays/">AWK weekly</a> series. <span class='footnotereverse'><a href='#fnref-370-2'>&#8617;</a></span></li>
<li id='fn-370-3'>iftop will still show these source addresses, since its output is always made of bidirectional &#8220;connections&#8221;. Only, counters pertaining to the LAN &rarr; outside direction, won&#8217;t increase. <span class='footnotereverse'><a href='#fnref-370-3'>&#8617;</a></span></li>
</ol>
</div>
 <img src="http://www.108.bz/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=370" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.108.bz/posts/it/who-ate-all-the-bandwidth/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

