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

<channel>
	<title>yurisk.info &#187; IOS Cisco</title>
	<atom:link href="http://yurisk.info/tag/ios-cisco/feed/" rel="self" type="application/rss+xml" />
	<link>http://yurisk.info</link>
	<description>Technical Blog about IT Security and Networking</description>
	<lastBuildDate>Tue, 07 Sep 2010 12:42:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Cisco ip accounting to begin with</title>
		<link>http://yurisk.info/2009/01/17/cisco-ip-accounting-to-begin-with/</link>
		<comments>http://yurisk.info/2009/01/17/cisco-ip-accounting-to-begin-with/#comments</comments>
		<pubDate>Sat, 17 Jan 2009 17:15:01 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[IOS Cisco]]></category>

		<guid isPermaLink="false">http://yurisk.wordpress.com/?p=57</guid>
		<description><![CDATA[  First of all, Happy New year to All ! As I promised before (last year I&#8217;ll look at ip accounting in Cisco world. I&#8217;ll say it at the start already &#8211; accounting being with us since IOS 10.0 nowadays is getting pushed aside by the powerful Netflow feature.And while it is nowhere being depreciated/end-of-lifed [...]]]></description>
			<content:encoded><![CDATA[<p> <br />
First of all, Happy New year to All !<br />
As I promised before (last year <img src='http://yurisk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;ll look at ip accounting in Cisco world. I&#8217;ll say it at the start already &#8211; accounting being with us since IOS 10.0 nowadays is getting pushed aside by the powerful Netflow feature.And while it is nowhere being depreciated/end-of-lifed by Cisco , it is presented as being &#8220;not enough&#8221;for the modern enterprise. I will agree that Netflow indeed provides lots of additional statistics and info , but will remind that it demands from device and the user substantially more as well.<br />
And therefore for many cases is just plain overkill.</p>
<p>So lets look at accounting closer.<br />
When enabled on the interface it  creates database of accounting information<br />
containing number of bytes that passed the router  between pairs of IP addresses. There are actually more types of accounting  but here I&#8217;ll talk about 2 types only: <span style="text-decoration:underline;">IP accounting</span> and  <span style="text-decoration:underline;">IP access-list violations accounting</span>. The first gathers statistics  for the traffic passing the router &#8211; entering and leaving it (means traffic that destined for or originating from the router itself is not accounted for). The 2nd type gathers info about traffic that is being rejected by the router according to applied ACLs. Both types can be enabled for physical/logical interfaces only (so to say VTY is not in the pack).</p>
<p>Both types share the same database memory space. And talking about memory -<br />
by default router keeps 512 records, after these are exhausted no new accounting info is recorded. As usual , this is configurable (see later).</p>
<p><strong>IP accounting</strong></p>
<p>Here is a sneak preview of accounting at work:</p>
<p>   Source           Destination              Packets               Bytes<br />
122.94.42.91     62.20.179.36                       2                 223</p>
<p>What you see is Ip addresses spotted in the IP packet header as source/destination<br />
, number of packets and bytes. The database is updated continuously as traffic<br />
passes the router.</p>
<p><span style="text-decoration:underline;">IP accounting condifuration</span></p>
<p>- enable on the interface of interest (only outbound traffic is recorded),<br />
i.e traffic leaving interface<br />
- if desired tune number of kept records<br />
- see in CLI gathered info<br />
- see info through SNMP agent (won&#8217;t cover here)<br />
- clear active accounting database and copy snapshot to checkpoint  database<br />
(done at once)<br />
- see later at any time snapshot in checkpoint database or active records<br />
in real-time</p>
<p>So here is our CLI:<br />
1) Enable on interface<br />
<span style="color:#000080;">Router(config)#int fa0/1<br />
Router(config-if)#ip accounting [output-packets]</span></p>
<p>2) [Optional] Tune maximum records value if desired (default 512, maximum 4294967295):<br />
<span style="color:#000080;">Router(config)#ip accounting-threshold 1200</span></p>
<p>3) See the active records in the database:</p>
<p><span style="color:#000080;">Router#sh ip account</span><br />
   Source           Destination              Packets               Bytes<br />
68.146.13.6       162.30.79.36                       1                 129<br />
79.82.168.224     162.30.79.36                       1                 126<br />
142.53.125.103    162.30.79.36                    9237              423360<br />
83.171.0.22       162.30.79.36                       1                 129<br />
118.181.13.61     162.30.79.36                       4                 360</p>
<p>4) Copy active database to checkpoint database and wipe out active db records:</p>
<p><span style="color:#000080;">Router#clear ip account<br />
Router#sh ip accounting checkpoint</span></p>
<p>  Source           Destination              Packets               Bytes<br />
68.146.13.6       162.30.79.36                       1                 129<br />
79.82.168.224     162.30.79.36                       1                 126<br />
142.53.125.103    162.30.79.36                    9237              423360<br />
83.171.0.22       162.30.79.36                       1                 129<br />
118.181.13.61     162.30.79.36                       4                 360</p>
<p>Usage tip: What is this good for at all? As I started in the previuos post<br />
I use such info to provide some insight to the client of what is going on<br />
(or rather going in/out) in his network at the given moment. So, all these<br />
commands I do on the client&#8217;s perimeter equipment which we manage. I have<br />
no slightest inclination to do this for client/whoever on my backbone<br />
gear, and you would be advised not too. Just try to enable accounting on the<br />
router passing gigabits of traffic and you&#8217;ll have some &#8216;splaning to do<br />
afterwards <img src='http://yurisk.info/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .  And in general be advised that many of the posts in my blog come<br />
from Service Provider view  and not of the end-client enterprise<br />
(no matter how big it is) standpoint.</p>
<p>5.5) Some extra-bonus configs though &#8211; you may configure ACL that will filter<br />
for what IP addresses to gather accounting info only. While trying to catch<br />
who is loading your network would be counter-productive to use such filtering,<br />
for monitoring long-time  it makes sense:</p>
<p>  <span style="color:#000080;">Router(config)#ip accounting-list 19.90.14.59 0.0.0.0</span></p>
<p>Then to  database will be written only records involving this IP(s):<br />
 <br />
  <span style="color:#000080;">Router#sh ip account<br />
</span>   Source           Destination              Packets               Bytes<br />
19.90.14.59    162.30.79.37                       7                2912</p>
<p><strong>IP access-list violations accounting.</strong></p>
<p>This accounts for traffic blocked by ACL(s) applied to the interface(s)<br />
- To enable :<br />
<span style="color:#000080;">Router(config-if)#ip accounting access-violations</span><br />
Accounting will exclude mls traffic when mls is enabled.</p>
<p>-  To see the records:<br />
<span style="color:#000080;">Router#sh ip accounting access-violations</span><br />
  Source           Destination              Packets               Bytes   ACL</p>
<p>Accounting data age is 8</p>
<p>* Of course to see something you need to have some blocking ACL applied to the<br />
interface(s) beforehand. As I have no ACL on any interface this db is empty.</p>
<p><strong>USAGE TIP 2</strong>: If you use this feature to spot most loading flow, you&#8217;ll love this<br />
one-liner that after  you pass to it (through std input) print out of<br />
the show ip accounting will sort data by bytes passed in ascending order:</p>
<p>*Hint  Darkstar is Linux machine, not router itself .<br />
  root@DarkStar:~# <span style="color:#000080;">sort -n -k4,4</span><br />
&lt;NOW COPY PASTE OUTPUT FROM ROUTER HERE &#8230;&gt;<br />
68.146.13.6       162.30.79.36                       1                 129<br />
79.82.168.224     162.30.79.36                       1                 126<br />
142.53.125.103    162.30.79.36                    9237              423360<br />
83.171.0.22       162.30.79.36                       1                 129<br />
118.181.13.61     162.30.79.36                       4                 360</p>
<p>79.82.168.224     162.30.79.36                       1                 126<br />
83.171.0.22       162.30.79.36                       1                 129<br />
68.146.13.6       162.30.79.36                       1                 129<br />
118.181.13.61     162.30.79.36                       4                 360<br />
142.53.125.103    162.30.79.36                    9237              423360</p>
<p><strong>USAGE TIP 3</strong>:<br />
To even further improve on the one-liner above below is again one-liner<br />
that not only sorts accounting data by Bytes field but also sums up bytes per<br />
Ip address (here in the 2nd field, but you can esaily modify to your needs):</p>
<p><a href="mailto:root@DarkStar">root@DarkStar</a>:~# <span style="color:#000080;">sort -n -k4,4 | awk &#8216;{ips[$2] += $4} END { for (x in ips) print x,ips[x]}&#8217;<br />
</span>122.53.125.103   162.30.79.36                       3                 120<br />
59.44.58.120     162.30.79.36                       3                 417<br />
123.203.142.106  162.30.79.36                       1                 177<br />
82.144.177.32    162.30.79.36                       1                 234<br />
218.103.137.105  162.10.79.36                       1                 126<br />
80.37.83.120     162.10.79.36                       1                 126<br />
79.182.121.216   162.10.79.36                       9                 377<br />
207.191.202.251  162.30.79.36                       9                 377<br />
84.195.248.47    162.20.79.36                       7                 304<br />
201.95.211.8     162.40.79.36                       8                 364<br />
79.180.14.184    162.30.79.36                      24                 994<br />
124.64.176.192   162.70.79.36                       5                 227<br />
62.219.133.44    162.30.79.36                      72                3077<br />
91.196.214.6     162.40.79.36                       4                 160<br />
125.125.227.168  162.40.79.36                      15                 797</p>
<p>0<br />
162.20.79.36 304<br />
162.40.79.36 1321<br />
162.30.79.36 5396<br />
162.10.79.36 629<br />
162.70.79.36 227<br />
<a href="mailto:root@DarkStar">root@DarkStar</a>:~#</p>
<p>Here I&#8217;ll wrap up my short (if you ask me) memo with few links for those interested to deep digger :</p>
<p>1) The whole book dedicated to knowing your network better :</p>
<p>Network Management: Accounting and Performance Strategies<br />
by Benoit Claise &#8211; CCIE No. 2686; Ralf Wolter</p>
<p><a href="http://www.ciscopress.com/bookstore/product.asp?isbn=1587051982">http://www.ciscopress.com/bookstore/product.asp?isbn=1587051982</a></p>
<p>Cisco IOS command reference:</p>
<p><a href="http://www.cisco.com/en/US/docs/ios/12_3/ipaddr/command/reference/ip1_i1g.html#wp1091971">http://www.cisco.com/en/US/docs/ios/12_3/ipaddr/command/reference/ip1_i1g.html#wp1091971</a></p>
<p>PS Next post I am planning to do on Netflow , the beast of accounting to be tamed.</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2009/01/17/cisco-ip-accounting-to-begin-with/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Guarding against brute force attack on VTY in Cisco IOS</title>
		<link>http://yurisk.info/2008/10/10/guarding-against-brute-force-attack-on-vty-in-cisco-ios/</link>
		<comments>http://yurisk.info/2008/10/10/guarding-against-brute-force-attack-on-vty-in-cisco-ios/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 09:24:03 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Cisco]]></category>
		<category><![CDATA[IOS Cisco]]></category>

		<guid isPermaLink="false">http://yurisk.wordpress.com/?p=41</guid>
		<description><![CDATA[Cisco starting IOS 12.3 introduced a simple but powerful feature to guard against brute force password guessing attack on remote access. The usual template followed when configuring VTY access is: 1) Configure ACL containing management IPs to be allowed to access the router through VTY 2) (Optional) Restrict VTY access protocol to ssh only (transport [...]]]></description>
			<content:encoded><![CDATA[<p>Cisco starting IOS 12.3 introduced a simple but powerful feature to guard against brute force password guessing attack on remote access. The usual template followed when configuring VTY access is:<br />
1) Configure ACL containing management IPs to be allowed to access the router through VTY<br />
2) (Optional) Restrict VTY access protocol to ssh only (transport input ssh)<br />
3) Apply this ACl to VTY : (config-line)# access-class &lt;ACL&gt;  in<br />
4) (Optional)  SIngle out one VTY line for a special remote access IP to be used if all VTY lines<br />
are currently in use: (config)# line vty 4<br />
Now I enhanced this template with following features:<br />
#Blocks login for 300 seconds after 5 failed logins within  50 seconds time interval</p>
<p><strong>login block-for 300 attempts 5 within 50</strong><br />
#apply specified ACl to VTY line when above event occurs, it is meant to exempt<br />
#your managemnt IP form being blocked. After timed block expires this ACL gets removed<br />
#from VTY and previous ACL that was applied before the event is reapplied back</p>
<p><strong>login quiet-mode access-class anti-DOS</strong></p>
<p>#Logging rate-limitation to prevent cluttering logs with failed attempts<br />
<strong>login on-failure log every 10</strong></p>
<p><strong>ip access-list standard anti-DOS<br />
 permit 193.193.193.33<br />
 remark Deny VTY access to anyone else if brute-force logins take up all VTY lines<br />
</strong> <br />
Another nice feature is delay between login attempts:<br />
<strong>Sacramento(config)#login delay 2</strong><br />
  Delay login is in seconds</p>
<p>Then in logs you will see the following failed attempts:</p>
<p><code><br />
*May  2 02:04:14.105: %SEC_LOGIN-4-LOGIN_FAILED: Login failed [user: ] [Source: 62.141.52.141] [localport: 22] [Reason: Login Authentication Failed] at 05:04:14  Sat May 2 2009<br />
*May  2 02:04:22.112: %SEC_LOGIN-1-QUIET_MODE_ON: Still timeleft for watching failures is 22 secs, [user: ] [Source: 62.141.52.141] [localport: 22] [Reason: Login Authentication Failed] [ACL: anti-DOS] at 05:04:22  Sat May 2 2009<br />
*May  2 02:09:22.091: %SEC_LOGIN-5-QUIET_MODE_OFF: Quiet Mode is OFF, because block period timed out at 05:09:22  Sat May 2 2009<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2008/10/10/guarding-against-brute-force-attack-on-vty-in-cisco-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
