<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>InfoSec Blog</title>
	<atom:link href="http://vietwow.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vietwow.wordpress.com</link>
	<description>Exposing the deep secrets of computer security</description>
	<lastBuildDate>Thu, 31 Jul 2008 08:34:02 +0000</lastBuildDate>
	<language>vi</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='vietwow.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>InfoSec Blog</title>
		<link>http://vietwow.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://vietwow.wordpress.com/osd.xml" title="InfoSec Blog" />
	<atom:link rel='hub' href='http://vietwow.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Note LPI trong ngày (31/07/2008)</title>
		<link>http://vietwow.wordpress.com/2008/07/31/note-lpi-trong-ngay-31072008/</link>
		<comments>http://vietwow.wordpress.com/2008/07/31/note-lpi-trong-ngay-31072008/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 08:21:31 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=52</guid>
		<description><![CDATA[http://analyz3r.blogspot.com/2008/07/note-lpi-trong-ngy-31072008.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=52&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://analyz3r.blogspot.com/2008/07/note-lpi-trong-ngy-31072008.html">http://analyz3r.blogspot.com/2008/07/note-lpi-trong-ngy-31072008.html</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/52/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/52/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=52&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/31/note-lpi-trong-ngay-31072008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>Installing and Updating Metasploit Framework</title>
		<link>http://vietwow.wordpress.com/2008/07/30/installing-and-updating-metasploit-framework/</link>
		<comments>http://vietwow.wordpress.com/2008/07/30/installing-and-updating-metasploit-framework/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 03:20:26 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[exploit]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=39</guid>
		<description><![CDATA[1. download and untar metasploit framework $ wget http://metasploit.com/tools/framework-x.x.tar.gz $ tar xvzf framework-x.x.tar.gz $ cd framework* 2. install ruby # yum -y install ruby 3. install subversion-perl # yum -y install subversion-perl 4. $svn update Done !<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=39&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>1. download and untar metasploit framework<br />
<span style="font-style:italic;"> $ wget http://metasploit.com/tools/framework-x.x.tar.gz</span><br />
<span style="font-style:italic;"> $ tar xvzf framework-x.x.tar.gz</span><br />
<span style="font-style:italic;"> $ cd framework*</span></p>
<p>2. install ruby<br />
<span style="font-style:italic;"> # yum -y install ruby</span></p>
<p>3. install subversion-perl<br />
<span style="font-style:italic;"># yum -y install subversion-perl</span></p>
<p>4. <span style="font-style:italic;">$svn update</span></p>
<p>Done !</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=39&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/30/installing-and-updating-metasploit-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>How to install MYTOP</title>
		<link>http://vietwow.wordpress.com/2008/07/26/how-to-install-mytop/</link>
		<comments>http://vietwow.wordpress.com/2008/07/26/how-to-install-mytop/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 16:50:13 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[MySQL]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=37</guid>
		<description><![CDATA[Description: &#8220;mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x&#8221; ( http://jeremy.zawodny.com/mysql/mytop/ ) Note: Is necessary to install 2 perl modules to ensure that mytop will work. 1. Installing TermReadKey On some folder (eg. /root/dwl): # wget http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz # tar -zxf TermReadKey-2.30.tar.gz # cd TermRead* # [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=37&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Description:</strong> &#8220;mytop is a console-based (non-gui) tool for monitoring the threads and overall performance of a MySQL 3.22.x, 3.23.x&#8221; ( <a href="http://jeremy.zawodny.com/mysql/mytop/">http://jeremy.zawodny.com/mysql/mytop/</a> )</p>
<p>Note: Is necessary to install 2 perl modules to ensure that mytop will work.</p>
<p><strong>1. Installing TermReadKey</strong><br />
On some folder (eg. /root/dwl):<br />
<em><span style="color:#000099;"># wget </span></em><a href="http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz"><em><span style="color:#000099;">http://search.cpan.org/CPAN/authors/id/J/JS/JSTOWE/TermReadKey-2.30.tar.gz</span></em></a><br />
<em><span style="color:#000099;"># tar -zxf TermReadKey-2.30.tar.gz </span></em><br />
<em><span style="color:#000099;"># cd TermRead* </span></em><br />
<em><span style="color:#000099;"># perl Makefile.PL </span></em><br />
<em><span style="color:#000099;"># make test </span></em><br />
<em><span style="color:#000099;"># make </span></em><br />
<em><span style="color:#000099;"># make install</span></em></p>
<p><strong>2. Installing DBI</strong><br />
On some folder (eg. /root/dwl):<br />
<em><span style="color:#000099;"># wget </span></em><a href="http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz"><em><span style="color:#000099;">http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.48.tar.gz</span></em></a><br />
<em><span style="color:#000099;"># tar -zxf DBI-1.48.tar.gz </span></em><br />
<em><span style="color:#000099;"># cd DBI* </span></em><br />
<em><span style="color:#000099;"># perl Makefile.PL </span></em><br />
<em><span style="color:#000099;"># make test </span></em><br />
<em><span style="color:#000099;"># make </span></em><br />
<em><span style="color:#000099;"># make install</span></em></p>
<p><strong>3. Installing mytop:<br />
</strong>On some folder (eg. /root/dwl):<br />
<em><span style="color:#000099;"># wget </span></em><a href="http://jeremy.zawodny.com/mysql/mytop/mytop-1.4.tar.gz"><em><span style="color:#000099;">http://jeremy.zawodny.com/mysql/mytop/mytop-1.4.tar.gz</span></em></a><em><span style="color:#000099;"> </span></em><br />
<em><span style="color:#000099;"># tar -zxf mytop-1.4.tar.gz </span></em><br />
<em><span style="color:#000099;"># cd mytop*</span></em><br />
<em><span style="color:#000099;"># perl Makefile.PL </span></em><br />
<em><span style="color:#000099;"># make test </span></em><br />
<em><span style="color:#000099;"># make </span></em><br />
<em><span style="color:#000099;"># make install</span></em></p>
<p>Done!</p>
<p><strong>Run</strong> : mytop -u root -p password -d database_name</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/37/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/37/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/37/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/37/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/37/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=37&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/26/how-to-install-mytop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>Variables in Linux</title>
		<link>http://vietwow.wordpress.com/2008/07/26/variables-in-linux/</link>
		<comments>http://vietwow.wordpress.com/2008/07/26/variables-in-linux/#comments</comments>
		<pubDate>Sat, 26 Jul 2008 02:58:26 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[variables]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=29</guid>
		<description><![CDATA[The env, set, and printenv commands display all environment variables and their values. env and set are also used to set environment variables and are often incorporated directly into the shell set : hiển thị cả environment variables &#38; shell variables (các giá grị này được khởi tạo ban đầu bởi file /etc/bashrc) env/printenv : [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=29&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <span style="color:#ff0000;">env</span>, <span style="color:#ff0000;">set</span>, and <span style="color:#ff0000;">printenv</span> commands display all environment variables and their values. env and set are also used to set environment variables and are often incorporated directly into the shell</p>
<p><span style="color:#0000ff;">set</span> : hiển thị cả environment variables &amp; shell variables (các giá grị này được khởi tạo ban đầu bởi file /etc/bashrc)</p>
<p><span style="color:#0000ff;">env/printenv</span> : chỉ hiển thị  environment variables (các giá grị này được khởi tạo ban đầu bởi file /etc/profile)</p>
<p><strong><span style="color:#993366;"><br />
</span></strong></p>
<p>Shell Variable (lệnh set bao gồm shell &amp; environment variables) : Variable trong một shell chỉ có giá trị trong shell đó. Khi exit khỏi shell này, variables bị hủy.</p>
<p>Environment Variable (lệnh printenv, env, export trong bash hoặc setenv trong csh) : Variable trong environment có giá trị trong <span style="color:red;">mọi</span> shell thuộc về account đó. Tạo shell nào ra (với cùng account và cùng environment variables) cũng mang các variables ấn định sẵn như nhau.</p>
<p>Hiểu tổng quan thì environment variable là permanent còn shell variable chỉ có giá trị tức thời trong shell đó</p>
<p>let : Perform arithmetic on shell variables</p>
<p>In Linux (Shell), there are two types of variable:<br />
(1) <strong>System variables</strong> &#8211; Created and maintained by Linux itself. This type of variable defined in CAPITAL LETTERS.<br />
(2) <strong>User defined variables (UDV)</strong> &#8211; Created and maintained by user. This type of variable defined in lower letters.</p>
<p>You can see system variables by giving command like <strong>$ set</strong>, some of the important System variables are:</p>
<table border="1" cellspacing="1" cellpadding="1" width="99%">
<tbody>
<tr>
<td bgcolor="#cccccc">
<div><strong>System Variable </strong></div>
</td>
<td bgcolor="#cccccc">
<div><strong>Meaning </strong></div>
</td>
</tr>
<tr valign="top">
<td height="17">BASH=/bin/bash</td>
<td height="17">Our shell name</td>
</tr>
<tr valign="top">
<td>BASH_VERSION=1.14.7(1)</td>
<td>Our shell version name</td>
</tr>
<tr valign="top">
<td>COLUMNS=80</td>
<td>No. of columns for our screen</td>
</tr>
<tr valign="top">
<td>HOME=/home/vivek</td>
<td>Our home directory</td>
</tr>
<tr valign="top">
<td height="2">LINES=25</td>
<td height="2">No. of columns for our screen</td>
</tr>
<tr valign="top">
<td height="2">LOGNAME=students</td>
<td height="2">students Our logging name</td>
</tr>
<tr valign="top">
<td height="2">OSTYPE=Linux</td>
<td height="2">Our Os type</td>
</tr>
<tr valign="top">
<td height="2">PATH=/usr/bin:/sbin:/bin:/usr/sbin</td>
<td height="2">Our path settings</td>
</tr>
<tr valign="top">
<td height="2">PS1=[\u@\h \W]\$</td>
<td height="2">Our prompt settings</td>
</tr>
<tr valign="top">
<td height="2">PWD=/home/students/Common</td>
<td height="2">Our current working directory</td>
</tr>
<tr valign="top">
<td height="2">SHELL=/bin/bash</td>
<td height="2">Our shell name</td>
</tr>
<tr valign="top">
<td height="2">USERNAME=vivek</td>
<td height="2">User name who is currently login to this PC</td>
</tr>
</tbody>
</table>
<p><strong><span style="color:#993366;">*note</span></strong> : /etc/profile là global file để set value của các environment variables &amp; set các startup program. Còn /etc/bashrc là global file để set default permission, permanent aliases và permanent functions</p>
<p><strong><span style="color:#008000;">Statup script for Login shell</span> :</strong></p>
<p>+ /etc/profile : global file chứa các environment variable và các startup program (affect for all user)</p>
<p>+ /etc/bashrc : global file chứa các default permission, permanent alias và các permanent function (affect for all user)</p>
<p>+ /etc/profile.d</p>
<p>+ ~/.bash_profile (affect for specific user)</p>
<p>+ ~/.bashrc (affect for specific user)</p>
<p><strong><span style="color:#008000;">Statup script for Non-Login shell</span> :</strong></p>
<p>+ ~/.bashrc</p>
<p>+ /etc/bashrc</p>
<p>+ /etc/profile.d</p>
<p>+ ~/.bash_logout (affect for specific user)</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=29&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/26/variables-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>Note about ps</title>
		<link>http://vietwow.wordpress.com/2008/07/13/note-about-ps/</link>
		<comments>http://vietwow.wordpress.com/2008/07/13/note-about-ps/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 17:26:08 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Monitoring]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=27</guid>
		<description><![CDATA[Trong lệnh ps thì -e là show dạng standard syntax, còn a là dạng BSD syntax vd : ps -e =&#62; Standard syntax       ps ax =&#62; BSD syntax ps -ejH &#38; ps axjf: show process theo tree ps ax : chỉ show process và id, ko có memory usage và các info khác ps aux [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=27&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Trong lệnh ps thì -e là show dạng standard syntax, còn a là dạng BSD syntax</p>
<p>vd : ps -e =&gt; Standard syntax</p>
<p>      ps ax =&gt; BSD syntax</p>
<p><strong></strong></p>
<p><strong>ps -ejH</strong> &amp; <strong>ps axjf</strong>: show process theo tree</p>
<p><strong>ps ax</strong> : chỉ show process và id, ko có memory usage và các info khác</p>
<p><strong>ps aux</strong> : show process cùng với memory usage, cột thứ 6 chính là total memory mà process đó đả sử dụng(dạng KB)</p>
<p><strong>ps axuf</strong> : vừa xem process dạng tree và show luôn memory usage của process đó</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=27&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/13/note-about-ps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>TLB &#8211; HugePage &#8230;</title>
		<link>http://vietwow.wordpress.com/2008/07/12/tlb-hugepage/</link>
		<comments>http://vietwow.wordpress.com/2008/07/12/tlb-hugepage/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 07:58:05 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=25</guid>
		<description><![CDATA[Translation lookaside buffer (TLB) là CPU cache để cache  các virtual-to-physical memory address translation, TLB được sử dụng bởi memory management TLB là 1 table gồm chứa các các entry (mỗi entry là Page Table, map từ virtual address sang physical adress ). Nó còn gọi là content-addressable memory (CAM), nếu 1 requested address có trong [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=25&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Translation lookaside buffer</strong> (<strong>TLB</strong>) là CPU cache để cache  các virtual-to-physical memory address translation, TLB được sử dụng bởi memory management</p>
<p>TLB là 1 table gồm chứa các các entry (mỗi entry là Page Table, map từ virtual address sang physical adress ). Nó còn gọi là content-addressable memory (CAM), nếu 1 requested address có trong bảng TLB thì nó sẽ lấy ra xài cò nếu ko có thì translation sẽ diễn ra (bằng cách sử dụng Page Table) nhưng việc translation này sẽ chậm hơn</p>
<p>TLB nằm giữa CPU và CPU cache hoặc nằm giữa CPU cache và primary storage memory, việc này phục thuộc cache sử dụng physical hay virtual address. Nếu cache sử dụng virtual memory, request được send trực tiếp từ CPU đến cache (cache sẽ sử dụng TLB nếu cần). Nếu cache sử dụng physical memory, cứ mỗi khi có memory operation thì CPU sẽ lookup TLB và kết quả là physical adress sẽ được send đến cache</p>
<p>1 cách optimize phổ biến trong việc cache physical address là thực hiện song song TLB lookup với cache access</p>
<p>===============</p>
<p><strong>Huge Page</strong> (hay còn gọi là <span class="parahead1">bigpages</span>) là 1 feature trong Linux kernel cho phép memory được manage với những larger page (default thì 1 page chỉ có 4 KB, Default Huge Page là 2MB) 2MB &#8211; 4MB. Huge Page được sử dụng cả trong hệ thống 32-bit và 64-bit, việc sử dụng Huge Page ko phụ thuộc vào 32-bit hay 64-bit mà phục thuộc vào lượng memory trong system vì <strong><span style="color:#ff0000;">Huge Page chỉ đặc biệt hiệu quả trong system với lượng memory lớn</span></strong> (do lượng memory lớn thì phải đi kèm với 64-bit =&gt; huge page thường được sử dụng trong 64-bit system), còn trong hệ thống với memory ít thì nó lại phản tác dụng. Do 1 khi đã sử dụng, các Huge Page là những phần physical memory liên tiếp nhau và sẽ ko bao giời được swap out =&gt; dẫn đến việc memory swapping ko hiệu quả</p>
<p>Trong Linux Kernel 2.6, support thêm 1 feature mới là Huge TLB Page, thay thế cho chức năng Huge Page ở trên. Huge TLB cũng giống như Huge Page nhưng nó khác 1 ít trong cơ chế họat động. Vì số lượng entry trong TLB thì rất limited và 1 TLB miss thì rất hao tốn. Do đó, với Huge TLB Page support, mỗi 1 large TLB entry riêng có thể map 1 page nặng 2MB &#8211; 4MB, dẫn đến việc giảm số lượng các TLB miss và gia tăng performance. <strong><span style="color:#0000ff;">Chức năng Huge Page này rất quan trọng trong các system có hàng GB RAM trở lên và trong các Database System</span></strong></p>
<p>Các Huge Page được reserve bên trong kernel và được map bởi các large TLB entry, đây là chức năng rất cần thiết trong các database application lớn. User application có thể sử dụng Huge Page thông qua <span class="docEmphasis">mmap</span> system calls hoặc shared memory system calls</p>
<p>Các Huge Page trong Huge TLB Page phải được cấp phát trước (preallocated) bởi super user</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=25&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/12/tlb-hugepage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>How to build rpm package from source file (*.src.rpm) ?</title>
		<link>http://vietwow.wordpress.com/2008/07/10/how-to-build-rpm-package-from-source-file-srcrpm/</link>
		<comments>http://vietwow.wordpress.com/2008/07/10/how-to-build-rpm-package-from-source-file-srcrpm/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 12:30:43 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=24</guid>
		<description><![CDATA[How to build rpm package from source file (*.src.rpm) ? # rpmbuild &#8211;rebuild *.src.rpm Most probably, you&#8217;ll find the sources in /root/rpmbuild/SOURCES and the RPM file in /root/rpmbuild/RPMS . If not, try /usr/src/redhat/SOURCES and /usr/src/redhat/RPMS Nguồn : http://rshagrawal.blogspot.com/2007/12/how-to-build-rpm-package-from-source.html<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=24&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How to build rpm package from source file (*.src.rpm) ?</p>
<p># rpmbuild &#8211;rebuild *.src.rpm</p>
<p>Most probably, you&#8217;ll find the sources in /root/rpmbuild/SOURCES and the RPM file in /root/rpmbuild/RPMS . If not, try /usr/src/redhat/SOURCES and /usr/src/redhat/RPMS</p>
<p><strong><span style="color:#0000ff;">Nguồn</span></strong> : <a href="http://rshagrawal.blogspot.com/2007/12/how-to-build-rpm-package-from-source.html">http://rshagrawal.blogspot.com/2007/12/how-to-build-rpm-package-from-source.html</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=24&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/10/how-to-build-rpm-package-from-source-file-srcrpm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>Hardening the TCP/IP stack to SYN attacks</title>
		<link>http://vietwow.wordpress.com/2008/07/10/hardening-the-tcpip-stack-to-syn-attacks/</link>
		<comments>http://vietwow.wordpress.com/2008/07/10/hardening-the-tcpip-stack-to-syn-attacks/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 12:22:52 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[security]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=23</guid>
		<description><![CDATA[Hardening the TCP/IP stack to SYN attacks Mariusz Burdach 2003-09-10   Most people know how problematic protection against SYN denial of service attacks can be. Several methods, more or less effective, are usually used. In almost every case proper filtering of packets is a viable solution. In addition to creating packet filters, the modification of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=23&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span class="headline">Hardening the TCP/IP stack to SYN attacks</span><br />
<span class="author"><a href="mailto:M_Burdach@compfort.pl"><span style="color:#de7008;">Mariusz Burdach</span></a></span> <span class="date">2003-09-10</span></p>
<p class="firstParagraph"> </p>
<p><span class="body"></p>
<table border="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td class="text">Most people know how problematic protection against SYN denial of service attacks can be. Several methods, more or less effective, are usually used. In almost every case proper filtering of packets is a viable solution. In addition to creating packet filters, the modification of the TCP/IP stack of a given operating system can be performed by an administrator. This method, the tuning of the TCP/IP stack in various operating systems, will be described in depth in this article.</p>
<p class="text">While SYN attacks may not be entirely preventable, tuning the TCP/IP stack will help reduce the impact of SYN attacks while still allowing legitimate client traffic through. It should be noted that some SYN attacks do not always attempt to upset servers, but instead try to consume all of the bandwidth of your Internet connection. This kind of flood is outside the scope of scope of this article, as is the filtering of packets which has been discussed elsewhere.</p>
<p class="text">What can an administrator do when his servers are under a classic, non-bandwidth flooding SYN attack? One of most important steps is to enable the operating system&#8217;s built-in protection mechanisms like SYN cookies or <code><span style="color:#999999;">SynAttackProtect</span></code>. Additionally, in some cases it is worth tuning parameters of the TCP/IP stack. Changing the default values of stack variables can be another layer of protection and help better secure your hosts. In this paper I will concentrate on:</p>
<p class="text"> </p>
<ul>
<li>Increasing the queue of half-open connections (in the SYN RECEIVED state).</li>
<li>Decreasing the time period of keeping a pending connection in the SYN RECEIVED state in the queue. This method is accomplished by decreasing the time of the first packet retransmission and by either decreasing the number of packet retransmissions or by turning off packet retransmissions entirely. The process of packet retransmissions is performed by a server when it doesn&#8217;t receive an ACK packet from a client. A Packet with the ACK flag finalizes the process of the three-way handshake.</li>
</ul>
<p class="text">Note that an attacker can simply send more packets with the SYN flag set and then the above tasks will not solve the problem. However, we can still increase the likelihood of creating a full connection with legitimate clients by performing the above operations.</p>
<p class="text">We should remember that our modification of variables will change the behavior of the TCP/IP stack. In some cases the values can be too strict. So, after the modification we have to make sure that our server can properly communicate with other hosts. For example, the disabling of packet retransmissions in some environments with low bandwidth can cause a legitimate request to fail. In this article you will find a description of the TCP/IP variables for the fallowing operating systems: Microsoft Windows 2000, RedHat Linux 7.3, Sun Solaris 8 and HP-UX 11.00. These variables are similar or the same in current releases.</p>
<h2>Definitions: SYN flooding and SYN spoofing</h2>
<p>A SYN flood is a type of Denial of Service attack. We can say that a victim host is under a SYN flooding attack when an attacker tries to create a huge amount of connections in the SYN RECEIVED state until the backlog queue has overflowed. The SYN RECEIVED state is created when the victim host receives a connection request (a packet with SYN flag set) and allocates for it some memory resources. A SYN flood attack creates so many half-open connections that the system becomes overwhelmed and cannot handle incoming requests any more.</p>
<p class="text">To increase an effectiveness of a SYN flood attack, an attacker spoofs source IP addresses of SYN packets. In this case the victim host cannot finish the initialization process in a short time because the source IP address can be unreachable. This malicious operation is called a SYN spoofing attack.</p>
<p class="text">We need to know that the process of creating a full connection takes some time. Initially, after receiving a connection request (a packet with SYN flag set), a victim host puts this half-open connection to the backlog queue and sends out the first response (a packet with SYN and ACK flags set). When the victim does not receive a response from a remote host, it tries to retransmit this SYN+ACK packet until it times out, and then finally removes this half-open connection from the backlog queue. In some operating systems this process for a single SYN request can take about 3 minutes! In this document you will learn how to change this behavior. The other important information you need to know is that the operating system can handle only a defined amount of half-open connections in the backlog queue. This amount is controlled by the size of the backlog queue. For instance, the default backlog size is 256 for RedHat 7.3 and 100 for Windows 2000 Professional. When this size is reached, the system will no longer accept incoming connection requests.</p>
<h2>How to detect a SYN attack</h2>
<p>It is very simple to detect SYN attacks. The netstat command shows us how many connections are currently in the half-open state. The half-open state is described as SYN_RECEIVED in Windows and as SYN_RECV in Unix systems.</p>
<p class="text"> </p>
<pre># netstat -n -p TCP

tcp        0      0 10.100.0.200:21            237.177.154.8:25882     SYN_RECV    -
tcp        0      0 10.100.0.200:21            236.15.133.204:2577     SYN_RECV    -
tcp        0      0 10.100.0.200:21            127.160.6.129:51748     SYN_RECV    -
tcp        0      0 10.100.0.200:21            230.220.13.25:47393     SYN_RECV    -
tcp        0      0 10.100.0.200:21            227.200.204.182:60427   SYN_RECV    -
tcp        0      0 10.100.0.200:21            232.115.18.38:278       SYN_RECV    -
tcp        0      0 10.100.0.200:21            229.116.95.96:5122      SYN_RECV    -
tcp        0      0 10.100.0.200:21            236.219.139.207:49162   SYN_RECV    -
tcp        0      0 10.100.0.200:21            238.100.72.228:37899    SYN_RECV    -
...</pre>
<p class="text">We can also count how many half-open connections are in the backlog queue at the moment. In the example below, 769 connections (for TELNET) in the SYN RECEIVED state are kept in the backlog queue.</p>
<p class="text"> </p>
<pre># netstat -n -p TCP | grep SYN_RECV | grep :23 | wc -l
769</pre>
<p class="text">The other method for detecting SYN attacks is to print TCP statistics and look at the TCP parameters which count dropped connection requests. While under attack, the values of these parameters grow rapidly.</p>
<p class="text">In this example we watch the value of the <code><span style="color:#999999;">TcpHalfOpenDrop</span></code> parameter on a Sun Solaris machine.</p>
<p class="text"> </p>
<pre># netstat -s -P tcp | grep tcpHalfOpenDrop
       tcpHalfOpenDrop     =   473</pre>
<p class="text">It is important to note that every TCP port has its own backlog queue, but only one variable of the TCP/IP stack controls the size of backlog queues for all ports.</p>
<h2>The backlog queue</h2>
<p>The backlog queue is a large memory structure used to handle incoming packets with the SYN flag set until the moment the three-way handshake process is completed. An operating system allocates part of the system memory for every incoming connection. We know that every TCP port can handle a defined number of incoming requests. The backlog queue controls how many half-open connections can be handled by the operating system at the same time. When a maximum number of incoming connections is reached, subsequent requests are silently dropped by the operating system.</p>
<p class="text">As mentioned before, when we detect a lot of connections in the SYN RECEIVED state, host is probably under a SYN flooding attack. Moreover, the source IP addresses of these incoming packets can be spoofed. To limit the effects of SYN attacks we should enable some built-in protection mechanisms. Additionally, we can sometimes use techniques such as increasing the backlog queue size and minimizing the total time where a pending connection in kept in allocated memory (in the backlog queue).</p>
<h2>Built-in protection mechanisms</h2>
<p class="text"><strong>Operating system: Windows 2000</strong></p>
<p class="text">The most important parameter in Windows 2000 and also in Windows Server 2003 is <code><span style="color:#999999;">SynAttackProtect</span></code>. Enabling this parameter allows the operating system to handle incoming connections more efficiently. The protection can be set by adding a <code><span style="color:#999999;">SynAttackProtect</span></code> DWORD value to the following registry key:</p>
<p class="text"> </p>
<pre>HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</pre>
<p class="text">In general, when a SYN attack is detected the <code><span style="color:#999999;">SynAttackProtect</span></code> parameter changes the behavior of the TCP/IP stack. This allows the operating system to handle more SYN requests. It works by disabling some socket options, adding additional delays to connection indications and changing the timeout for connection requests.</p>
<p class="text">When the value of <code><span style="color:#999999;">SynAttackProtect</span></code> is set to 1, the number of retransmissions is reduced and according to the vendor, the creation of a route cache entry is delayed until a connection is made. The recommended value of <code><span style="color:#999999;">SynAttackProtect</span></code> is 2, which additionally delays the indication of a connection to the Windows Socket until the three-way handshake is completed. During an attack, better performance in handling connections is achieved by disabling the use of a few parameters (these parameters are usually used by the system during the process of creating new connections). The <code><span style="color:#999999;">TCPInitialRTT</span></code> parameter, which defines the time of the first retransmission, will no longer work. It&#8217;s impossible to negotiate the window size value. Also, the scalable windows option is disabled on any socket.</p>
<p class="text">As we can see, by enabling the <code><span style="color:#999999;">SynAttackProtect</span></code> parameter we don&#8217;t change the TCP/IP stack behavior until under a SYN attack. But even then, when <code><span style="color:#999999;">SynAttackProtect</span></code> starts to operate, the operating system can handle legitimate incoming connections.</p>
<p class="text">The operating system enables protection against SYN attacks automatically when it detects that values of the following three parameters are exceeded. These parameters are <code><span style="color:#999999;">TcpMaxHalfOpen</span></code>, <code><span style="color:#999999;">TcpMaxHalfOpenRetried</span></code> and <code><span style="color:#999999;">TcpMaxPortsExhausted</span></code>.</p>
<p class="text">To change the values of these parameters, first we have to add them to the same registry key as we made for <code><span style="color:#999999;">SynAttackProtect</span></code>.</p>
<p class="text">The <code><span style="color:#999999;">TcpMaxHalfOpen</span></code> registry entry defines the maximum number of SYN RECEIVED states which can be handled concurrently before SYN protection starts working. The recommended value of this parameter is 100 for Windows 2000 Server and 500 for Windows 2000 Advanced Server.</p>
<p class="text"><code><span style="color:#999999;">TcpMaxHalfOpenRetried</span></code> defines the maximum number of half-open connections, for which the operating system has performed at least one retransmission, before SYN protection begins to operate. The recommended value is 80 for Windows 2000 Server, and 400 for Advanced Server.</p>
<p class="text">The <code><span style="color:#999999;">TcpMaxPortsExhausted</span></code> registry entry defines the number of dropped SYN requests, after which the protection against SYN attacks starts to operate. Recommended value is 5.</p>
<p class="text"><strong>Operating system: Linux RedHat</strong></p>
<p class="text">RedHat, like other Linux operating systems, has implemented a SYN cookies mechanism which can be enabled in the following way:</p>
<p class="text"> </p>
<pre># echo 1 &gt; /proc/sys/net/ipv4/tcp_syncookies</pre>
<p class="text">Note that to make this change permanent we need to create a startup file that sets this variable. We must do the same operation for other UNIX variables described in this paper because the values for these variables will return to default upon system reboot.</p>
<p class="text">SYN cookies protection is especially useful when the system is under a SYN flood attack and source IP addresses of SYN packets are also forged (a SYN spoofing attack). This mechanism allows construction of a packet with the SYN and ACK flags set and which has a specially crafted initial sequence number (ISN), called a cookie. The value of the cookie is not a pseudo-random number generated by the system but instead is the result of a hash function. This hash result is generated from information like: source IP, source port, destination IP, destination port plus some secret values. During a SYN attack the system generates a response by sending back a packet with a cookie, instead of rejecting the connection when the SYN queue is full. When a server receives a packet with the ACK flag set (the last stage of the three-way handshake process) then it verifies the cookie. When its value is correct, it creates the connection, even though there is no corresponding entry in the SYN queue. Then we know that it is a legitimate connection and that the source IP address was not spoofed. It is important to note that the SYN cookie mechanism works by not using the backlog queue at all, so we don&#8217;t need to change the backlog queue size. More information about SYN cookies can be found at <a href="http://cr.yp.to/syncookies.html" target="_blank"><span style="color:#de7008;">http://cr.yp.to/syncookies.html</span></a>.</p>
<p class="text">Also note that the SYN cookies mechanism works only when the CONFIG_SYNCOOKIES option is set during kernel compilation.</p>
<p class="text">The next section will describe other useful methods of protection against SYN attacks. I would like to emphasize that under heavy SYN attacks (like Distributed SYN flooding attack) these methods may help but still not solve the problem.</p>
<h2>Increasing the backlog queue</h2>
<p>Under a SYN attack, we can modify the backlog queue to support more connections in the half-open state without denying access to legitimate clients. In some operating systems, the value of the backlog queue is very low and vendors often recommend increasing the SYN queue when a system is under attack.</p>
<p class="text">Increasing the backlog queue size requires that a system reserve additional memory resources for incoming requests. If a system has not enough memory for this operation, it will have an impact on system performance. We should also make sure that network applications like Apache or IIS can accept more connections.</p>
<p class="text"><strong>Operating system: Windows 2000</strong></p>
<p class="text">Aside from described above <code><span style="color:#999999;">TcpMaxHalfOpen</span></code> and <code><span style="color:#999999;">TcpMaxHalfOpenRetried</span></code> variables, in Windows 2000 the number of connections handled in the half-open state can be set through a dynamic backlog. Configuration of this dynamic backlog is accomplished via the AFD.SYS driver. This kernel-mode driver is used to support Windows Socket applications like FTP and Telnet. To increase the number of half-open connections, AFD.SYS provides four registry entries. All of these values, corresponding to AFD.SYS, are located under the following registry key:</p>
<p class="text"> </p>
<pre>HKLM\System\CurrentControlSet\Services\AFD\Parameters</pre>
<p class="text">The <code><span style="color:#999999;">EnableDynamicBacklog</span></code> registry value is a global switch to enable or disable a dynamic backlog. Setting it to 1 enables the dynamic backlog queue.</p>
<p class="text"><code><span style="color:#999999;">MinimumDynamicBacklog</span></code> controls the minimum number of free connections allowed on a single TCP port. If the number of free connections drops below this value, then additional free connections are created automatically. Recommended value is 20.</p>
<p class="text">The <code><span style="color:#999999;">MaximumDynamicBacklog</span></code> registry value defines the sum of active half-open connections and the maximum number of free connections. When this value is exceeded, no more free connections will be created by a system. Microsoft suggests that this value should not exceed 20000.</p>
<p class="text">The last <code><span style="color:#999999;">DynamicBacklogGrowthDelta</span></code> parameter controls the number of free connections to be created when additional connections are necessary. Recommended value: 10.</p>
<p class="text">The table below shows the recommended values for the AFD.SYS driver:</p>
<p class="text"> </p>
<table border="1" cellspacing="0" cellpadding="10">
<tbody>
<tr align="center">
<td><strong>Subkey Registry Value Entry</strong></td>
<td><strong>Format</strong></td>
<td><strong>Value</strong></td>
</tr>
<tr align="center">
<td>EnableDynamicBacklog</td>
<td>DWORD</td>
<td>1</td>
</tr>
<tr align="center">
<td>MinimumDynamicBacklog</td>
<td>DWORD</td>
<td>20</td>
</tr>
<tr align="center">
<td>MaximumDynamicBacklog</td>
<td>DWORD</td>
<td>20000</td>
</tr>
<tr align="center">
<td>DynamicBacklogGrowthDelta</td>
<td>DWORD</td>
<td>10</td>
</tr>
</tbody>
</table>
<p class="text"><strong>Operating system: Linux</strong></p>
<p class="text">A <code><span style="color:#999999;">tcp_max_syn_backlog</span></code> variable defines how many half-open connections can be kept by the backlog queue. For instance 256 is a total number of half-open connections handled in memory by Linux RedHat 7.3. The TCP/IP stack variables can be configured by <code><span style="color:#999999;">sysctl</span></code> or standard Unix commands. The following example shows how to change the default size of the backlog queue by the <code><span style="color:#999999;">sysctl</span></code> command:</p>
<p class="text"> </p>
<pre># sysctl -w net.ipv4.tcp_max_syn_backlog="2048"</pre>
<p class="text"><strong>Operating system: Sun Solaris</strong></p>
<p class="text">In Sun Solaris there are two parameters which control the maximum number of connections. The first parameter controls the total number of full connections. The second <code><span style="color:#999999;">tcp_conn_req_max_q0</span></code> parameter defines how many half-open connections are allowed without the dropping of incoming requests. In Sun Solaris 8, the default value is set to 1024. Using the <code><span style="color:#999999;">ndd</span></code> command we can modify this value.</p>
<p class="text"> </p>
<pre># ndd -set /dev/tcp tcp_conn_req_max_q0 2048</pre>
<p class="text"><strong>Operating system: HP-UX</strong></p>
<p class="text">In HP-UX, a <code><span style="color:#999999;">tcp_syn_rcvd_max</span></code> TCP/IP stack variable is responsible for control of the maximum number of half-open connections in the SYN RECEIVE state. In HP-UX 11.00 this value is set to 500. We can change this value by using the <code><span style="color:#999999;">ndd</span></code> command, similar to the one used in a Sun Solaris system.</p>
<p class="text"> </p>
<pre># ndd -set /dev/tcp tcp_syn_rcvd_max 2048</pre>
<p class="text"> </p>
<h2>Decreasing total time of handling connection request</h2>
<p>As we know, SYN flooding/spoofing attacks are simply a series of SYN packets, mostly from forged IP addresses. In the last section we tried to increase the backlog queue. Now that our systems can handle more SYN requests, we should decrease the total time we keep half-open connections in the backlog queue. When a server receives a request, it immediately sends a response with the SYN and ACK flags set, puts this half-open connection into the backlog queue, and then waits for a packet with the ACK flag set from the client. When no response is received from the client, the server retransmits a response packet (with the SYN and ACK flags set) several times (depending on default value in each operating system) by giving the client a chance to send the ACK packet again. It is clear that when the source IP address of client was spoofed, the ACK packet will never arrive. After a few minutes the server removes this half-open connection. We can speed up this time of removing connections in the SYN RECEIVED state from the backlog queue by changing time of first retransmission and by changing the total number of retransmissions.</p>
<p class="text">Another technique of protection against SYN attacks is switching off some TCP parameters that are always negotiated during the three-way handshake process. Some of these parameters are automatically turned off by mechanisms described in the first section (<code><span style="color:#999999;">SynAttackProtect</span></code> and Syncookies).</p>
<p class="text">Now, I will describe TCP/IP stack variables which allow a decrease in the time half-open connections are kept in the backlog queue.</p>
<p class="text"><strong>Operating system: Windows 2000</strong></p>
<p class="text">In Windows 2000, the default time for a first retransmission is set to 3 seconds (3000 milliseconds) and can be changed by modifying the value of the TcpInitialRtt registry entry (for every interface). For example, to decrease time of a first retransmission to 2 seconds we have to set this registry value to 2000 milliseconds in decimal format. The number of retransmissions (packets with the SYN and ACK flags set) is controlled by a <code><span style="color:#999999;">TcpMaxConnectResponseRetransmissions</span></code> registry parameter which has to be added to <code><span style="color:#999999;">HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters</span></code> registry key.</p>
<p class="text">The table below contains a few examples of values and corresponding times for keeping half-open connections in the backlog queue (the time of a first retransmission is set to 3 seconds).</p>
<p class="text"> </p>
<table border="1" cellspacing="0" cellpadding="10">
<tbody>
<tr align="center">
<td><strong>Value</strong></td>
<td><strong>Time of retransmission</strong></td>
<td><strong>Total time to keep half-open connections in the backlog queue</strong></td>
</tr>
<tr align="center">
<td>1</td>
<td>in 3rd second</td>
<td>9 seconds</td>
</tr>
<tr align="center">
<td>2</td>
<td>in 3rd and 9th second</td>
<td>21 seconds</td>
</tr>
<tr align="center">
<td>3</td>
<td>in 3rd , 9th and 21st second</td>
<td>45 seconds</td>
</tr>
</tbody>
</table>
<p class="text">We can set this registry value to 0, whereby Windows doesn&#8217;t try to retransmit packets at all. In this case, the system sends only one response and cancels the half-open connection after 3 seconds. This setting is ignored when its value is equal or greater than 2 and when <code><span style="color:#999999;">SynAttackProtect</span></code> is enabled.</p>
<p class="text"><strong>Operating system: Linux RedHat</strong></p>
<p class="text">A <code><span style="color:#999999;">tcp_synack_retries</span></code> variable is responsible for controlling the number of retransmissions in Linux operating system. Its default value is set to 5 for most Linux operating systems, which causes the half-open connection to be removed after 3 minutes. In the below table there are calculations for other values.</p>
<p class="text"> </p>
<table border="1" cellspacing="0" cellpadding="10">
<tbody>
<tr align="center">
<td><strong>Value</strong></td>
<td><strong>Time of retransmission</strong></td>
<td><strong>Total time to keep half-open connections in the backlog queue</strong></td>
</tr>
<tr align="center">
<td>1</td>
<td>in 3rd second</td>
<td>9 seconds</td>
</tr>
<tr align="center">
<td>2</td>
<td>in 3rd and 9th second</td>
<td>21 seconds</td>
</tr>
<tr align="center">
<td>3</td>
<td>in 3rd , 9th and 21st second</td>
<td>45 seconds</td>
</tr>
</tbody>
</table>
<p class="text"><strong>Operating system: Sun Solaris</strong></p>
<p class="text">In this operating system it is impossible to turn off retransmissions of packets directly using the ndd command. Moreover, in Sun Solaris there are parameters which are non-configurable by ndd and which control the number of retransmissions (at least 3) and total time of packet retransmissions (at least 3 minutes). More information about these parameters can be found in the <a href="http://www.sean.de/" target="_blank"><span style="color:#de7008;">&#8220;Solaris 2.x &#8211; Tuning Your TCP/IP stack and More&#8221;</span></a> document.</p>
<p class="text"><strong>Operating system: HP-UX</strong></p>
<p class="text">For HP-UX, the time spent handling half-open connections in the backlog queue is controlled by the <code><span style="color:#999999;">tcp_ip_abort_cinterval</span></code> parameter. By using the ndd command we can define how long a HP-UX operating system will be waiting for the ACK packet. We can control how many retransmissions will be performed indirectly by changing this value. Have a look at the table below.</p>
<p class="text"> </p>
<table border="1" cellspacing="0" cellpadding="10">
<tbody>
<tr align="center">
<td><strong>Value</strong></td>
<td><strong>Time of retransmission</strong></td>
<td><strong>Total time to keep half-open connections in the backlog queue</strong></td>
</tr>
<tr align="center">
<td>1000</td>
<td>-</td>
<td>1 second</td>
</tr>
<tr align="center">
<td>5000</td>
<td>in 2nd second</td>
<td>5 seconds</td>
</tr>
<tr align="center">
<td>10000</td>
<td>in 2nd and 5th second</td>
<td>10 seconds</td>
</tr>
<tr align="center">
<td>60000</td>
<td>In 2nd, 5th, 11th, 23rd and 47th second</td>
<td>1 minute</td>
</tr>
</tbody>
</table>
<p class="text">We can change the time of a first retransmission by modifying <code><span style="color:#999999;">tcp_rexmit_interval_initial</span></code>. Intervals of subsequent retransmissions are controlled by two parameters: <code><span style="color:#999999;">tcp_rexmit_interval</span></code> and <code><span style="color:#999999;">tcp_rexmit_interval_min</span></code>. These three variables are the same as in a Sun Solaris operating system.</p>
<h2>Summary</h2>
<p>The methods of hardening the TCP/IP stack that are presented in this article make servers more resistant to SYN flooding and SYN spoofing &#8211; Denial of Service attacks. A modification of your default TCP/IP stack settings is also recommended during the process of securing of the operating system.</p>
<p class="text"> </p>
<hr noshade="noshade" /><em>Mariusz Burdach is a computer security consultant who specializes in vulnerability assessment, intrusion detection and computer forensics. During the last few years he has worked as a consultant in the European Network Security Institute where he conducted penetration tests, vulnerability assessments and security audits for Internet banks, government and financial institutions in Poland. He is co-author of the Solaris Security Administrator&#8217;s Guide, a step-by-step guide to securing SUN&#8217;s Solaris operating system. Comments on this article are appreciated, send them to <a href="mailto:M_Burdach@compfort.pl"><span style="color:#de7008;">M_Burdach@compfort.pl</span></a>.</p>
<p><!-- OAS --></em></td>
</tr>
<p><!-- If you have relevant links, remove the comment tag below it --></p>
<tr>
<td class="rightcolumn" valign="top"><img src="http://www.securityfocus.com/images/pixel.gif" alt="" width="110" height="1" /></p>
<div class="rightcolumn"><span class="text"><strong>References</strong><br />
</span><span class="text"></p>
<p class="text"> </p>
<ul>
<li><a href="http://www.microsoft.com/technet/itsolutions/network/deploy/depovg/tcpip2k.asp" target="_blank"><span style="color:#de7008;">&#8220;Microsoft Windows 2000 TCP/IP Implementation Details&#8221;</span></a></li>
<li><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;Q315669&amp;sd=tech" target="_blank"><span style="color:#de7008;">&#8220;How To: Harden the TCP/IP Stack Against Denial of Service Attacks in Windows 2000&#8243;</span></a></li>
<li><a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;324270" target="_blank"><span style="color:#de7008;">&#8220;How To: Harden the TCP/IP Stack Against Denial of Service Attacks in Windows Server 20003&#8243;</span></a></li>
<li><a href="http://www.sun.com/solutions/blueprints/1299/network.pdf" target="_blank"><span style="color:#de7008;">&#8220;Solaris[tm] Operating Environment Network Settings for Security&#8221;</span></a></li>
<li><a onclick="return mugicPopWin(this,event);" oncontextmenu="mugicRightClick(this);" href="http://www.hp.com/products1/unix/operating/infolibrary/whitepapers/building_a_bastion_host.pdf" target="_blank"><span style="color:#de7008;">&#8220;Building a bastion host using hp-ux 11&#8243;</span></a></li>
<li><a href="http://www.sean.de/" target="_blank"><span style="color:#de7008;">&#8220;Solaris 2.x &#8211; Tuning Your TCP/IP Stack and More&#8221;</span></a></li>
<li><a href="http://cr.yp.to/syncookies.html" target="_blank"><span style="color:#de7008;">SYN cookies mechanism</span></a></li>
<li><a href="http://phrack.org/" target="_blank"><span style="color:#de7008;">Phrack Magazine 48 &#8220;Project Neptune&#8221;</span></a></li>
<li><a href="http://grc.com/r&amp;d/nomoredos.htm" target="_blank"><span style="color:#de7008;">&#8220;G.E.N.E.S.I.S&#8221;</span></a></li>
<li><a href="http://grc.com/dos/drdos.htm" target="_blank"><span style="color:#de7008;">&#8220;Distributed Reflection Denial of Service&#8221;</span></a></li>
</ul>
<p></span></div>
</td>
</tr>
</tbody>
</table>
<p></span>Source :: http://www.securityfocus.com/infocus/1729</p>
<p>=====================================================<br />
If you need any assistance, We can provide you for a small fee. please email us rshagrawal@gmail.com<br />
=====================================================</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=23&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/10/hardening-the-tcpip-stack-to-syn-attacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>

		<media:content url="http://www.securityfocus.com/images/pixel.gif" medium="image" />
	</item>
		<item>
		<title>hugepages</title>
		<link>http://vietwow.wordpress.com/2008/07/10/hugepages/</link>
		<comments>http://vietwow.wordpress.com/2008/07/10/hugepages/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 12:07:32 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=22</guid>
		<description><![CDATA[Hugepages is a mechanism that allows the Linux kernel to utilise the multiple page size capabilities of modern hardware architectures. Linux uses pages as the basic unit of memory, where physical memory is partitioned and accessed using the basic page unit. The default page size is 4096 Bytes in the x86 architecture. Hugepages allows large [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=22&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hugepages is a mechanism that allows the Linux kernel to utilise the multiple page size capabilities of modern hardware architectures. Linux uses pages as the basic unit of memory, where physical memory is partitioned and accessed using the basic page unit. The default page size is 4096 Bytes in the x86 architecture. Hugepages allows large amounts of memory to be utilised with a reduced overhead. Linux uses &#8220;Transaction Lookaside Buffers&#8221; (TLB) in the CPU architecture. These buffers contain mappings of virtual memory to actual physical memory addresses. So utilising a huge amount of physical memory with the default page size consumes the TLB and adds processing overhead. The Linux kernel is able to set aside a portion of physical memory to be able be addressed using a larger page size. Since the page size is higher, there will be less overhead managing the pages with the TLB. In the Linux 2.6 series of kernels, hugepages is enabled using the CONFIG_HUGETLB_PAGE feature when the kernel is built. Systems with large amount of memory can be configured to utilise the memory more efficiently by setting aside a portion dedicated for hugepages. The actual size of the page is dependent on the system architecture. A typical x86 system will have a Huge Page Size of 2048 kBytes. The huge page size may be found by looking at the /proc/meminfo : </p>
<p># cat /proc/meminfo |grep Hugepagesize Hugepagesize: 2048 kB</p>
<p>Number of Hugepages can be allocated using the /proc/sys/vm/nr_hugepages entry, or by using the sysctl command.</p>
<p>To view the current setting using the /proc entry:<br />
# cat /proc/sys/vm/nr_hugepages 0</p>
<p>To view the current setting using the sysctl command:<br />
# sysctl vm.nr_hugepages vm.nr_hugepages = 0</p>
<p>To set the number of huge pages using /proc entry:<br />
# echo 5 &gt; /proc/sys/vm/nr_hugepages</p>
<p>To set the number of hugepages using sysctl:<br />
# sysctl -w vm.nr_hugepages=5 vm.nr_hugepages = 5</p>
<p>It may be necessary to reboot to be able to allocate the number of hugepages that is needed. This is because hugepages requires large areas of contiguous physical memory. Over time, physical memory may be mapped and allocated to pages, thus the physical memory can become fragmented. If the hugepages are allocated early in the boot process, fragmentation is unlikely to have occurred.</p>
<p>It is recommended that the /etc/sysctl.conf file should be used to allocate hugepages at boot time. For example, to allocate 5 hugepages at boot time add the line below to the sysctl.conf file :</p>
<p>vm.nr_hugepages = 5</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/22/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/22/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=22&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/10/hugepages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
		<item>
		<title>How to identify whether the machine supports para virtual guests?</title>
		<link>http://vietwow.wordpress.com/2008/07/10/how-to-identify-whether-the-machine-supports-para-virtual-guests/</link>
		<comments>http://vietwow.wordpress.com/2008/07/10/how-to-identify-whether-the-machine-supports-para-virtual-guests/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 06:00:40 +0000</pubDate>
		<dc:creator>vietwow</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://vietwow.wordpress.com/?p=19</guid>
		<description><![CDATA[If the machine supports para virtual guests, then you should see a &#8220;pae&#8221; flag in /proc/info. This means &#8211; the machine has PAE support and can run para virtual guests. [root@unixfoo root]# cat /proc/cpuinfo &#124; grep paeflags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=19&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Verdana;">If the machine supports para virtual guests, then you should see a &#8220;pae&#8221; flag in /proc/info. This means &#8211; the machine has PAE support and can run para virtual guests.</span></p>
<p><span style="font-family:Courier;">[root@unixfoo root]# cat /proc/cpuinfo | grep pae</span><br /><span style="font-family:Courier;">flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm nx lm</span><br /><span style="font-family:Courier;">[root@unixfoo root]#</span></p>
<p><span style="font-family:Verdana;">If there is no output for the above command, then the machine is not capable of running a para-virtualized guest.</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/vietwow.wordpress.com/19/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/vietwow.wordpress.com/19/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/vietwow.wordpress.com/19/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/vietwow.wordpress.com/19/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/vietwow.wordpress.com/19/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=vietwow.wordpress.com&amp;blog=4172256&amp;post=19&amp;subd=vietwow&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://vietwow.wordpress.com/2008/07/10/how-to-identify-whether-the-machine-supports-para-virtual-guests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9bd56884a8086a88433ded3c06ea1a4c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">vietwow</media:title>
		</media:content>
	</item>
	</channel>
</rss>
