<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: Get Detailed Information About Particular IP address Connections Using netstat Command</title> <atom:link href="http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: maedox</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-176505</link> <dc:creator>maedox</dc:creator> <pubDate>Mon, 05 Dec 2011 09:35:16 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-176505</guid> <description>watch -n 1 -d &#039;netstat -atulpn -o 2 &#124; egrep &quot;LISTEN&#124;ESTABLISHED&quot;&#039;</description> <content:encoded><![CDATA[<p>watch -n 1 -d &#8216;netstat -atulpn -o 2 | egrep &#8220;LISTEN|ESTABLISHED&#8221;&#8216;</p> ]]></content:encoded> </item> <item><title>By: kiran</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-175657</link> <dc:creator>kiran</dc:creator> <pubDate>Mon, 14 Nov 2011 10:43:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-175657</guid> <description>netstat -atulpn -o 2
DO u think that will help</description> <content:encoded><![CDATA[<p>netstat -atulpn -o 2<br
/> DO u think that will help</p> ]]></content:encoded> </item> <item><title>By: kiran</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-175656</link> <dc:creator>kiran</dc:creator> <pubDate>Mon, 14 Nov 2011 10:38:21 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-175656</guid> <description>HI
how can I get the netstat to run like top command which give the live connections statistics.
Do we have any script which makes this working or any inbuild switch in netstat can do it?
any idea?
/kiran</description> <content:encoded><![CDATA[<p>HI<br
/> how can I get the netstat to run like top command which give the live connections statistics.<br
/> Do we have any script which makes this working or any inbuild switch in netstat can do it?</p><p>any idea?</p><p>/kiran</p> ]]></content:encoded> </item> <item><title>By: mb</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-172252</link> <dc:creator>mb</dc:creator> <pubDate>Sun, 03 Jul 2011 12:32:17 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-172252</guid> <description>netstat --interfaces eth0 -&gt; netstat --interfaces=eth0</description> <content:encoded><![CDATA[<p>netstat &#8211;interfaces eth0 -&gt; netstat &#8211;interfaces=eth0</p> ]]></content:encoded> </item> <item><title>By: Juda</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-170848</link> <dc:creator>Juda</dc:creator> <pubDate>Sat, 23 Apr 2011 10:52:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-170848</guid> <description>This is very good article ,  i reallay like to read it,
please note that you can reduce the timeout of TCP_WAIT2 it will reduce the amont of open conneciton on the server significaly</description> <content:encoded><![CDATA[<p>This is very good article ,  i reallay like to read it,<br
/> please note that you can reduce the timeout of TCP_WAIT2 it will reduce the amont of open conneciton on the server significaly</p> ]]></content:encoded> </item> <item><title>By: Pan</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-158843</link> <dc:creator>Pan</dc:creator> <pubDate>Thu, 12 Aug 2010 12:58:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-158843</guid> <description>we can use below also:
netstat -atun &#124; grep ESTABLISHED &#124; awk &#039;{print $5}&#039; &#124; cut -d: -f1 &#124; sed -e &#039;/^$/d&#039; &#124;sort &#124; uniq -c &#124; sort -n</description> <content:encoded><![CDATA[<p>we can use below also:</p><p>netstat -atun | grep ESTABLISHED | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sed -e &#8216;/^$/d&#8217; |sort | uniq -c | sort -n</p> ]]></content:encoded> </item> <item><title>By: astha goyal</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-153904</link> <dc:creator>astha goyal</dc:creator> <pubDate>Thu, 25 Feb 2010 04:12:41 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-153904</guid> <description>can we block packets in c++???
if yes,then how???</description> <content:encoded><![CDATA[<p>can we block packets in c++???<br
/> if yes,then how???</p> ]]></content:encoded> </item> <item><title>By: Allyson</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-150424</link> <dc:creator>Allyson</dc:creator> <pubDate>Sun, 30 Aug 2009 20:11:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-150424</guid> <description>Great  job! I just have one small question. Is there a certian netstat command that I can use for to find an IP address?</description> <content:encoded><![CDATA[<p>Great  job! I just have one small question. Is there a certian netstat command that I can use for to find an IP address?</p> ]]></content:encoded> </item> <item><title>By: muthu</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-149297</link> <dc:creator>muthu</dc:creator> <pubDate>Fri, 03 Jul 2009 06:23:02 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-149297</guid> <description>nice article</description> <content:encoded><![CDATA[<p>nice article</p> ]]></content:encoded> </item> <item><title>By: dj</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-149262</link> <dc:creator>dj</dc:creator> <pubDate>Wed, 01 Jul 2009 16:41:20 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-149262</guid> <description>Get list of unique IP address. Add NR &gt; 2 to awk and that&#039;ll eliminate the netstat titles.
Like: netstat -nat &#124; awk &#039;NR&gt;2 { print $5}&#039; &#124; cut -d: -f1 &#124; sed -e &#039;/^$/d&#039; &#124; uniq</description> <content:encoded><![CDATA[<p>Get list of unique IP address. Add NR &gt; 2 to awk and that&#8217;ll eliminate the netstat titles.<br
/> Like: netstat -nat | awk &#8216;NR&gt;2 { print $5}&#8217; | cut -d: -f1 | sed -e &#8216;/^$/d&#8217; | uniq</p> ]]></content:encoded> </item> <item><title>By: Phil F</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-148978</link> <dc:creator>Phil F</dc:creator> <pubDate>Tue, 16 Jun 2009 11:57:40 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-148978</guid> <description>One note about &quot;grep {IP-address}&quot;:  The dot (.) is a wildcard to grep, so &quot;grep 1.2.1.5&quot;  would also match 132.135.x.x.
I generally use fgrep when I don&#039;t want any regex matching.  You could also escape the dots with a backslash, or use grep -F.</description> <content:encoded><![CDATA[<p>One note about &#8220;grep {IP-address}&#8221;:  The dot (.) is a wildcard to grep, so &#8220;grep 1.2.1.5&#8243;  would also match 132.135.x.x.</p><p>I generally use fgrep when I don&#8217;t want any regex matching.  You could also escape the dots with a backslash, or use grep -F.</p> ]]></content:encoded> </item> <item><title>By: Gaurav</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-146268</link> <dc:creator>Gaurav</dc:creator> <pubDate>Tue, 16 Dec 2008 13:34:43 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-146268</guid> <description>One small correction for the command
netstat --interfaces=eth0 ( original )
netstat --interfaces eth0 ( suggested )
For the copy paste user only .. others can read syntax.</description> <content:encoded><![CDATA[<p>One small correction for the command<br
/> netstat &#8211;interfaces=eth0 ( original )<br
/> netstat &#8211;interfaces eth0 ( suggested )</p><p>For the copy paste user only .. others can read syntax.</p> ]]></content:encoded> </item> <item><title>By: steven hulme</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144801</link> <dc:creator>steven hulme</dc:creator> <pubDate>Sat, 30 Aug 2008 08:22:39 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144801</guid> <description>My netstat box will only open for 5 seconds and will not accept anytype of command ?.</description> <content:encoded><![CDATA[<p>My netstat box will only open for 5 seconds and will not accept anytype of command ?.</p> ]]></content:encoded> </item> <item><title>By: Dan</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144160</link> <dc:creator>Dan</dc:creator> <pubDate>Wed, 25 Jun 2008 11:17:55 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144160</guid> <description>What I&#039;ve forgot to mention in my previous post is the following, this command is useful if you are running a Linux box at home or at the office, but has some problems when run on a server, especially if it&#039;s a web server, Apache or other, and if on it there are websites that have dynamically generated content via PHP, MySQL, PostgreSQL, etc. That&#039;s because when having such a website there are multiple connections initiated by the &quot;website&quot; (via the web server software) to the database (whatever it might be) and to the PHP processor, all of this from a simple page being viewed by someone. This means that a web page might generate ~20-80 connections from one IP to the server.
Hope I don&#039;t get too cryptic in this but there&#039;s some explaining to do. These multiple connections generated by the access to one web page remain in a TIME_WAIT state usually for 60 seconds, value established on most Linux distros by the /proc/sys/net/ipv4/tcp_fin_timeout entry. This means that one page generates 20-80 connections, which remain active (by netstat they are shown in a TIME_WAIT state) for 60 seconds. Now picture accessing 5-6 pages in such a website (say it&#039;s a shopping website and your searching through categories of products), this would generate well in excess of 120-480 connections from the same IP address, thus appearing that you are being attacked, flooded, etc. If you have a software running on the server to prevent flooding, it might be &quot;smart&quot; enough to figure it out on it&#039;s own that it isn&#039;t attacked. But if you as an individual are running the command, then you should take notice of the things said here, for it might fool you into thinking something else than what&#039;s actually taking place.
One solution would be to add to the command the option for:
&lt;code&gt;
sed -n -e &#039;/ESTABLISHED/p&#039;
&lt;/code&gt;
Which would scan only for connections that are in an ESTABLISHED state. A high count here would probably mean you should start taking action.
And the entire command which scans for established connections:
&lt;code&gt;
netstat -atun &#124; awk &#039;{print $5}&#039; &#124; sed -n -e &#039;/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p’ &#124; sed -n -e &#039;/ESTABLISHED/p&#039; &#124; sed ’s/::ffff://’ &#124; cut -d: -f1 &#124; sort &#124; uniq -c &#124; sort -n
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>What I&#8217;ve forgot to mention in my previous post is the following, this command is useful if you are running a Linux box at home or at the office, but has some problems when run on a server, especially if it&#8217;s a web server, Apache or other, and if on it there are websites that have dynamically generated content via PHP, MySQL, PostgreSQL, etc. That&#8217;s because when having such a website there are multiple connections initiated by the &#8220;website&#8221; (via the web server software) to the database (whatever it might be) and to the PHP processor, all of this from a simple page being viewed by someone. This means that a web page might generate ~20-80 connections from one IP to the server.</p><p>Hope I don&#8217;t get too cryptic in this but there&#8217;s some explaining to do. These multiple connections generated by the access to one web page remain in a TIME_WAIT state usually for 60 seconds, value established on most Linux distros by the /proc/sys/net/ipv4/tcp_fin_timeout entry. This means that one page generates 20-80 connections, which remain active (by netstat they are shown in a TIME_WAIT state) for 60 seconds. Now picture accessing 5-6 pages in such a website (say it&#8217;s a shopping website and your searching through categories of products), this would generate well in excess of 120-480 connections from the same IP address, thus appearing that you are being attacked, flooded, etc. If you have a software running on the server to prevent flooding, it might be &#8220;smart&#8221; enough to figure it out on it&#8217;s own that it isn&#8217;t attacked. But if you as an individual are running the command, then you should take notice of the things said here, for it might fool you into thinking something else than what&#8217;s actually taking place.</p><p>One solution would be to add to the command the option for:</p><p><code><br
/> sed -n -e '/ESTABLISHED/p'<br
/> </code></p><p>Which would scan only for connections that are in an ESTABLISHED state. A high count here would probably mean you should start taking action.</p><p>And the entire command which scans for established connections:</p><p><code><br
/> netstat -atun | awk '{print $5}' | sed -n -e '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p’ | sed -n -e '/ESTABLISHED/p' | sed ’s/::ffff://’ | cut -d: -f1 | sort | uniq -c | sort -n<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: Dan</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144159</link> <dc:creator>Dan</dc:creator> <pubDate>Wed, 25 Jun 2008 10:11:28 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-144159</guid> <description>To add to what you&#039;ve mentioned above, in order to check for DoS attacks, there may be addresses in the output of netstat that might look something like:
&lt;code&gt;
:::*
&lt;/code&gt;
So even if what I&#039;m suggesting means writing some more code, it does the trick a little better if you ask me. So here it goes, the command for finding if you are under DoS attacks:
&lt;code&gt;
netstat -atun &#124; awk &#039;{print $5}&#039; &#124; sed -n -e &#039;/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p&#039; &#124; sed &#039;s/::ffff://&#039; &#124; cut -d: -f1 &#124; sort &#124; uniq -c &#124; sort -n
&lt;/code&gt;</description> <content:encoded><![CDATA[<p>To add to what you&#8217;ve mentioned above, in order to check for DoS attacks, there may be addresses in the output of netstat that might look something like:<br
/> <code><br
/> :::*<br
/> </code></p><p>So even if what I&#8217;m suggesting means writing some more code, it does the trick a little better if you ask me. So here it goes, the command for finding if you are under DoS attacks:<br
/> <code><br
/> netstat -atun | awk '{print $5}' | sed -n -e '/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/p' | sed 's/::ffff://' | cut -d: -f1 | sort | uniq -c | sort -n<br
/> </code></p> ]]></content:encoded> </item> <item><title>By: kotnik</title><link>http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-142966</link> <dc:creator>kotnik</dc:creator> <pubDate>Thu, 21 Feb 2008 17:48:36 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/netstat-command-tutorial-examples.html#comment-142966</guid> <description>There&#039;s some mean stuff here.
Thanks for gathering it ;)</description> <content:encoded><![CDATA[<p>There&#8217;s some mean stuff here.</p><p>Thanks for gathering it ;)</p> ]]></content:encoded> </item> </channel> </rss>
