<?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>Quality of Service Blog</title>
	<atom:link href="http://qos.wawit.pl/feed/" rel="self" type="application/rss+xml" />
	<link>http://qos.wawit.pl</link>
	<description>QoS knowledge</description>
	<lastBuildDate>Tue, 13 Jul 2010 20:24:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Asterisk RTPAUDIOQOS</title>
		<link>http://qos.wawit.pl/2010/06/asterisk-rtpaudioqos/</link>
		<comments>http://qos.wawit.pl/2010/06/asterisk-rtpaudioqos/#comments</comments>
		<pubDate>Sun, 20 Jun 2010 10:47:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[rtp]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=310</guid>
		<description><![CDATA[Asterisk provides tool for reporting QoS.
It can be actived by adding fallowing rule to given context:
exten =&#62; h,1,Set(CDR(userfield)=${RTPAUDIOQOS})
&#8211;
In that case all metrics would be added at the end of CDR file. Default it is Master.csv located at /var/log/asterisk/cdr-csv/
Added fields look like this:
ssrc=408070608;
themssrc=12192;
lp=0;
rxjitter=0.000581;
rxcount=376;
txjitter=0.000031;
txcount=399;
rlp=0;
rtt=0.000000

&#8211;
Explanation of fields could be found at http://wiki.kolmisoft.com :

Our Receiver

 ssrc &#8211; our synchronization [...]]]></description>
			<content:encoded><![CDATA[<p>Asterisk provides tool for reporting QoS.</p>
<p>It can be actived by adding fallowing rule to given context:</p>
<p><code>exten =&gt; h,1,Set(CDR(userfield)=${RTPAUDIOQOS})</code></p>
<p>&#8211;</p>
<p>In that case all metrics would be added at the end of CDR file. Default it is <span style="color: #ff6600;">Master.csv</span> located at <span style="color: #ff6600;">/var/log/asterisk/cdr-csv/</span></p>
<p>Added fields look like this:<br />
<code>ssrc=408070608;<br />
themssrc=12192;<br />
lp=0;<br />
rxjitter=0.000581;<br />
rxcount=376;<br />
txjitter=0.000031;<br />
txcount=399;<br />
rlp=0;<br />
rtt=0.000000<br />
</code><br />
&#8211;</p>
<p>Explanation of fields could be found at <a title="http://wiki.kolmisoft.com" href="http://wiki.kolmisoft.com/index.php/RTPAUDIOQOS_Demystified" target="_blank">http://wiki.kolmisoft.com</a> :</p>
<ul>
<li>Our Receiver
<ul>
<li> <strong>ssrc</strong> &#8211; our synchronization source</li>
<li> <strong>rxcount</strong> &#8211; no. received packets/Received packets</li>
<li> <strong>lp</strong> &#8211; lost packets/Lost packets</li>
<li> <strong>rxjitter</strong> &#8211; our calculated jitter(rx)/Jitter</li>
</ul>
</li>
</ul>
<ul>
<li> Our Sender
<ul>
<li> <strong>themssrc</strong> &#8211; their synchronization source</li>
<li> <strong>txcount</strong> &#8211; transmitted packets/Sent packet</li>
<li> <strong>rlp</strong> &#8211; remote lost packets/Lost packets</li>
<li> <strong>txjitter</strong> &#8211; reported jitter of the other end/Jitter</li>
<li> <strong>rtt</strong> &#8211; round trip time/RTT</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/06/asterisk-rtpaudioqos/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting QoS metrics using TRPR</title>
		<link>http://qos.wawit.pl/2010/05/getting-qos-metrics-using-trpr/</link>
		<comments>http://qos.wawit.pl/2010/05/getting-qos-metrics-using-trpr/#comments</comments>
		<pubDate>Thu, 27 May 2010 19:29:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Practical]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[mgen]]></category>
		<category><![CDATA[tcpdump]]></category>
		<category><![CDATA[trpr]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=291</guid>
		<description><![CDATA[TRPR (TRace Plot Real-time) is a program which analyzes output    from various sources and creates output  suitable    for  plotting.
It can analyze output files from:

tcpdump
Network Simulator 2
mgen

&#8211;
TRPR is able to prepare IP QoS metrics such as:

mean rate of packets stream
differential interarrival    packet   delays
transmission [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://pf.itd.nrl.navy.mil/protools/trpr.html" target="_blank"><em>TRPR</em></a> (TRace Plot Real-time) is a program which analyzes output    from various sources and creates output  suitable    for  plotting.</p>
<p>It can analyze output files from:</p>
<ul>
<li>tcpdump</li>
<li>Network Simulator 2</li>
<li>mgen</li>
</ul>
<p>&#8211;</p>
<p>TRPR is able to prepare IP QoS metrics such as:</p>
<ul>
<li>mean rate of packets stream</li>
<li>differential interarrival    packet   delays</li>
<li>transmission delay</li>
<li>packet loss</li>
<li>end other</li>
</ul>
<p>&#8211;</p>
<p>TRPR can distinguish each flow according to: source and destination IP, source and destination port, flow id and type of transmission (TCP or UDP).</p>
<p>Example:</p>
<p><code>./trpr latency drec input input.drc auto X,X,192.168.10.116/4000 output output.txt</code></p>
<ul>
<li><span style="color: #ff6600;">input.drc</span>: output file from mgen</li>
<li><span style="color: #ff6600;">192.168.10.116/4000</span>: destination IP and port which identifies flow</li>
<li><span style="color: #ff6600;">output.txt</span>: file ready for plotting</li>
<li>information about other parameters can be found <a href="http://pf.itd.nrl.navy.mil/protools/trpr.html" target="_blank">here</a>.</li>
</ul>
<p>&#8211;</p>
<p>What if I wanted to have mean values of metrics in given flow?</p>
<p>Linux <span style="color: #ff6600;">awk</span> tool can be used for providing metrics from <span style="color: #ff6600;">output.txt</span>.</p>
<p>First of all we have to remove from our file few lines from the beginning, which are used for plotting.</p>
<p>Awk script for getting mean value can look like (2nd column in our file is one with latencies):</p>
<p><code>BEGIN { FS = " "} {<br />
allV = $2 + allV;<br />
all = all+1;<br />
} END {<br />
mean = allV/all<br />
print "Mean Latency: " mean<br />
}</code></p>
<p>After executing:</p>
<p><code>awk -f script.awk output.txt</code></p>
<p>we should get mean delay of our flow.</p>
<p>What is important: source and destination <strong>MUST BE</strong> synchronized if metrics such as latency and interarrival time are important for us. It would be fine even if one of them would be source of time for another.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/05/getting-qos-metrics-using-trpr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generate traffic using mgen</title>
		<link>http://qos.wawit.pl/2010/05/generate-traffic-using-mgen/</link>
		<comments>http://qos.wawit.pl/2010/05/generate-traffic-using-mgen/#comments</comments>
		<pubDate>Wed, 05 May 2010 10:38:01 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Practical]]></category>
		<category><![CDATA[IP]]></category>
		<category><![CDATA[metrics]]></category>
		<category><![CDATA[mgen]]></category>
		<category><![CDATA[tos]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[trpr]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=261</guid>
		<description><![CDATA[Multi Generator  is one of  free traffic generators.  Current release is mgen 4.2b4. Source could be downloaded here. I installed it on fresh and default Centos 5.3 (2.6.18-128.el5) linux. In order  to work mgen properly, libstdc++.so.5 must be installed:
yum install libstdc++.so.5
and after according to manual:
tar -xvf src-mgen-4.2b6.tgz
cd mgen-4.2b6/unix/
make –f Makefile.linux mgen
and add directory to [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Multi Generator" href="http://cs.itd.nrl.navy.mil/work/mgen/index.php" target="_blank">Multi Generator </a> is one of  free traffic generators.  Current release is mgen 4.2b4. Source could be downloaded <a title="here" href="http://downloads.pf.itd.nrl.navy.mil/mgen/mgen4/src-mgen-4.2b6.tgz">here</a>. I installed it on fresh and default Centos 5.3 (2.6.18-128.el5) linux. In order  to work mgen properly, <span style="color: #ff6600;">libstdc++.so.5</span> must be installed:</p>
<p><code>yum install libstdc++.so.5</code></p>
<p>and after according to manual:</p>
<p><code>tar -xvf src-mgen-4.2b6.tgz<br />
cd mgen-4.2b6/unix/<br />
make –f Makefile.linux mgen</code></p>
<p>and add directory to PATH:<span style="color: #ff6600;"> </span></p>
<p><code>export PATH=$PATH:/path/to/mgen-4.2b6/mgen</code></p>
<p>Mgen can sent and receive traffic. That&#8217;s why one host acts as sender and other as receiver</p>
<p>Now we can make a test:</p>
<p>Create script on sender side: <span style="color: #ff6600;">test_input.mgn</span> with:</p>
<p><code>0.0 ON 1 UDP DST 192.168.10.116/4000 PERIODIC [10.0 1024] TOS 0x10<br />
10.0 OFF 1</code></p>
<p>It says that we send to 192.168.10.116 on port 4000 PERIODIC traffic. Each packet is 1024 bytes long and in one second 10 packets are sent. What is more, we set on each packet ToS = 0&#215;10. <em>Notice, that 1024B includes IP header</em>. Mgen stops sending packets after 10s.</p>
<p>On receiver side mgen must listen on given port. In order to do this we create script <span style="color: #ff6600;">test_listen.mgn</span>:</p>
<p><code>LISTEN UDP 4000</code></p>
<p>Please remember to allow traffic to go through your firewall! Or simply type:</p>
<p><code>service iptables stop</code></p>
<p>&#8211;</p>
<p>First we must start listening on receiver side:</p>
<p><code>mgen input test_listen.mgn output test_output.drc</code></p>
<p>In <span style="color: #ff6600;">test_output.drc</span> would be stored captured data for using with TRPR in order to provide QoS metrics.</p>
<p>Now we can start sending packets. We do it on sender side by:</p>
<p><code>mgen input test_input.mgn</code></p>
<p>After 10s mgen terminates itself and we can prepare other things with <span style="color: #ff6600;">test_output.drc</span>, which would be shown in next posts.</p>
<p>It is worth to read about other avaliable <a title="other options" href="http://pf.itd.nrl.navy.mil/mgen/mgen.html" target="_blank">options</a> in mgen. According to particular needs they might be very useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/05/generate-traffic-using-mgen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting ToS in Asterisk</title>
		<link>http://qos.wawit.pl/2010/04/setting-tos-in-asterisk/</link>
		<comments>http://qos.wawit.pl/2010/04/setting-tos-in-asterisk/#comments</comments>
		<pubDate>Fri, 23 Apr 2010 16:01:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[dscp]]></category>
		<category><![CDATA[rtp]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[tos]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=249</guid>
		<description><![CDATA[Recently I&#8217;ve installed the newest  Asterisk 1.6.2.6.  I dealt  with Asterisk few times in past but never focused on QoS capability. What I found interesting is that in sip.conf there are fields for setting ToS field (with default values provided):

tos_sip=cs3   (SIP signalling messages)
tos_audio=ef    (RTP audio)
tos_video=af41    (RTP video)
tos_text=af41    (RTP text)

Settings are also avaliable for [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve installed the newest  <a title="Asterisk 1.6.2.6" href="http://www.asterisk.org/downloads" target="_blank">Asterisk 1.6.2.6</a>.  I dealt  with Asterisk few times in past but never focused on QoS capability. What I found interesting is that in sip.conf there are fields for setting ToS field (with default values provided):</p>
<ul>
<li>tos_sip=cs3   (SIP signalling messages)</li>
<li>tos_audio=ef    (RTP audio)</li>
<li>tos_video=af41    (RTP video)</li>
<li>tos_text=af41    (RTP text)</li>
</ul>
<p>Settings are also avaliable for other protocols:</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/04/asterisk_qos.jpg"><img class="aligncenter size-medium wp-image-253" title="asterisk_qos" src="http://qos.wawit.pl/wp-content/uploads/2010/04/asterisk_qos-300x126.jpg" alt="" width="300" height="126" /></a></p>
<p>Even those parameters are named <span style="color: #ff6600;">ToS</span> they actually set <span style="color: #ff6600;">DSCP</span>. It might be misleading, because ToS it is full byte, whilst DSCP is a 6-bits part of ToS field.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/04/setting-tos-in-asterisk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting ToS using iptables</title>
		<link>http://qos.wawit.pl/2010/04/setting-tos-using-iptables/</link>
		<comments>http://qos.wawit.pl/2010/04/setting-tos-using-iptables/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 16:39:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dscp]]></category>
		<category><![CDATA[Iptables]]></category>
		<category><![CDATA[mangle]]></category>
		<category><![CDATA[tos]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=236</guid>
		<description><![CDATA[It is possible to set ToS using iptables. The pity is that only 5 values are valid:  iptables -m tos -h

Minimize-Delay 16 (0&#215;10)
Maximize-Throughput 8 (0&#215;08)
Maximize-Reliability 4 (0&#215;04)
Minimize-Cost 2 (0&#215;02)
Normal-Service 0 (0&#215;00)

As you noticed, only one of 4 bits (11, 12, 13, 14) from ToS octet can be set   Sample firewall rules:
iptables -t [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible to set ToS using iptables. The pity is that only 5 values are valid:  <code>iptables -m tos -h</code></p>
<ul>
<li>Minimize-Delay 16 (0&#215;10)</li>
<li>Maximize-Throughput 8 (0&#215;08)</li>
<li>Maximize-Reliability 4 (0&#215;04)</li>
<li>Minimize-Cost 2 (0&#215;02)</li>
<li>Normal-Service 0 (0&#215;00)</li>
</ul>
<p>As you noticed, only one of 4 bits (11, 12, 13, 14) from ToS octet can be set  <a href="http://qos.wawit.pl/wp-content/uploads/2010/04/precedence.jpg"><img class="aligncenter size-medium wp-image-239" title="precedence" src="http://qos.wawit.pl/wp-content/uploads/2010/04/precedence-300x45.jpg" alt="" width="300" height="45" /></a> Sample firewall rules:</p>
<p><code>iptables -t mangle -N mark-tos<br />
iptables -t mangle -A OUTPUT -j mark-tos<br />
iptables -t mangle -A mark-tos -p icmp -j TOS --set-tos 16</code></p>
<p>In example only icmp packets are marked.  Setting ToS using iptables isn&#8217;t so useful as setting DSCP.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/04/setting-tos-using-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting DSCP using iptables &#8211; 2</title>
		<link>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables-2/</link>
		<comments>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables-2/#comments</comments>
		<pubDate>Tue, 13 Apr 2010 14:43:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Iptables]]></category>
		<category><![CDATA[avaya]]></category>
		<category><![CDATA[dscp]]></category>
		<category><![CDATA[h323]]></category>
		<category><![CDATA[mangle]]></category>
		<category><![CDATA[rtp]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[tos]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=178</guid>
		<description><![CDATA[Below is example of setting two classes for:

signaling
media

It was created for SIP and H.323. There is many differences between them and it seems that SIP is becoming much more popular nowadays thanks to its simplicity.
Both have got signaling and media layer. Usually network ports that are used for these purposes are:
1.For SIP:

signaling: TCP/UDP 5060, TCP [...]]]></description>
			<content:encoded><![CDATA[<p>Below is example of setting two classes for:</p>
<ul>
<li>signaling</li>
<li>media</li>
</ul>
<p>It was created for SIP and H.323. There is many differences between them and it seems that SIP is becoming much more popular nowadays thanks to its simplicity.</p>
<p>Both have got <em><span style="color: #ff6600;">signaling</span></em> and <em><span style="color: #ff6600;">media</span></em> layer. Usually network ports that are used for these purposes are:</p>
<p>1.For SIP:</p>
<ul>
<li>signaling: TCP/UDP 5060, TCP 5061 (secure TCP)</li>
<li>media: UDP, depends on configuration</li>
</ul>
<p>2. For H.323</p>
<p>As example was based on Avaya solution in which there are Communication Manager and Gateway/Gatekeeper.</p>
<ul>
<li>signaling: TCP/UDP 1719, TCP/UDP 1720</li>
<li>media: UDP, depends on configuration</li>
</ul>
<p>For signaling we ascribed DSCP class <span style="color: #ff6600;">CS4</span> <span style="color: #ff6600;"> </span>, whilst for media <span style="color: #ff6600;">EF</span>.</p>
<p>Iptables should look more or less like this</p>
<p>&#8212;</p>
<h3>MEDIA:</h3>
<p><code>#out<br />
iptables -t mangle -A mark-media -p udp -s $IP_1 -d $IP_2 --dport $RTP_RANGE -j DSCP --set-dscp-class ef<br />
#in<br />
iptables -t mangle -A mark-media -p udp -s $IP_2 -d $IP_1 --sport $RTP_RANGE -j DSCP --set-dscp-class ef</code><br />
where:</p>
<p>IP_1 and IP_2 &#8211; IP&#8217;s ranges of endpoints</p>
<p>RTP_RANGE &#8211; UDP ports ranges for RTP</p>
<p>&#8212;</p>
<h3>SIGNALING:</h3>
<p><code>#out<br />
iptables -t mangle -A mark-signaling-sip -p tcp -s $SIP_ENDPOINT_IP -d $SIP_GW_IP --dport 5060:5061 -j DSCP --set-dscp-class cs4<br />
#in<br />
iptables -t mangle -A mark-signaling-sip -p tcp -s $SIP_GW_IP --sport 5060:5061 -d $SIP_ENDPOINT_IP -j DSCP --set-dscp-class cs4</code></p>
<p>where:</p>
<p>SIP_ENDPOINT_IP &#8211; SIP endpoint</p>
<p>SIP_GW_IP &#8211; SIP Proxy/Registrar<br />
<code>#out<br />
iptables -t mangle -A mark-signaling-h323 -p tcp -s $AVAYA_ENDPOINT_IP -d $AVAYA_CM_IP --dport 1719:1720 -j DSCP --set-dscp-class cs4<br />
iptables -t mangle -A mark-signaling-h323 -p udp -s $AVAYA_ENDPOINT_IP -d $AVAYA_GW_IP --dport 1719:1720 -j DSCP --set-dscp-class cs4<br />
#in<br />
iptables -t mangle -A mark-signaling-h323 -p tcp -s $AVAYA_CM_IP --sport 1719:1720 -d $AVAYA_ENDPOINT_IP -j DSCP --set-dscp-class cs4<br />
iptables -t mangle -A mark-signaling-h323 -p udp -s $AVAYA_GW_IP --sport 1719:1720 -d $AVAYA_ENDPOINT_IP -j DSCP --set-dscp-class cs4</code></p>
<p>where:</p>
<p>AVAYA_ENDPOINT_IP &#8211; H.323 endpoint</p>
<p>AVAYA_CM_IP &#8211; Avaya Comunication Manager</p>
<p>AVAYA_GW_IP &#8211; Avaya Gateway/H.323 Gatekeeper</p>
<p>In example we assumed that there is proper <strong>FILTER</strong> chain in  iptables configured allowing transmission over above TCP/UDP ports</p>
<p>Chains: <span style="color: #ff6600;">mark-media, mark-signaling-sip, mark-signaling-h323</span> should be added to PREROUTING chain in mangle table:<span style="color: #ff6600;"> </span></p>
<p><code>ptables -t mangle -A PREROUTING -j mark-signaling-sip<br />
iptables -t mangle -A PREROUTING -j mark-signaling-h323<br />
iptables -t mangle -A PREROUTING -j mark-media<code></p>
<p>Now we are able to distinguish media and signaling for VoIP in our network and we can start dealing with queueing disciplines</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting DSCP using iptables &#8211; 1</title>
		<link>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables/</link>
		<comments>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables/#comments</comments>
		<pubDate>Thu, 08 Apr 2010 09:58:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Iptables]]></category>
		<category><![CDATA[dscp]]></category>
		<category><![CDATA[mangle]]></category>
		<category><![CDATA[marking]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=150</guid>
		<description><![CDATA[If our hardware/software (i.e. IP Phone, gateway) doesn&#8217;t set proper DSCP value it can be done using iptables in the nearest linux machine. In scenario there are two hosts:


Ping Request is a linux (CentOS 5.3, 2.6.18-128.e15) with iptables v1.3.5
Ping Response is Windows 7 with Wireshark on board

In example, just for simplification, all traffic from Ping [...]]]></description>
			<content:encoded><![CDATA[<p>If our hardware/software (i.e. IP Phone, gateway) doesn&#8217;t set proper DSCP value it can be done using iptables in the nearest linux machine. In scenario there are two hosts:</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/04/mark-dscp1.jpg"><img class="aligncenter size-medium wp-image-152" title="mark-dscp" src="http://qos.wawit.pl/wp-content/uploads/2010/04/mark-dscp1-300x184.jpg" alt="" width="300" height="184" /></a></p>
<ul>
<li><em>Ping Request</em> is a linux (CentOS 5.3, 2.6.18-128.e15) with iptables v1.3.5</li>
<li><em>Ping Response</em> is Windows 7 with Wireshark on board</li>
</ul>
<p>In example, just for simplification, all traffic from <em>Ping Request</em> host is mark with DSCP value 46 (Critical).</p>
<p>Changes in firewall were done after fresh install (default iptables rules):</p>
<pre><span style="color: #ff6600;">iptables -t mangle -N wawit-mark-dscp-46</span></pre>
<pre><span style="color: #ff6600;">iptables -t mangle -A POSTROUTING -j wawit-mark-dscp-46</span></pre>
<pre><span style="color: #ff6600;">iptables -t mangle -A wawit-mark -j DSCP --set-dscp 46
</span></pre>
<p>After ping command on <em>Ping Response</em> host we captured:</p>
<p style="text-align: center;"><a href="http://qos.wawit.pl/wp-content/uploads/2010/04/mark-dscp-wireshark3.jpg"><img class="aligncenter size-full wp-image-161" title="mark-dscp-wireshark" src="http://qos.wawit.pl/wp-content/uploads/2010/04/mark-dscp-wireshark3.jpg" alt="" width="512" height="106" /></a></p>
<p>DSCP value 0&#215;2e in hex is equal to 46 in decimal.</p>
<p>Example is trivial. Of course we should set DSCP value in packets according to available criteria, i.e. src/dst IP address, port, protocol etc.</p>
<p>After having proper DSCP values we can implement QoS mechanism in our network nodes according to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/04/setting-dscp-using-iptables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ToS and DSCP</title>
		<link>http://qos.wawit.pl/2010/03/tos-and-dscp/</link>
		<comments>http://qos.wawit.pl/2010/03/tos-and-dscp/#comments</comments>
		<pubDate>Wed, 31 Mar 2010 21:19:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory]]></category>
		<category><![CDATA[diffserv]]></category>
		<category><![CDATA[dscp]]></category>
		<category><![CDATA[ip precedence]]></category>
		<category><![CDATA[tos]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=129</guid>
		<description><![CDATA[In order to provide Quality of Service, there should be a way to distinguish priority of each arriving packet according to DiffServ Architecture.
In IP packet header there is special group of 8 bits (from 8th to 15th respectively in header) dedicated for that purpose. They are called Type of Service.

In Precedence could be one of [...]]]></description>
			<content:encoded><![CDATA[<p>In order to provide Quality of Service, there should be a way to distinguish priority of each arriving packet according to <a title="DiffServ Architecture" href="http://en.wikipedia.org/wiki/Differentiated_services" target="_blank">DiffServ Architecture</a>.</p>
<p>In IP packet header there is special group of 8 bits (from 8th to 15th respectively in header) dedicated for that purpose. They are called Type of Service.</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/03/precedence.jpg"><img class="aligncenter size-medium wp-image-132" title="precedence" src="http://qos.wawit.pl/wp-content/uploads/2010/03/precedence-300x45.jpg" alt="" width="300" height="45" /></a></p>
<p>In Precedence could be one of fallowing values, which informs about packet type :</p>
<ul>
<li>000 – routine</li>
<li>001 &#8211; priority</li>
<li>010 &#8211; immediate</li>
<li>011 &#8211; flash</li>
<li>100 &#8211; flash-override</li>
<li>101 &#8211; critical</li>
<li>110 &#8211; internetwork control</li>
<li>111 &#8211; network</li>
</ul>
<p>Other bits inform that :</p>
<ul>
<li>11 &#8211; packet is delay sensitive (D)</li>
<li>12 &#8211; packet wants high rate (T)</li>
<li>13 &#8211; packet wants high reliability (R)</li>
<li>14 &#8211; mainly unsued</li>
<li>15 &#8211; mainly unsued</li>
</ul>
<p>In DiffServ architecture there was defined Differentiated Services Code Point in ToS field.</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/03/dscp1.jpg"><img class="aligncenter size-medium wp-image-136" title="dscp" src="http://qos.wawit.pl/wp-content/uploads/2010/03/dscp1-300x45.jpg" alt="" width="300" height="45" /></a></p>
<p>It allows to define 64 different classes. The mapping between IP Precendence and DSCP is as fallows:</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/03/mapping2.jpg"><img class="aligncenter size-full wp-image-140" title="mapping" src="http://qos.wawit.pl/wp-content/uploads/2010/03/mapping2.jpg" alt="" width="419" height="171" /></a></p>
<p>First 3 bits from DSCP agrees with IP Precedence.</p>
<p>Thanks to ToS and DSCP we know packets service requirements.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/03/tos-and-dscp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weighted Fair Queueing</title>
		<link>http://qos.wawit.pl/2010/03/weighted-fair-queueing/</link>
		<comments>http://qos.wawit.pl/2010/03/weighted-fair-queueing/#comments</comments>
		<pubDate>Thu, 25 Mar 2010 23:31:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory]]></category>
		<category><![CDATA[wfq]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=114</guid>
		<description><![CDATA[Weighted Fair Queueing (WFQ) is one of the most important among all scheduling mechanism. Every arrived packet has it&#8217;s SN (Sequence Number), which determines, when packet should be served.
where:

SN(i) &#8211; current SN
SNprevious(i) &#8211; previous SN
weight(i) &#8211; weight assigned to flow
lengthpacket(i) &#8211; packet length
&#8220;i&#8221; &#8211; flow number

Now we are sure, that packets (with their different sizes) [...]]]></description>
			<content:encoded><![CDATA[<p>Weighted Fair Queueing (WFQ) is one of the most important among all scheduling mechanism. Every arrived packet has it&#8217;s SN (Sequence Number), which determines, when packet should be served.</p>
<p><a href="http://qos.wawit.pl/wp-content/uploads/2010/03/wfq_sn.jpg"><img class="aligncenter size-medium wp-image-115" title="wfq_sn" src="http://qos.wawit.pl/wp-content/uploads/2010/03/wfq_sn-300x32.jpg" alt="" width="300" height="32" /></a>where:</p>
<ul>
<li>SN(i) &#8211; current SN</li>
<li>SNprevious(i) &#8211; previous SN</li>
<li>weight(i) &#8211; weight assigned to flow</li>
<li>lengthpacket(i) &#8211; packet length</li>
<li>&#8220;i&#8221; &#8211; flow number</li>
</ul>
<p>Now we are sure, that packets (with their different sizes) from many flows are served fairly. None of flows occupies output link more that it&#8217;s configured value.</p>
<p>There are no explicite formula how to count weight and there might be small differences between implementations.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/03/weighted-fair-queueing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Weighted Round Robin</title>
		<link>http://qos.wawit.pl/2010/03/weighted-round-robin/</link>
		<comments>http://qos.wawit.pl/2010/03/weighted-round-robin/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 20:45:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Theory]]></category>
		<category><![CDATA[wrr]]></category>

		<guid isPermaLink="false">http://qos.wawit.pl/?p=73</guid>
		<description><![CDATA[Weighted Round Robin serves packets from every non empty queue in cycle manner. Number of packets, that WRR algorithm takes in cycle, is based on configured weight, which is normalised to unity.

Supposing, normalised weights of depicted above queues are respectively 3 and 2, then number of packets taken in one cycle is 5. First, 3 [...]]]></description>
			<content:encoded><![CDATA[<p>Weighted Round Robin serves packets from every non empty queue in cycle manner. Number of packets, that WRR algorithm takes in cycle, is based on configured weight, which is normalised to unity.</p>
<p style="text-align: center;"><a href="http://qos.wawit.pl/wp-content/uploads/2010/03/wrr11.jpg"><img class="size-full wp-image-80 aligncenter" title="wrr1" src="http://qos.wawit.pl/wp-content/uploads/2010/03/wrr11.jpg" alt="" width="528" height="121" /></a></p>
<p>Supposing, normalised weights of depicted above queues are respectively 3 and 2, then number of packets taken in one cycle is 5. First, 3 packets are taken from <strong><span style="color: #ff0000;">Class #1</span></strong> and after 2 from <span style="color: #99cc00;"><strong>Class #2</strong></span>.</p>
<p>But, one could ask, what if there is no packets for serving in the queue? WRR simply jumps to next queue and pretends that it has already served previous queue. WRR is example of non-work-conserving scheduler, meaning, that it doesn&#8217;t waste time for unproductive work. There is no such situation, that there is at least one packet in the queue and output link is idle.</p>
<p>Weighted Round Robin is pretty good scheduling mechanism. And it becomes better if packets sizes are constant &#8211; in real networks it is impossibile! If sizes of packets in <strong><span style="color: #ff0000;">Class #1</span></strong> queue were 200B and 1000B in <strong><span style="color: #99cc00;">Class #2</span></strong>, and if configured weights were these same (3/2), then real bandwith would be shared in proportion 3/10. It happens, because time of service from <strong><span style="color: #99cc00;">Class #2</span></strong> is 5 times longer than from <span style="color: #ff0000;"><strong>Class #1</strong></span>.</p>
<p>There are two modifications of Round Robin mechanism:</p>
<ul>
<li>Deficit Round Robin &#8211; more fair taking into consideration packets sizes</li>
<li>Shared Round Robin &#8211; very similar to WRR, but in one cycle it can visit every queue many times, according to weigth (=number of packets, that it must take in the cycle). Another words: packets are <strong><span style="color: #ff0000;">m</span><span style="color: #99cc00;">i</span><span style="color: #ff0000;">x</span><span style="color: #99cc00;">e</span><span style="color: #ff0000;">d</span></strong> on Output link.<a href="http://qos.wawit.pl/wp-content/uploads/2010/03/srr.jpg"><img class="size-medium wp-image-103 aligncenter" title="srr" src="http://qos.wawit.pl/wp-content/uploads/2010/03/srr-300x122.jpg" alt="" width="240" height="98" /></a></li>
</ul>
<p>As you noticed, Round Robin mechanisms aren&#8217;t so trivial and it is better to know what mechanism we are using and what for.</p>
]]></content:encoded>
			<wfw:commentRss>http://qos.wawit.pl/2010/03/weighted-round-robin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

