<?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>Technical Diary &#187; Cisco</title>
	<atom:link href="http://andriigrytsenko.net/tag/cisco/feed/" rel="self" type="application/rss+xml" />
	<link>http://andriigrytsenko.net</link>
	<description>With Andrii Grytsenko</description>
	<lastBuildDate>Sun, 01 Apr 2012 11:10:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Mini-howto for Cisco Catalyst</title>
		<link>http://andriigrytsenko.net/2009/07/mini-howto-for-cisco-catalyst/</link>
		<comments>http://andriigrytsenko.net/2009/07/mini-howto-for-cisco-catalyst/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 12:41:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Cisco]]></category>

		<guid isPermaLink="false">http://andriigrytsenko.net/?p=218</guid>
		<description><![CDATA[In this post you can find some practical advices about work with cisco catalyst. 1. How to make vlan? 2. How to add/remove interface to/from vlan? 3. How to shutdown interface? 4. What is ACL? 5. How to make ACL ? 6. How to add new rule or delete old one from ACL? 7. How [...]]]></description>
			<content:encoded><![CDATA[<p>In this post you can find some practical advices about work with cisco catalyst.</p>
<p><span id="more-218"></span></p>
<p><strong><br />
<a href="#one">1. How to make vlan?</a><br />
<a href="#two">2. How to add/remove interface to/from vlan?</a><br />
<a href="#three">3. How to shutdown interface?</a><br />
<a href="#four">4. What is ACL?</a><br />
<a href="#five">5. How to make ACL ?</a><br />
<a href="#six">6. How to add new rule or delete old one from ACL?</a><br />
<a href="#seven">7. How to apply acl to the interface?</a><br />
<a href="#eight">8. How to restrict access to port based on mac address?</a><br />
<a href="#nine">9. How set size limit for history?</a><br />
<a href="#ten">10. How to make current config boot at next time?</a><br />
<a href="#eleven">11. How to upload/download configuration file to/from switch?</a><br />
<a href="#twelve">12. Is there any analogs of unix grep in ios?</a><br />
<a href="#thirteen">13. How to change telnet password?</a><br />
<a href="#fourteen">14. How to turn on traffic analyzer on cisco devices?</a><br />
</strong></p>
<p><a name="one"><strong>1. How to make vlan?</strong></a><br />
It can be easily done in two steps:</p>
<pre>Switch#vlan database
Switch(vlan)#vlan <em>vlan_id</em> name <em>vlan_name</em>
</pre>
<p><a name="two"><strong>2. How to add/remove interface to/from vlan?</strong></a><br />
First, I have to be have existing vlan at your switch.</p>
<pre>Switch#configure terminal
Switch(config)#interface gigaethernet 1/0
Switch(config-if )# switchport
Switch(config-if )# switchport mode access
Switch(config-if )# switchport access vlan <em>vlan_id</em>
Switch(config-if )# no shutdown</pre>
<p><a name="three"><strong>3. How to shutdown interface?</strong></a><br />
To  disable port you need to log in to cisco switch and run:</p>
<pre>Switch#configure terminal
Switch(config)#interface gigaethernet [port]
Switch(config-if )#shutdown</pre>
<p><a name="four"><strong>4. What is ACL?</strong></a><br />
In certain proprietary computer hardware an Access Control List refers to rules that are applied to port numbers or network daemon names that are available on a host or other layer 3 device, each with a list of hosts and/or networks permitted to use the service. Both individual servers as well as routers can have network ACLs. Access control lists can generally be configured to control both inbound and outbound traffic, and in this context they are similar to firewalls.</p>
<p><a name="five"><strong>5. How to make ACL ?</strong></a><br />
To create new acl you should go into configuration mode:</p>
<pre># configure terminal</pre>
<p>and run:</p>
<pre># ip access-list extended name</pre>
<p>Where,<br />
name &#8211; the name of new acl</p>
<p><a name="six"><strong>6. How to add new rule or delete old one from ACL?</strong></a><br />
To add new rule use next syntax for inbound packages:</p>
<pre>permit [protocol] host [source_ip_addr] eq [source_port] host [destionation_ip_addr]</pre>
<p>and this for outbound:</p>
<pre>permit [protocol] host [source_ip_addr] host [destionation_ip_addr] eq [port]</pre>
<p>There are some examples:</p>
<pre>#ip access-list extended name</pre>
<pre>Switch2970(config-ext-nacl)#permit tcp host 10.0.30.20 eq 21 host 10.0.30.6 </pre>
<p># allow host 10.0.30.6 connect to the ftp server at 10.0.30.20</p>
<pre>Switch2970(config-ext-nacl)#permit tcp host 10.0.30.20 host 10.0.30.6 eq 80</pre>
<p> # allow host 10.0.30.20 connect to web-server at 10.0.30.6</p>
<pre>Switch2970(config-ext-nacl)# end
Switch2970#show running-config
</pre>
<p>To delete rule go to your acl:</p>
<pre>#ip access-list extended name</pre>
<p>run your rule with word &#8220;
<pre>no</pre>
<p>&#8221; in the begging. For instance if you have next rule:</p>
<pre>permit tcp host 10.0.30.20 eq ftp host 10.0.30.6</pre>
<p>to delete it make</p>
<pre>no permit tcp host 10.0.30.20 eq ftp host 10.0.30.6</pre>
<p><a name="seven"><strong>7. How to apply acl to the interface?</strong></a><br />
To apply acl to some particular interface go to configuration mode:</p>
<pre>Switch2970#configure terminal</pre>
<p>in our example I&#8217;ll use port number 11:</p>
<pre>Switch2970(config)#interface gigabitEthernet 0/11</pre>
<pre>Switch2970(config-if)#ip access-group name in </pre>
<p># instead <em>name</em> type name of your acl</p>
<pre>Switch2970(config-if)#end</pre>
<p>and check it:</p>
<pre>Switch2970# show running-config | begin 0/11
 interface GigabitEthernet0/11
 description empty
 ip access-group name in</pre>
<p>Looks ok.</p>
<p><a name="eight"><strong>8. How to restrict access to port based on  mac address?</strong></a><br />
To allow access device with mac=02-34-3d-34-11 to switch interface 1/0. Use next command :</p>
<pre>Switch#configure terminal
Switch(config)#interface gigaethernet 1/0
Switch(config-if )# switchport port-security
Switch(config-if )# switchport port-security mac-address 02-34-3d-34-11
Switch(config-if )# switchport port-security violation <em>type_of_violation</em></pre>
<p>Where type_of_violation can be next:<br />
restrict,protect and shutdown .<br />
In case of connected device have another mac-address. First two types block any traffic from device. Where third &#8211; switch off interface. And interface will be shutdown until administrator make
<pre>no shutdown</pre>
<p> command.</p>
<p><a name="nine"><strong>9. How set size limit for history?</strong></a><br />
You can set it by next commands<br />
It&#8217;s for the current session:</p>
<pre>Switch# terminal history size <em>lines </em></pre>
<p>And this one for the all session:</p>
<pre>Switch(config-line)# history size <em>lines</em> </pre>
<p>Where <em>lines</em> &#8211; the amount of lines which sho<ins datetime="2009-07-06T12:42:03+00:00"></ins><ins datetime="2009-07-06T12:42:03+00:00"></ins>uld be stored in history</p>
<p><a name="ten"><strong>10. How to make current config boot at next time? </strong></a><br />
To make current configuration load at next boot.You have to copy it into the start config:</p>
<pre>Switch#copy running-config  startup-config</pre>
<p><a name="eleven"><strong>11. How to upload/download configuration file to/from switch?</strong></a><br />
First, the tftp server on your host is required. The ip address of our tftp server is 10.0.30.6<br />
To download your config go to switch and run&#8221;</p>
<pre>#copy running-config tftp://10.0.30.6</pre>
<p>Click enter to confirm you ip address: </p>
<pre>Address or name of remote host [10.0.30.2]?</pre>
<p>after this you will get next output in case of success:</p>
<pre>Destination filename [switch2970-confg]? 2970.conf
!!!!!!!!!
38067 bytes copied in 1.082 secs (35182 bytes/sec)</pre>
<p>To upload the config from tftp make:</p>
<pre>#copy tftp://10.0.30.6 running-config</pre>
<p>and don&#8217;t forget to make new config boot after restart. </p>
<p><a name="twelve"><strong>12. Is there any analogs of unix grep in ios?</strong></a><br />
In IOS you can use pipe as well as in unix environment. There are three commands for filtering output: </p>
<pre>begin</pre>
<p> &#8211; to go to first entry</p>
<pre>include</pre>
<p> &#8211; to print all lines which include entry </p>
<pre>exclude</pre>
<p> &#8211; to print all lines which exclude entry </p>
<pre>show command | {begin | include | exclude} regexp</pre>
<pre># show running-config  | include hostname
hostname Switch2970</pre>
<p><a name="thirteen"><strong>13. How to change telnet password?</strong></a><br />
Go to configuration mode:</p>
<pre>Switch2970#configure terminal</pre>
<p>and change password </p>
<pre>username csk@adm# password 0 [new_password]
enable secret 0 [new_password]</pre>
<p><a name="fourteen"><strong>14. How to turn on traffic analyzer on cisco devices?</strong></a><br />
For this operation you need free port at your switch and some machine.<br />
Let&#8217;s imagine that we need to listen all network traffic at port 11 and have port 7 as free one.<br />
First, log in to switch and run:</p>
<pre>Switch2970(config)# no monitor session 1
Switch2970(config)# monitor session 1 source interface GigabitEthernet 0/7
Switch2970(config)# monitor session 1 destination interface GigabitEthernet 0/11</pre>
<p>Now go to your computer and start any sniffer. I use tcpdump:</p>
<pre># tcpdump -l > tcpdump.log &#038; tail -f tcpdump.log</pre>
]]></content:encoded>
			<wfw:commentRss>http://andriigrytsenko.net/2009/07/mini-howto-for-cisco-catalyst/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

