<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>TomsBlog</title>
    <link>http://www.toms-blog.com/tags/cisco/index.xml</link>
    <description>Recent content on TomsBlog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-uk</language>
    <atom:link href="http://www.toms-blog.com/tags/cisco/index.xml" rel="self" type="application/rss+xml" />
    
    <item>
      <title>Backup Cisco config with Rancid and an unprivileged user</title>
      <link>http://www.toms-blog.com/post/backup-cisco-config-with-rancid-with-unprivileged-user/</link>
      <pubDate>Thu, 24 Jan 2013 22:35:43 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/backup-cisco-config-with-rancid-with-unprivileged-user/</guid>
      <description>&lt;p&gt;RANCID is a tool for backing up network devices configuration and versioning the backups. It was originally intended to backup Cisco configurations it does this by logging in to the devices using either telnet or ssh and then runs a series of commands. In a default set up it runs multiple commands and captures the output of each command, we don’t need all this information infact we only want to store the configuration and so we only need to grant the user one command “show running-config”.&lt;/p&gt;

&lt;p&gt;You need to have RANCID already set up and be familiar with how it works. You can find a useful guide here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;http://openmaniak.com/rancid_tutorial.php&#34;&gt;http://openmaniak.com/rancid_tutorial.php&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’ll explain how the configuration file determines what scripts are run. Lets take the following router.db configuration:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;192.168.0.1:cisco:up&lt;/p&gt;

&lt;p&gt;192.168.0.2:cisco:up&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;The first part is the IP address or hostname of the device then the type of device and weather it is up or down. This device type actually specifies what scripts to run, this mapping can be found in the file “rancid-fe” which is by default stored in /usr/libexec/rancid/. Open up the file and we are looking for the vendortable  array:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #003333&#34;&gt;%vendortable&lt;/span&gt; &lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt; (
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;agm&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;agmrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;alteon&amp;#39;&lt;/span&gt;            &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;arancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;arista&amp;#39;&lt;/span&gt;            &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;arrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;avocent&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;avorancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;baynet&amp;#39;&lt;/span&gt;            &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;brancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cat5&amp;#39;&lt;/span&gt;              &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cat5rancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cisco&amp;#39;&lt;/span&gt;             &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;rancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cisco-old&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;rancid-old&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cisco-nx&amp;#39;&lt;/span&gt;          &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;nxrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cisco-xr&amp;#39;&lt;/span&gt;          &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;xrrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;css&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;cssrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;enterasys&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;rivrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;erx&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;jerancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;extreme&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;xrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;ezt3&amp;#39;&lt;/span&gt;              &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;erancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;f5-file&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;f5ranciducs&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;force10&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;f10rancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;fortigate&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;fnrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;foundry&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;francid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;hitachi&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;htrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;hp&amp;#39;&lt;/span&gt;                &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;hrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;juniper&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;jrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;mrtd&amp;#39;&lt;/span&gt;              &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;mrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;mrv&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;mrvrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;netopia&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;trancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;netscaler&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;nsrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;netscreen&amp;#39;&lt;/span&gt;         &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;nrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;procket&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;prancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;redback&amp;#39;&lt;/span&gt;           &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;rrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;riverstone&amp;#39;&lt;/span&gt;        &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;rivrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;smc&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;srancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;tnt&amp;#39;&lt;/span&gt;               &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;tntrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;zebra&amp;#39;&lt;/span&gt;             &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;zrancid&amp;#39;&lt;/span&gt;,
    &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;watchguard&amp;#39;&lt;/span&gt;        &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;wrancid&amp;#39;&lt;/span&gt;
)
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;As you can see cisco maps to the “rancid” script file. So lets copy that script file and call it “rancid.bak”, this is so we can restore the file later if we wish.&lt;/p&gt;

&lt;p&gt;Now edit the rancid file using you favourite editor and find the commandtable array “@commandtable”, comment out this entire array:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#@commandtable = (&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show version&amp;#39;                 =&amp;gt; &amp;#39;ShowVersion&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show redundancy secondary&amp;#39;    =&amp;gt; &amp;#39;ShowRedundancy&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show idprom backplane&amp;#39;,       =&amp;gt; &amp;#39;ShowIDprom&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show install active&amp;#39;          =&amp;gt; &amp;#39;ShowInstallActive&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show env all&amp;#39;                 =&amp;gt; &amp;#39;ShowEnv&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show rsp chassis-info&amp;#39;,       =&amp;gt; &amp;#39;ShowRSP&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show gsr chassis&amp;#39;             =&amp;gt; &amp;#39;ShowGSR&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show diag chassis-info&amp;#39;       =&amp;gt; &amp;#39;ShowGSR&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show boot&amp;#39;                    =&amp;gt; &amp;#39;ShowBoot&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show bootvar&amp;#39;                 =&amp;gt; &amp;#39;ShowBoot&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show variables boot&amp;#39;          =&amp;gt; &amp;#39;ShowBoot&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show flash&amp;#39;                   =&amp;gt; &amp;#39;ShowFlash&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all nvram:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all bootflash:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slot0:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all disk0:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slot1:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all disk1:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slot2:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all disk2:&amp;#39;              =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all harddisk:&amp;#39;           =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all harddiska:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all harddiskb:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sup-bootflash:&amp;#39;      =&amp;gt; &amp;#39;DirSlotN&amp;#39;},         # cat 6500-ios&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sup-microcode:&amp;#39;      =&amp;gt; &amp;#39;DirSlotN&amp;#39;},         # cat 6500-ios&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavenvram:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavebootflash:&amp;#39;     =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slaveslot0:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavedisk0:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slaveslot1:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavedisk1:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slaveslot2:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavedisk2:&amp;#39;         =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all slavesup-bootflash:&amp;#39; =&amp;gt; &amp;#39;DirSlotN&amp;#39;},         # cat 7609&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-nvram:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-bootflash:&amp;#39;      =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-slot0:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-disk0:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-slot1:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-disk1:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-slot2:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;dir /all sec-disk2:&amp;#39;          =&amp;gt; &amp;#39;DirSlotN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show controllers&amp;#39;             =&amp;gt; &amp;#39;ShowContAll&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show controllers cbus&amp;#39;        =&amp;gt; &amp;#39;ShowContCbus&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show diagbus&amp;#39;                 =&amp;gt; &amp;#39;ShowDiagbus&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show diag&amp;#39;                    =&amp;gt; &amp;#39;ShowDiag&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show module&amp;#39;                  =&amp;gt; &amp;#39;ShowModule&amp;#39;},       # cat 6500-ios&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show spe version&amp;#39;             =&amp;gt; &amp;#39;ShowSpeVersion&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show c7200&amp;#39;                   =&amp;gt; &amp;#39;ShowC7200&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show inventory raw&amp;#39;           =&amp;gt; &amp;#39;ShowInventory&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show vtp status&amp;#39;              =&amp;gt; &amp;#39;ShowVTP&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show vlan&amp;#39;                    =&amp;gt; &amp;#39;ShowVLAN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show vlan-switch&amp;#39;             =&amp;gt; &amp;#39;ShowVLAN&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show debug&amp;#39;                   =&amp;gt; &amp;#39;ShowDebug&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;more system:running-config&amp;#39;   =&amp;gt; &amp;#39;WriteTerm&amp;#39;},        # ASA/PIX&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;show running-config&amp;#39;          =&amp;gt; &amp;#39;WriteTerm&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#       {&amp;#39;write term&amp;#39;                   =&amp;gt; &amp;#39;WriteTerm&amp;#39;},&lt;/span&gt;
&lt;span style=&#34;color: #0099FF; font-style: italic&#34;&gt;#);&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;Now we need to create the array again but with our command:&lt;/p&gt;

&lt;p&gt;&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #003333&#34;&gt;@commandtable&lt;/span&gt; &lt;span style=&#34;color: #555555&#34;&gt;=&lt;/span&gt; {
{&lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;show running-config view full&amp;#39;&lt;/span&gt; &lt;span style=&#34;color: #555555&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&#34;color: #CC3300&#34;&gt;&amp;#39;WriteTerm&amp;#39;&lt;/span&gt;}
);
&lt;/pre&gt;&lt;/div&gt;
&lt;/p&gt;

&lt;p&gt;This basically maps the command “show running-config view full” to the function “WriteTerm”, so when run it will connect to the device run the command and then the function will parse the output and remove certain things like password etc and then save the output to host.new where host is the name of the host.&lt;/p&gt;

&lt;p&gt;Now all we need to do is set up a user on the switch so connect to the switch:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;&lt;span style=&#34;color: #336666&#34;&gt;enable&lt;/span&gt;
conf t
username rancid privilege &lt;span style=&#34;color: #FF6600&#34;&gt;4&lt;/span&gt; secret password
privilege &lt;span style=&#34;color: #336666&#34;&gt;exec&lt;/span&gt; level &lt;span style=&#34;color: #FF6600&#34;&gt;4&lt;/span&gt; show running-config view full
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This creates a user called rancid and password “password” and grants it privilege 4. The last command then allows level 4 to run the command  “show the running config”.&lt;/p&gt;

&lt;p&gt;Now add the username and password to your .clogin&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;
&lt;p&gt;add user * rancid&lt;/p&gt;

&lt;p&gt;add password * password&lt;/p&gt;

&lt;p&gt;add method * {ssh} {telnet}&lt;/p&gt;

&lt;p&gt;add autoenable * {[01]}&lt;/p&gt;

&lt;/div&gt;

&lt;p&gt;This means rancid will use the rancid username and password for all devices, it will first try SSH but if that fails it will then try Telnet. The last line means it doesnt need to run enable on login, adjust this to your needs.&lt;/p&gt;

&lt;p&gt;This unfortunately doesn’t work on all IOS’s versions, you can also use TACACs to limit a users access to the device and is the preferred way, but if you don’t have TACACs and have the latest IOS the above will work just fine. You can also add a section to the “rancid-fe” file that points “cisco-old” for example to the original script file that we backed up previously then you can run the old and new cisco script as and when you need to.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Upgrading Cisco switches with K9 image</title>
      <link>http://www.toms-blog.com/post/upgrading-cisco-switches-with-k9-image/</link>
      <pubDate>Sat, 18 Aug 2012 20:12:43 +0000</pubDate>
      
      <guid>http://www.toms-blog.com/post/upgrading-cisco-switches-with-k9-image/</guid>
      <description>&lt;p&gt;I recently had to install a new HP c7000 chassis with 16 half height blades.&lt;/p&gt;

&lt;p&gt;This came with 4 Cisco 3020’s switches in the back, 2 for normal network traffic and 2 for the iSCSI fabric.
This was to be placed in a PCI environment and so had to meet PCI requirements.&lt;/p&gt;

&lt;p&gt;PCI DSS states:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

2.3 Encrypt all non-console administrative access using strong cryptography. Use technologies such as SSH, VPN, or SSL/TLS for web-based management and other non-console administrative access

&lt;/div&gt;

&lt;p&gt;So we need to encrypt the management access to the switches, by default the Cisco IOS doesn’t support SSH or HTTPS Encryption. To enable SSH and HTTPS we need to update the IOS with the K9 image:&lt;/p&gt;

&lt;div class=&#34;box&#34;&gt;

cbs30x0-ipbasek9-mz.122-58.SE1.tar

&lt;/div&gt;

&lt;p&gt;From the cisco website&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;http://www.cisco.com/cisco/software/release.html?mdfid=280348753&amp;amp;softwareid=280805680&amp;amp;release=12.2.58-SE1&amp;amp;relind=AVAILABLE&amp;amp;rellifecycle=ED&amp;amp;reltype=latest&#34;&gt;http://www.cisco.com/cisco/software/release.html?mdfid=280348753&amp;amp;softwareid=280805680&amp;amp;release=12.2.58-SE1&amp;amp;relind=AVAILABLE&amp;amp;rellifecycle=ED&amp;amp;reltype=latest&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need a valid Service Contract login to download IOS software.&lt;/p&gt;

&lt;p&gt;Note K9 in the IOS filename just make sure you look for this then you know you have the correct IOS update.&lt;/p&gt;

&lt;p&gt;Now you need a TFTP server so you can upload the image to the switch, I usually use TFTPD for Windows. You can download it from here:&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;http://tftpd32.jounin.net/&#34;&gt;http://tftpd32.jounin.net/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Open TFTP and then select the directory in which the IOS update is located. Now TFTPD is looking at the correct directory you need to log on to the switch.&lt;/p&gt;

&lt;p&gt;You will obviously need to use the console cable and set an IP address on the Management Interface or VLAN depending on your setup. The 3020’s I am dealing with have a seperate FastEthernet (fa0) interface connecting to the HP Onboard Administrator for management. In my case as well because of the HP Onboard Administrator the fa0 interface is given an IP address through EBIPA. Now connect to the same Subnet as the Management interface.&lt;/p&gt;

&lt;p&gt;As you can see above I’ve downloaded the archive update file which contains the updated HTTP files as you never know in the future you might want to use the HTTP interface.&lt;/p&gt;

&lt;p&gt;On the switch type the following command:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;Switch# archive download-sw /overwrite /reload tftp://ipaddress/cbs30x0-ipbasek9-mz.122-58.SE1.tar
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This command will download the image from the specified TFTP server, it will overwrite the current IOS and attempt to reload the switch. If the config hasn’t been saved then the reload will be aborted. To save the config I always run the following before running the above command:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;Switch# copy run start
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;This will copy the running config to the start up config then the switch will automatically reload on the update.&lt;/p&gt;

&lt;p&gt;Once the switch has booted up fully it should now have the K9 image installed. you can always confirm this by running the following:&lt;/p&gt;

&lt;div class=&#34;highlight&#34; style=&#34;background: #f0f3f3&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span&gt;&lt;/span&gt;Switch# show version

Cisco IOS Software, CBS30X0 Software &lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;CBS30X0-IPBASEK9-M&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt;, Version 12.2&lt;span style=&#34;color: #555555&#34;&gt;(&lt;/span&gt;58&lt;span style=&#34;color: #555555&#34;&gt;)&lt;/span&gt;SE1
&lt;/pre&gt;&lt;/div&gt;

</description>
    </item>
    
  </channel>
</rss>