<?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>Chainring Circus</title>
	<atom:link href="http://www.chainringcircus.org/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.chainringcircus.org</link>
	<description>My thoughts on Linux, Routing and Cycling.</description>
	<lastBuildDate>Fri, 27 Aug 2010 03:35:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Two Variables, One Line</title>
		<link>http://www.chainringcircus.org/?p=2169</link>
		<comments>http://www.chainringcircus.org/?p=2169#comments</comments>
		<pubDate>Tue, 24 Aug 2010 14:45:24 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2169</guid>
		<description><![CDATA[This morning I could not for the life of me remember how to read two variables from one line in bash. As a result I am putting this simple script up here so that I have an easy place to reference. The input file was a listing of printer IP addresses that are translated is [...]]]></description>
			<content:encoded><![CDATA[<p>This morning I could not for the life of me remember how to read two variables from one line in bash.  As a result I am putting this simple script up here so that I have an easy place to reference.</p>
<p>The input file was a listing of printer IP addresses that are translated is in the file /tmp/printers.txt and looks like this.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /tmp/printers.txt<br />
192.168.1.10 &nbsp;= &nbsp;10.0.1.10<br />
192.168.50.5 &nbsp;= &nbsp;10.0.1.11<br />
192.168.50.15 &nbsp;= &nbsp;10.0.1.25</div></div>
<p>Here is the simple code to read both variables.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;"># 2010-08-24 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># Simple script to find names of local and remote printers</span><br />
<span style="color: #666666; font-style: italic;"># that are translated.</span><br />
<br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #007800;">IFS</span>== <span style="color: #c20cb9; font-weight: bold;">read</span> remote <span style="color: #7a0874; font-weight: bold;">local</span> &nbsp;<br />
<span style="color: #000000; font-weight: bold;">do</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">name</span>=<span style="color: #000000; font-weight: bold;">`</span>dig +short <span style="color: #660033;">-x</span> <span style="color: #007800;">$local</span><span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>,<span style="color: #007800;">$remote</span>,<span style="color: #007800;">$local</span>&quot;</span><br />
<span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>printers.txt</div></div>
<p>But it came it out in this format, not much of a problem but I prefer it more legible.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">tcp5.chainringcircus.org.,192.168.1.10 &nbsp; , &nbsp; 10.0.1.10<br />
rmp7.chainringcircus.org.,192.168.50.5 &nbsp; , &nbsp; 10.0.1.11<br />
jlb3.chainringcircus.org.,192.168.50.15 &nbsp; , &nbsp; 10.0.1.25</div></div>
<p>So I cleaned up the output.  The first sed stanza deletes the third &#8220;.&#8221; in the output and the second sed stanza deletes the spaces.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">./find-printers.sh | sed 's/\.//3 <br />
s/\ //g'<br />
tcp5.chainringcircus.org,192.168.1.10,10.0.1.10<br />
rmp7.chainringcircus.org,192.168.50.5,10.0.1.11<br />
jlb3.chainringcircus.org,192.168.50.15,10.0.1.25</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Doc CD</title>
		<link>http://www.chainringcircus.org/?p=2128</link>
		<comments>http://www.chainringcircus.org/?p=2128#comments</comments>
		<pubDate>Fri, 23 Jul 2010 16:30:00 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2128</guid>
		<description><![CDATA[Cisco documentation is expansive, it is both broad and has great depth, as a result finding what you need is not easy. When you watch a CCIE navigate the &#8220;Doc CD&#8221; or documentation website you realize how deeply they understand the documentation website. I watched the free Doc CD lecture the other day at INE, [...]]]></description>
			<content:encoded><![CDATA[<p>Cisco documentation is expansive, it is both broad and has great depth, as a result finding what you need is not easy.  When you <a href="http://www.facebook.com/pages/IPexpert/24586557119?v=app_7146470109&amp;ref=ts">watch</a> a CCIE navigate the &#8220;Doc CD&#8221; or documentation website you realize how deeply they understand the documentation website.</p>
<p>I watched the free Doc CD lecture the other day at INE, I wish I could find the link sorry, then I watched the IPE documentation tutorial and have been forcing myself to use the site hierarchy rather than searching.  I thought I would share some notes.</p>
<p>For instance, today I wanted to look at VACLs so I went:</p>
<ul>
<li>Cisco.com
<ul>
<li>Documentation
<ul>
<li>Products
<ul>
<li>Switches
<ul>
<li>LAN Switches Access
<ul>
<li>Catalyst 3560-E
<ul>
<li>Configuration Guides
<ul>
<li>Catalyst 3750-E and 3560-E Switch Configuration Guide</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>Then clicked around on different VLAN topics.  Nothing.</p>
<p>So I fell back to the standard Google search:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">VACL site:cisco.com</div></div>
<p>Clicked I&#8217;m Feeling Lucky.  But I wanted to learn where it was really located, so I backtracked by looking at the navigation bar on the left side.<br />
<img src="../files/images/cisco-vlan-acl.png" alt="cisc.com screenshot" /></p>
<p>But to really learn the documentation it doesn&#8217;t end there.  I go back through the Doc CD:</p>
<ul>
<li>Cisco.com
<ul>
<li>Documentation
<ul>
<li>Technology
<ul>
<li>LAN Switching
<ul>
<li>LAN Security
<ul>
<li>VACLs
<ul>
<li>Securing Networks with Private VLANs and VLAN Access Control Lists</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p><strong>General Notes</strong><br />
Below are my notes on where to find different documentation on the Cisco website.  I actually have this written long hand in a notebook that I still refer to when navigating around.  I believe the key is repetition so I try and force myself to navigate &#8220;properly.&#8221;</p>
<p><a href="http://www.cisco.com/cisco/web/psa/default.html">This</a> is the site I have bookmarked for the DocCD.</p>
<ul>
<li>Cisco.com
<ul>
<li>Documentation
<ul>
<li>Cisco IOS and NX-OS Software
<ul>
<li>Cisco IOS
<ul>
<li>Cisco IOS Software Release 12.4 Family
<ul>
<li>Cisco IOS Software Releases 12.4 T</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>You can tell from the purple links where I surf.<br />
<img src="../files/images/ios-12.4t.png" alt="IOS 12.4T Documentation Screenshot" /><br />
The links that are the most useful.</p>
<ul>
<li>Master Index</li>
<li>Command References</li>
<li>Configuration Guides</li>
</ul>
<p><strong>Master Index</strong><br />
This is useful if you know the command but just want to confirm what it does.  The other day I looked up:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">spanning-tree mst configuration</div></div>
<p>Just click the on the Master Index and the correct alphabetical range, then use find in your browser to find the command you need to reference.  It provides a different interface into the Command References.</p>
<p><strong>Command References</strong><br />
Gives a short description of the command and what it does.  Then it breaks out the syntax and the options involved.  Finally it explains when the feature was added and a revision history.  I always wondered how people knew when what command had been implemented and was amazed at their recall.  Now I know, just look at the command reference.  Duh.</p>
<p><strong>Configuration Guides</strong><br />
These are the more in depth guides.  They usually start with a technology overview and provide a simple scenario and configuration.  Then they get into the details of different commands and option and often include more examples with multiple routers or switches using some of the more advanced configuration options of the technology discussed.  This is where I spend most of my time now, however, in the future I hope to be referencing the Master Index more than the Configuration Guides.</p>
<p>Below is an outline of where to find some of the technologies I reference most often.</p>
<ul>
<li>Dial Technologies
<ul>
<li>PPP</li>
</ul>
</li>
<li>IP
<ul>
<li>IP Addressing Services
<ul>
<li>IP Addressing</li>
<li>ARP</li>
<li>DHCP</li>
<li>DNS</li>
<li>NAT</li>
</ul>
</li>
<li>Application Services
<ul>
<li>SLA</li>
<li>Enhanced Object Tracking</li>
<li>First Hop Redundancy Protocols</li>
<li>UDP</li>
</ul>
</li>
<li>Multicast</li>
<li>IP Routing: X Protocol</li>
<li>IP Switching
<ul>
<li>CEF</li>
</ul>
</li>
<li>IPv6</li>
<li>OER</li>
</ul>
</li>
<li>Long Reach Ethernet
<ul>
<li>Broadband Access
<ul>
<li>PPPOE</li>
</ul>
</li>
</ul>
</li>
<li>MPLS</li>
<li>Network Management
<ul>
<li>Network Management
<ul>
<li>EEM</li>
</ul>
</li>
</ul>
</li>
<li>QoS</li>
<li>Security and VPN
<ul>
<li>Securing the Control Plane
<ul>
<li>Control Plane Policing</li>
</ul>
</li>
<li>Securing the Data Plane
<ul>
<li>ACLs</li>
<li>CBAC</li>
<li>IPS</li>
</ul>
</li>
</ul>
</li>
<li>System Management</li>
<li>WAN
<ul>
<li>Frame Relay</li>
<li>Layer 2 Tunneling Protocol Version 3</li>
</ul>
</li>
<li>Additional Legacy Protocols
<ul>
<li>Terminal Services
<ul>
<li>Appendix
<ul>
<li>Regular Expressions</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2128</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>McKesson Star and DHCP</title>
		<link>http://www.chainringcircus.org/?p=2108</link>
		<comments>http://www.chainringcircus.org/?p=2108#comments</comments>
		<pubDate>Sat, 17 Jul 2010 23:08:59 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2108</guid>
		<description><![CDATA[Aren&#8217;t statistics wonderful. I was looking through some referrer traffic and it appears that McKesson Star and DHCP are often googled and this blog comes up as #1 with that query. So I figured I had better write a post on how to set up McKesson Star and DHCP to all play well together. Which [...]]]></description>
			<content:encoded><![CDATA[<p>Aren&#8217;t statistics wonderful.  I was looking through some referrer traffic and it appears that McKesson Star and DHCP are often googled and this blog comes up as #1 with that query.  So I figured I had better write a post on how to set up McKesson Star and DHCP to all play well together.</p>
<p>Which leads to a funny story.  When I first came to my present employer all PCs that accessed Star had static IP addresses.  Well to be fair not all of them, but the default-lease-time was literally set for one year and IP addresses were used in the ports table.  At the time we had ~1,500 PCs and 1,000 of them were static IP addresses.  Woe unto you if you had a laptop and tried to access Star.  </p>
<p>I guess the previous administrator was thinking he would only have to change an IP address in the ports table if the PC was turned off, or once annually _if_ it got a new address upon a renewal request.  My day was filled with changing DNS entries and fixing that was high on my list of priorities.</p>
<p>We use ISC BIND and DHCP so let me give you an example of my DHCP configuration.  I have another post on DHCP <a href="http://www.chainringcircus.org/?p=758">here</a>.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># /etc/dhcpd.conf<br />
# This dhcpd server is the _real_ deal.<br />
authoritative;<br />
<br />
# Update using DDNS<br />
# Tells the client where to send the forward update.<br />
ddns-domainname &quot;sub.chainringcircus.org&quot;;<br />
ddns-update-style interim;<br />
ddns-updates on;<br />
<br />
# Leases<br />
default-lease-time 345600; &nbsp;# 4 days<br />
max-lease-time 604800; &nbsp;# 7 days</div></div>
<p><strong>/etc/tcpd.conf</strong><br />
McKesson wrote their own telnet daemon.  The reason is because the view you get in Star as well as your default printer is set according to a DNS lookup done by their daemon.  The McKesson telnet daemon options are set in /etc/tcpd.conf.  Let&#8217;s discuss this next because how you define name lookups also makes a big difference.  As a side note, our tcpd.conf did not change when we moved from AIX to Linux.</p>
<p>From /etc/dhcpd.conf:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">##&nbsp; EXAMPLES:<br />
##&nbsp; &nbsp; &nbsp; GETNAME=NONE&nbsp; &nbsp; &nbsp; &nbsp; Do not try to get the callers name.<br />
##&nbsp; &nbsp; &nbsp; GETNAME=SIMPLE&nbsp; &nbsp; &nbsp; Try to get the callers simple name.<br />
##&nbsp; &nbsp; &nbsp; GETNAME=FULL&nbsp; &nbsp; &nbsp; &nbsp; Try to get the callers full name.<br />
##<br />
##<br />
##&nbsp; Lines beginning with MAPNAME= are used to determine if the callers<br />
##&nbsp; name gotten from getname should be mapped to lower or upper case.<br />
##<br />
##&nbsp; FORMAT:<br />
##&nbsp; &nbsp; &nbsp; MAPNAME=VALUE<br />
##<br />
##&nbsp; &nbsp; &nbsp; VALUE ......... NONE, the callers name is unchanged. This<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is the default if the parameter is<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; not in the configuration file.<br />
##<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LOWER, the callers name will be mapped to<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lower case.<br />
##<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; UPPER, the callers name will be mapped to<br />
##&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; upper case.<br />
##<br />
##&nbsp; EXAMPLES:<br />
##&nbsp; &nbsp; &nbsp; MAPNAME=NONE&nbsp; &nbsp; &nbsp; &nbsp; Do not remap callers name.<br />
##&nbsp; &nbsp; &nbsp; MAPNAME=LOWER &nbsp; &nbsp; &nbsp; Map callers name to lower case.<br />
##&nbsp; &nbsp; &nbsp; MAPNAME=UPPER &nbsp; &nbsp; &nbsp; Map callers name to upper case.<br />
##<br />
PURGETIME=3h<br />
GETNAME=SIMPLE<br />
MAPNAME=LOWER</div></div>
<p>What does all of this mean?  Keep in mind that UNIX is case sensitive and so is Star.  What this means is that defining a computer name in Star as well as on the PC, it is important to make sure that they all match.  That is why it&#8217;s easier to use an IP address.  Because the default file does not specify MAPNAME and therefore whether a PC technician uses HumpBack or ALLCAPS, or lowercase makes a difference in how a host name is defined in the Star tables.</p>
<p><strong>GETNAME</strong><br />
The GETNAME option defines whether or not the server does a query for host.chainringcircus.org or just host.  If you decide to do a SIMPLE lookup make sure you have all of the possible domains listed in /etc/resolv.conf.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/resolv.conf<br />
nameserver 192.168.1.1<br />
nameserver 192.168.1.2<br />
domain chainringcircus.org<br />
search chainringcircus.org sub.chainringcircus.org chainringcircus.com chainringcircus.net</div></div>
<p>We use simple because a host is defined as host in the Star table and returns the correct information from an nslookup command.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[root@StarCluster ~]# nslookup host1<br />
Server: &nbsp; &nbsp; 192.168.1.1<br />
Address:&nbsp; &nbsp; 192.168.1.1#53<br />
<br />
Name: &nbsp; host1.chainringcircus.org<br />
Address: 192.168.1.22</div></div>
<p><strong>MAPNAME</strong><br />
If you don&#8217;t set MAPNAME you will have to make sure that the PC name, DNS name and Star table name all match case.  We decided to stay with all lowercase PC names.  This is very important so let me explain this again, differently.  Go to a windows PC and look at it&#8217;s PC name.</p>
<p>Click:<br />
My Computer<br />
&#8211;> Properties<br />
    &#8211;> Computer Name </p>
<p>If it is DoctorPC521 then it will register in DNS as DoctorPC521.  It will return from an nslookup as DoctorPC521 and so it had better be in the Star table as DoctorPC521 not DOCTORPC521 or it will not get the correct view and printer.</p>
<p>I hope this helps other administrators trying to figure out how to make McKesson Star and DHCP work well together.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2108</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ClusterIt</title>
		<link>http://www.chainringcircus.org/?p=2084</link>
		<comments>http://www.chainringcircus.org/?p=2084#comments</comments>
		<pubDate>Fri, 16 Jul 2010 23:17:52 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2084</guid>
		<description><![CDATA[I&#8217;ve been playing with more clustering as I prepare for a RedHat class in August and figured I would write about ClusterIt. I was looking to run a few commands on about six servers and went looking for a simple solution. I believe ClusterIt provides an elegant solution for very little work. Commands Here is [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing with more clustering as I prepare for a RedHat class in August and figured I would write about <a href="http://sourceforge.net/projects/clusterit/">ClusterIt</a>.  I was looking to run a few commands on about six servers and went looking for a simple solution.  I believe ClusterIt provides an elegant solution for very little work.</p>
<p><strong>Commands</strong><br />
Here is a list of commands and their description from their respective manpages.<br />
dsh – Run a command on a cluster of machines as defined in the CLUSTER environmental variable.<br />
dshbak – Takes input from the dsh command and formats it to look nicer for the user.<br />
run – Run a command on a machine at random.<br />
rseq – Run a command on a sequence of machines or cluster.<br />
pcp – Copy a file to a number of machines.<br />
pdf – Display free disk space across a number of machines, can be for a single filesystem or the entire machine.<br />
prm – Delete a file, directory or list of files on a number of machines.<br />
rvt – Remote terminal emulator.<br />
clustersed – Quickly dissect cluster files, used to cut individual groups out of a cluster file.<br />
dtop – Used to remotely monitor and display top information, this program segfaulted on my system.</p>
<p>There are also some more involved commands, the daemons for these must be set up on the remote machines.<br />
barrier – Used to synchronize execution of commands on slower and faster machines.  When a barrier is set, the process is not released until all of the nodes or processes have met the barrier condition.<br />
barrierd – The daemon portion of barrier that accepts connections from the client program barrier.<br />
jsh – Run scheduled commands on remote machines.<br />
jsd – A simple command scheduling daemon for remote execution.</p>
<p><strong>Installation</strong><br />
The first thing you need to do is make sure you have ssh password-less login set up.  I went to our network management server and added a couple of the servers that needed to be able to run commands remotely.</p>
<p>In case you are doing this from scratch, here is the sequence of commands.  Generate private/public keys on your management server A.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> dsa<br />
press enter when it asks <span style="color: #000000; font-weight: bold;">for</span> the filename<br />
press enter when it asks <span style="color: #000000; font-weight: bold;">for</span> the passphrase <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">yes</span>, a blank passphrase<span style="color: #7a0874; font-weight: bold;">&#41;</span></div></div>
<p>This will generate two files: ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub.  You now want to allow access from this server (A) to the remote server (B) by putting the contents of ~/.ssh/id_dsa.pub from A into ~/.ssh/authorized_keys2 on B.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_dsa.pub <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">ssh</span> B <span style="color: #ff0000;">'cat &gt;&gt; ~/.ssh/authorized_keys2'</span></div></div>
<p>Make sure permissions are correct and are not writable or readable except by the owner.  Do this on both server A and B.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">chmod</span> a-x,go-w,o-r ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/*</span></div></div>
<p>And to verify it works.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ssh</span> B <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-la</span></div></div>
<p>Now it&#8217;s time to install ClusterIt.  I like to have a suite of programs installed in a common directory but don&#8217;t want to modify my MANPATH or worry about other nonsense.  This is how I installed ClusterIt.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--bindir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>clusterit<br />
<span style="color: #c20cb9; font-weight: bold;">make</span> <br />
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span><br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>clusterit<span style="color: #000000; font-weight: bold;">/</span><br />
<span style="color: #c20cb9; font-weight: bold;">ls</span></div></div>
<p>If you read the manpage for dsh or one of the other program in ClusterIt you can see a number of environmental variables and how to set up the ClusterIt environmental variables and files.  A snippet of the manpage for dsh.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">ENVIRONMENT<br />
dsh utilizes the following environment variables.<br />
<br />
CLUSTER &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Contains a filename, <span style="color: #c20cb9; font-weight: bold;">which</span> is a newline separated <br />
list of nodes <span style="color: #000000; font-weight: bold;">in</span> the cluster.<br />
<br />
RCMD_CMD &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Command to use to connect to remote machines. &nbsp;<br />
The <span style="color: #7a0874; font-weight: bold;">command</span> chosen must be able to connect with no password to <br />
the remote host. &nbsp;Defaults to <span style="color: #c20cb9; font-weight: bold;">rsh</span><br />
<br />
&nbsp;...removed <span style="color: #000000; font-weight: bold;">for</span> brevity...<br />
<br />
FILES<br />
The <span style="color: #c20cb9; font-weight: bold;">file</span> pointed to by the CLUSTER environment variable has the <br />
following format:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;pollux<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;castor<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GROUP:alpha<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;rigel<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;kent<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GROUP:sparc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alshain<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;altair<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LUMP:alphasparc<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;alpha<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sparc<br />
<br />
This example would have pollux and castor a member of no <span style="color: #c20cb9; font-weight: bold;">groups</span>, <br />
rigel and kent a member of group <span style="color: #ff0000;">'alpha'</span>, and alshain and altair a <br />
member of group <span style="color: #ff0000;">'sparc'</span>. &nbsp;Note the format of the GROUP <span style="color: #7a0874; font-weight: bold;">command</span>, <br />
it is <span style="color: #000000; font-weight: bold;">in</span> all capital letters, followed by a colon, and the group name.<br />
There can be no spaces following the GROUP <span style="color: #7a0874; font-weight: bold;">command</span>, or <span style="color: #000000; font-weight: bold;">in</span> the <br />
name of the group.</div></div>
<p>As a result I set up my .bashrc with the following options for ClusterIt.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">CLUSTER</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>clusterit<span style="color: #000000; font-weight: bold;">/</span>servers<br />
<span style="color: #7a0874; font-weight: bold;">export</span> CLUSTER<br />
<br />
<span style="color: #007800;">RCMD_CMD</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">ssh</span><br />
<span style="color: #7a0874; font-weight: bold;">export</span> RCMD_CMD<br />
<br />
<span style="color: #007800;">PATH</span>=<span style="color: #007800;">$PATH</span>:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>clusterit<br />
<span style="color: #7a0874; font-weight: bold;">export</span> PATH</div></div>
<p>Make sure you re-source your .bashrc.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">source ~/.bashrc</div></div>
<p>And I have a simple /etc/clusterit/servers file:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">cat /etc/clusterit/servers<br />
B<br />
C<br />
D</div></div>
<p>Now to test.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">dsh <span style="color: #c20cb9; font-weight: bold;">uptime</span><br />
B: &nbsp;<span style="color: #000000;">17</span>:<span style="color: #000000;">44</span>:<span style="color: #000000;">26</span> up <span style="color: #000000;">24</span> days, &nbsp;<span style="color: #000000;">6</span>:<span style="color: #000000;">32</span>, &nbsp;<span style="color: #000000;">5</span> <span style="color: #c20cb9; font-weight: bold;">users</span>, &nbsp;load average: <span style="color: #000000;">0.02</span>, <span style="color: #000000;">0.01</span>, <span style="color: #000000;">0.00</span><br />
C: &nbsp;<span style="color: #000000;">17</span>:<span style="color: #000000;">46</span>:<span style="color: #000000;">56</span> up <span style="color: #000000;">443</span> days, &nbsp;<span style="color: #000000;">9</span>:<span style="color: #000000;">53</span>, &nbsp;<span style="color: #000000;">2</span> <span style="color: #c20cb9; font-weight: bold;">users</span>, &nbsp;load average: <span style="color: #000000;">0.00</span>, <span style="color: #000000;">0.00</span>, <span style="color: #000000;">0.00</span><br />
D: &nbsp;<span style="color: #000000;">17</span>:<span style="color: #000000;">46</span>:<span style="color: #000000;">56</span> up <span style="color: #000000;">443</span> days, &nbsp;<span style="color: #000000;">9</span>:<span style="color: #000000;">52</span>, &nbsp;<span style="color: #000000;">1</span> user, &nbsp;load average: <span style="color: #000000;">0.00</span>, <span style="color: #000000;">0.01</span>, <span style="color: #000000;">0.00</span></div></div>
<p><strong>Testing</strong><br />
And finally run some commands.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">man pcp<br />
pcp /usr/local/bin/script.sh /usr/local/bin/script.sh <br />
dsh /usr/local/bin/script.sh -d /tmp<br />
dsh scp /tmp/output.txt user@A:/tmp/</div></div>
<p>That last command you must have password-less login from the ClusterIt servers back to your management server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2084</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More TestLab Scripts</title>
		<link>http://www.chainringcircus.org/?p=2063</link>
		<comments>http://www.chainringcircus.org/?p=2063#comments</comments>
		<pubDate>Sat, 26 Jun 2010 00:57:29 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2063</guid>
		<description><![CDATA[I wrote a couple more scripts this week. These two little gems update my entire lab by running one command from the testlab tftp server. I pass the main script a lab name and it proceeds to update every router and switch in the testlab to the new initial lab configuration. I have tested it [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a couple more scripts this week.  These two little gems update my entire lab by running one command from the testlab tftp server.  I pass the main script a lab name and it proceeds to update every router and switch in the testlab to the new initial lab configuration.  I have tested it on at least one 1841, 2611, 3640, 3550 and 3560.  I probably spent more time writing the scripts than it would have taken me to upgrade the testlab by hand for each lab, but I guess I&#8217;ll never know.  You can download the scripts <a href="http://chainringcircus.org/files/TestLabScripts.tar">here</a>.</p>
<p>Let me explain how it is done.  Every router and switch has a configuration file named flash:def.  When the whole lab has flash:def loaded they can all get to the tftp server for the lab.  First side note: it was named flash:default but default is a reserved word in expect so I had to change the name, def is short for default. </p>
<p>In the first round of interaction the script saves every running-config to flash:new and then does a configure replace flash:def.  If you just wanted to reset your lab each time, you could stop the script there.  You should make sure that the switches all get changed to a VTP mode transparent and set to a new VTP domain, oddly enough I used def as my VTP domain.  By making all of the switches transparent if the new config loads any VLANs or changes the domain your VTP domain will be reset.  Second side note: I was going to save the original running-config as flash:save, that would still be a trivial change to make and then you could go back and review the config if you needed, but some labs build on top of the next, so I didn&#8217;t.</p>
<p>After each router and switch has the def configuration file loaded the script does an ls of the correct lab directory on the tftp server and proceeds to tftp the new configuration file as flash:new, overwriting the previously saved running-config.  The tftp server is hooked to the switch named Cat4 which is the last host upgraded by the script so all devices can get to the tftp server.</p>
<p>Finally the script goes back through each device doing a round of configure replace:new.  The best part of this is that there is no reload.  The 2611 can take nearly 10 minutes to reload so I did not want to have to reload any devices.</p>
<p>In summary this is the process:<br />
1.  Save every running-config as flash:new.<br />
2.  Load the default configuration flash:def that allows for tftp access for the entire lab.<br />
3.  Copy the initial configuration for the new lab to flash:new on the routers that need it, overwriting the saved flash:new.<br />
4.  Run configure replace flash:new on ever device, bringing up the newest lab.</p>
<p>Here is a listing of the files on R2.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R2#dir flash:<br />
Directory of flash:/<br />
<br />
&nbsp; &nbsp; 1 &nbsp;-rw- &nbsp; &nbsp;32632600 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;c3640-a3js-mz.124-25b.bin<br />
&nbsp; &nbsp; 2 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp;1132 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;r2-basic-ios.cfg<br />
&nbsp; &nbsp; 3 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp;1200 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;r2-gre.cfg<br />
&nbsp; &nbsp; 4 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp;6446 &nbsp;May 28 2002 02:23:57 +00:00 &nbsp;ipbasic.cfg<br />
&nbsp; &nbsp;13 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp; 883 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;save<br />
&nbsp; &nbsp;15 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp;1061 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;def<br />
&nbsp; &nbsp;18 &nbsp;-rw- &nbsp; &nbsp; &nbsp; &nbsp;1226 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;no date&gt; &nbsp;new<br />
<br />
33030140 bytes total (372576 bytes free)<br />
R2#</div></div>
<p>This is the tlu script.  It is just the simple front end to the tlue script.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;"># 2010-05-25 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># tlu (testlab update)</span><br />
<span style="color: #666666; font-style: italic;"># One of two scripts that updates the entire testlab to the current lab.</span><br />
<span style="color: #666666; font-style: italic;"># This script calls tlue (testlab update expect) that does the heavy lifting.</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #007800;">${0}</span> LAB-X<span style="color: #000099; font-weight: bold;">\n</span> <span style="color: #007800;">${0}</span> LAB-1<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #007800;">LAB</span>=<span style="color: #800000;">${1}</span><br />
<br />
<span style="color: #666666; font-style: italic;"># First go through and set every router or switch to the default configuration.</span><br />
<span style="color: #666666; font-style: italic;"># Calling tlue (testlab update expect) with the def command, the def </span><br />
<span style="color: #666666; font-style: italic;"># configuration sets every router to clean confiuration that allows access to </span><br />
<span style="color: #666666; font-style: italic;"># the tftp server. &nbsp;</span><br />
<span style="color: #666666; font-style: italic;"># R3 is the frame switch so it is not included.</span><br />
config_replace <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">LAB</span>=<span style="color: #800000;">${1}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">CONFIG</span>=<span style="color: #800000;">${2}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">for</span> ROUTER <span style="color: #000000; font-weight: bold;">in</span> R1 R2 R4 R5 R6 R7 R8 R9 BB1 BB2 BB3 Cat1 Cat2 Cat3 Cat4<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$ROUTER</span> <span style="color: #007800;">$LAB</span> <span style="color: #007800;">$CONFIG</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tlue <span style="color: #007800;">$ROUTER</span> <span style="color: #007800;">$LAB</span> <span style="color: #007800;">$CONFIG</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">10</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">done</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">## Main</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
config_replace <span style="color: #007800;">$LAB</span> <span style="color: #ff0000;">&quot;def&quot;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> CONFIG <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>tftpboot<span style="color: #000000; font-weight: bold;">/</span>VOL-<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #800000;">${LAB}</span><span style="color: #000000; font-weight: bold;">/</span>INITIAL<span style="color: #000000; font-weight: bold;">/`</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">ROUTER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #007800;">$CONFIG</span> .txt<span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$ROUTER</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; tlue <span style="color: #007800;">$ROUTER</span> <span style="color: #800000;">${1}</span> tftp<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">10</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<br />
config_replace <span style="color: #007800;">$LAB</span> <span style="color: #ff0000;">&quot;new&quot;</span></div></div>
<p>The expect script is the one that does all of the work and took the most time to write.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/expect -f</span><br />
<span style="color: #666666; font-style: italic;"># 2010-06-25 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># tlue (testlab update expect)</span><br />
<span style="color: #666666; font-style: italic;"># This script does the heavy lifting of updating the testlab.</span><br />
<span style="color: #666666; font-style: italic;"># If you use this script you will have to change the IP address</span><br />
<span style="color: #666666; font-style: italic;"># in the procedure copy_tftp.</span><br />
<br />
<span style="color: #000000; font-weight: bold;">set</span> host <span style="color: #ff0000;">&quot;testlab.chainringcircus.org&quot;</span><br />
<span style="color: #000000; font-weight: bold;">set</span> pass <span style="color: #ff0000;">&quot;CHANGEME&quot;</span><br />
<span style="color: #000000; font-weight: bold;">set</span> ctrlz \032<br />
<span style="color: #000000; font-weight: bold;">set</span> timeout <span style="color: #000000;">100</span><br />
<span style="color: #000000; font-weight: bold;">set</span> spawn_telnet <span style="color: #000000;">0</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Sent in from the command line.</span><br />
<span style="color: #000000; font-weight: bold;">set</span> router <span style="color: #7a0874; font-weight: bold;">&#91;</span>lindex <span style="color: #007800;">$argv</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">set</span> lab <span style="color: #7a0874; font-weight: bold;">&#91;</span>lindex <span style="color: #007800;">$argv</span> <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">set</span> config <span style="color: #7a0874; font-weight: bold;">&#91;</span>lindex <span style="color: #007800;">$argv</span> <span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<br />
proc <span style="color: #c20cb9; font-weight: bold;">login</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>router<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;login&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; global host pass ctrlz spawn_telnet<br />
&nbsp; &nbsp; &nbsp; &nbsp; spawn telnet <span style="color: #007800;">$host</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;Password:&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;<span style="color: #007800;">$pass</span><span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;testlab&gt;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;telnet <span style="color: #007800;">$router</span><span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;Open&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Just in case we are in configure mode.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ctrlz</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> spawn_telnet <span style="color: #007800;">$spawn_id</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
proc save_config <span style="color: #7a0874; font-weight: bold;">&#123;</span>router<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;save_config&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; global spawn_telnet<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> spawn_id <span style="color: #007800;">$spawn_telnet</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Saving the current config in case I want it for some reason.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;copy run flash\:new<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Destination filename [new]?</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #ff0000;">&quot;\[new\]&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Do you want to over write? [confirm]</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;.*Do you want to over write.*&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;y<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># No, do not erase flash:.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># Erase flash: before copying? [confirm]</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect &nbsp;<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;Erase flash\:&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;n&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Pass in the file to load from flash, for me it's either &quot;new&quot; or &quot;def&quot;.</span><br />
proc configure_replace <span style="color: #7a0874; font-weight: bold;">&#123;</span>config router<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;configure_replace&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; global spawn_telnet<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> spawn_id <span style="color: #007800;">$spawn_telnet</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># This gets the router/switch to a known configuration that can reach the ftp server.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;configure replace flash\:<span style="color: #007800;">$config</span><span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#configure replace flash:default</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#This will apply all necessary additions and deletions</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#to replace the current running configuration with the</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#contents of the specified configuration file, which is</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#assumed to be a complete configuration, not a partial</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#configuration. Enter Y if you are sure you want to proceed. ? [no]: </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;(.*)(no)(.*)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;y<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">5</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
proc copy_tftp <span style="color: #7a0874; font-weight: bold;">&#123;</span>lab router<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;copy_tftp&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; global spawn_telnet<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">set</span> spawn_id <span style="color: #007800;">$spawn_telnet</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#R1#copy tftp://192.168.1.234/R1.txt flash:new</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>\#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;copy tftp://192.168.1.234/VOL-1/<span style="color: #007800;">$lab</span>/INITIAL/<span style="color: #007800;">$router</span>.txt flash:new<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Destination filename [new]? </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;Destination filename&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Erase flash: before copying? [confirm]n </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#OR </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Do you want to over write? [confirm]y</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#expect -re {</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &quot;(.*)(before copying)(.*)&quot; {send &quot;n\r&quot;}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># &nbsp; &nbsp; &nbsp; &quot;(.*)(over.write)(.*)&quot; {send &quot;y\r&quot;}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#}</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Do you want to over write? [confirm]</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;.*Do you want to over write.*&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;y<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#If it was over write above, now it might ask for erase flash or </span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#return the router prompt.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Erase flash: before copying? [confirm]</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #660033;">-re</span> <span style="color: #ff0000;">&quot;Erase flash&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;n<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Loading R1.txt from 192.168.1.234 (via FastEthernet0/0): !</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#[OK - 902 bytes]</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#Verifying checksum... &nbsp;OK (0xFBC4)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#902 bytes copied in 0.232 secs (3888 bytes/sec)</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#R1#</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; expect <span style="color: #ff0000;">&quot;<span style="color: #007800;">$router</span>#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;">## Main</span><br />
<span style="color: #666666; font-style: italic;">#</span><br />
<span style="color: #666666; font-style: italic;"># Oh the irony. &nbsp;If only I had known how many problems calling my &quot;default&quot; </span><br />
<span style="color: #666666; font-style: italic;"># configuration flash:default would cause me. &nbsp;As a result I changed it to def.</span><br />
<span style="color: #666666; font-style: italic;"># However instead of a nice switch statement I'm using an if block, default is a </span><br />
<span style="color: #666666; font-style: italic;"># reserved word in Tcl switch statements. &nbsp;I did not take the time to go back and</span><br />
<span style="color: #666666; font-style: italic;"># change it.</span><br />
puts <span style="color: #ff0000;">&quot;router <span style="color: #007800;">$router</span>&quot;</span><br />
puts <span style="color: #ff0000;">&quot;lab <span style="color: #007800;">$lab</span>&quot;</span><br />
puts <span style="color: #ff0000;">&quot;config <span style="color: #007800;">$config</span>&quot;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> string compare <span style="color: #007800;">$config</span> tftp <span style="color: #7a0874; font-weight: bold;">&#93;</span> == <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> &nbsp;<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">login</span> <span style="color: #007800;">$router</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; copy_tftp <span style="color: #007800;">$lab</span> <span style="color: #007800;">$router</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span> elseif <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> string compare <span style="color: #007800;">$config</span> new <span style="color: #7a0874; font-weight: bold;">&#93;</span> == <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> &nbsp;<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">login</span> <span style="color: #007800;">$router</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; configure_replace new <span style="color: #007800;">$router</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span> elseif <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> string compare <span style="color: #007800;">$config</span> def <span style="color: #7a0874; font-weight: bold;">&#93;</span> == <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">login</span> <span style="color: #007800;">$router</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; save_config <span style="color: #007800;">$router</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; configure_replace def <span style="color: #007800;">$router</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">else</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;tlue router lab \[def new tftp\]&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;Example:&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;tlue R1 LAB-1 def&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;default saves the running-config to flash:new and runs configure replace:flash:default&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;tftp loads the correct configuration for the lab from the tftp server as flash:new&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; puts <span style="color: #ff0000;">&quot;new runs configure replace flash:new, replacing the running config with new&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">exit</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2063</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TestLab Scripts</title>
		<link>http://www.chainringcircus.org/?p=2057</link>
		<comments>http://www.chainringcircus.org/?p=2057#comments</comments>
		<pubDate>Fri, 18 Jun 2010 14:42:47 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2057</guid>
		<description><![CDATA[I wrote a couple of scripts for the testlab this week and figured I would share them. You can download them here. These could be modified for a GNS3 lab setup easily as well. Not wanting to reinvent the wheel I googled around and started hacking another script. It started off with something like this: [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a couple of scripts for the testlab this week and figured I would share them.  You can download them <a href="http://chainringcircus.org/files/TestLabScripts.tar">here</a>.  These could be modified for a GNS3 lab setup easily as well.  Not wanting to reinvent the wheel I googled around and started hacking another script.  It started off with something like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #666666; font-style: italic;"># Usage: $0 [command]</span><br />
pgrep <span style="color: #660033;">-u</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$USER</span>&quot;</span> gnome-terminal <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-qvx</span> <span style="color: #ff0000;">&quot;$$&quot;</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$?&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #007800;">WID</span>=<span style="color: #000000; font-weight: bold;">`</span>xdotool search <span style="color: #660033;">--class</span> <span style="color: #ff0000;">&quot;gnome-terminal&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">head</span> -<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span><br />
&nbsp; xdotool windowactivate <span style="color: #007800;">$WID</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">#xdotool key ctrl+shift+t</span><br />
&nbsp; xdotool key ctrl+t</div></div>
<p>But gnome-terminal sets the environmental variable WINDOWID so I began by changing it to:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/sh</span><br />
<span style="color: #666666; font-style: italic;"># Usage: $0 [command]</span><br />
<br />
xdotool windowactivate <span style="color: #007800;">$WINDOWID</span><br />
xdotool key ctrl+t</div></div>
<p>But then I read the gnome-terminal manpage to see what other environmental variables it set and decided all the xdotool commands were too much for what I needed.  So I simplified into two main scripts, one to handle the gnome-terminal interactions and one to handle the router interactions.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;"># 2010-06-14 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># tlr</span><br />
<span style="color: #666666; font-style: italic;"># This script opens a single gnome-terminal tab and log into a router in </span><br />
<span style="color: #666666; font-style: italic;"># the testlab.</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Usage: <span style="color: #007800;">${0}</span> router_id<span style="color: #000099; font-weight: bold;">\n</span> tlr R1<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
gnome-terminal <span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle <span style="color: #007800;">${1}</span>&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${1}</span>&quot;</span></div></div>
<p>The expect script to handle the interaction with the 2511-RJ getting logged into the router.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/usr/bin/expect</span><br />
<span style="color: #666666; font-style: italic;"># 2010-06-14 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># tle</span><br />
<span style="color: #666666; font-style: italic;"># A short script to handle logging into a router in the lab.</span><br />
<br />
<span style="color: #000000; font-weight: bold;">set</span> host <span style="color: #ff0000;">&quot;testlab.chainringcircus.org&quot;</span><br />
<span style="color: #000000; font-weight: bold;">set</span> pass <span style="color: #ff0000;">&quot;CHANGEME&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;">##############################</span><br />
<span style="color: #666666; font-style: italic;"># Should not need any more changes.</span><br />
<span style="color: #000000; font-weight: bold;">set</span> router <span style="color: #7a0874; font-weight: bold;">&#91;</span>lindex <span style="color: #007800;">$argv</span> <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<br />
spawn telnet <span style="color: #007800;">$host</span><br />
expect <span style="color: #ff0000;">&quot;Password:&quot;</span><br />
send <span style="color: #ff0000;">&quot;<span style="color: #007800;">$pass</span><span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
expect <span style="color: #ff0000;">&quot;testlab&gt;&quot;</span><br />
send <span style="color: #ff0000;">&quot;telnet <span style="color: #007800;">$router</span><span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span><br />
send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span><br />
send <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\r</span>&quot;</span><br />
interact<br />
<span style="color: #7a0874; font-weight: bold;">exit</span></div></div>
<p>And finally the script that logs into every router in the lab, renaming the tab title to match the router name.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<span style="color: #666666; font-style: italic;"># 2010-06-14 Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;"># tl</span><br />
<span style="color: #666666; font-style: italic;"># This script fires up gnome-terminal with a bunch of tabs each executing</span><br />
<span style="color: #666666; font-style: italic;"># the tle script and naming the tab with the router name.</span><br />
<br />
gnome-terminal <span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R1&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R1&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R2&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R2&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R3&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R3&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R4&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R4&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R5&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R5&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R6&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R6&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R7&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R7&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R8&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R8&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle R9&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;R9&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle Cat1&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;Cat1&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle Cat2&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;Cat2&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle Cat3&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;Cat3&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle Cat4&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;Cat4&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle BB1&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;BB1&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle BB2&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;BB2&quot;</span> \<br />
<span style="color: #660033;">--tab</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;tle BB3&quot;</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">&quot;BB3&quot;</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2057</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>IPv6 Troubleshooting</title>
		<link>http://www.chainringcircus.org/?p=1986</link>
		<comments>http://www.chainringcircus.org/?p=1986#comments</comments>
		<pubDate>Sun, 30 May 2010 21:58:00 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[CCNP TSHOOT]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=1986</guid>
		<description><![CDATA[IPV6 Addressing &#8226; 128 bit addresses. &#8226; Simplified header with fewer fields; IPv4 has 12 fields, IPv6 has 5 fields; &#8226; No checksum in the header. This results in more efficient process because in IPv4 the TTL is decremented at each hop, the checksum had to be recalculated at each hop, that is not the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>IPV6 Addressing</strong><br />
&bull; 128 bit addresses.<br />
&bull; Simplified header with fewer fields; IPv4 has 12 fields, IPv6 has 5 fields;<br />
&bull; No checksum in the header.  This results in more efficient process because in IPv4 the TTL is decremented at each hop, the checksum had to be recalculated at each hop, that is not the case with IPv6.<br />
&bull; No packet fragmentation done by the router, instead an ICMP &#8220;packet too big&#8221; message is sent to the client.  Fragmentation information has been moved to an extension header.</p>
<p><strong>Types of IPv6 Addresses</strong><br />
&bull; Unicast &#8212; Send to one interface.<br />
&bull; Multicast &#8212; Send to many hosts in a group in the FF00::/8 address range.<br />
&bull; Anycast &#8212; Send to the nearest host in a group.</p>
<p><strong>Abbreviate IPv6 Addresses</strong><br />
&bull; Leading zeros in a field can be omitted.<br />
&bull; Contiguous fields containing zeros can be abbreviated with &#8220;::&#8221;.<br />
&bull; eui-64 addresses use the MAC address for the lower 64 bits of an IPv6 address.  The MAC address is split in half and FFFE is placed between the two halves to make the 48 bit MAC into 64 bits, universal/local (U/L) flag (bit 7) in the OUI portion of the address is flipped as well.</p>
<p><strong>Troubleshoot IPv6</strong><br />
sh ipv6 int &#8212; Validates the IPv6 and status of interfaces.<br />
sh ipv6 routers &#8212; Displays IPv6 router advertisements.<br />
sh ipv6 route &#8212; Shows the routing table. DUH.<br />
sh ipv6 protocols &#8212; Shows parameters and state of the active IPv6 protocols.<br />
debug ipv6 nd &#8212; Debug IPv6 neighbor discovery.<br />
debug ipv6 routing &#8212; Display debugging messages for IPv6 routing table and route cache updates.<br />
debug ipv6 packet &#8212; Displays the debugging messages for IPv6 packets.</p>
<p><strong>IPv6 Configuration</strong><br />
ipv6 cef<br />
ipv6 unicast-routing<br />
ipv6 address xxxx::xxxx/xxx</p>
<p><strong>OSPFv3</strong><br />
<strong>Configure OSPFv3</strong><br />
ipv6 router ospf 6<br />
 router-id 10.1.1.10<br />
 log-adjacency-changes</p>
<p>interface Tunnel0<br />
 no ip address<br />
 ipv6 address 2026::34:2/122<br />
 ipv6 ospf 6 area 34</p>
<p><strong>Troubleshoot OSPFv3</strong><br />
sh ipv ospf neigh<br />
sh ipv ospf<br />
sh ipv ospf int</p>
<p><strong>sh ipv ospf neigh</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv osp neigh<br />
<br />
Neighbor ID &nbsp; &nbsp; Pri &nbsp; State &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Dead Time &nbsp; Interface ID &nbsp; &nbsp;Interface<br />
10.1.1.9 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; FULL/ &nbsp;- &nbsp; &nbsp; &nbsp; &nbsp;00:00:35 &nbsp; &nbsp;14 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Tunnel0</div></div>
<p><strong>sh ipv ospf </strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv ospf <br />
&nbsp;Routing Process &quot;ospfv3 6&quot; with ID 10.1.1.10<br />
&nbsp;SPF schedule delay 5 secs, Hold time between two SPFs 10 secs<br />
&nbsp;Minimum LSA interval 5 secs. Minimum LSA arrival 1 secs<br />
&nbsp;LSA group pacing timer 240 secs<br />
&nbsp;Interface flood pacing timer 33 msecs<br />
&nbsp;Retransmission pacing timer 66 msecs<br />
&nbsp;Number of external LSA 0. Checksum Sum 0x000000<br />
&nbsp;Number of areas in this router is 1. 1 normal 0 stub 0 nssa<br />
&nbsp;Reference bandwidth unit is 100 mbps<br />
&nbsp; &nbsp; Area 34<br />
&nbsp; &nbsp; Number of interfaces in this area is 1<br />
&nbsp; &nbsp; SPF algorithm executed 3 times<br />
&nbsp; &nbsp; Number of LSA 8. Checksum Sum 0x03A4B8<br />
&nbsp; &nbsp; Number of DCbitless LSA 0<br />
&nbsp; &nbsp; Number of indication LSA 0<br />
&nbsp; &nbsp; Number of DoNotAge LSA 0<br />
&nbsp; &nbsp; Flood list length 0</div></div>
<p><strong>sh ipv ospf int</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv ospf int<br />
Tunnel0 is up, line protocol is up <br />
&nbsp; Link Local Address FE80::A01:10A, Interface ID 11<br />
&nbsp; Area 34, Process ID 6, Instance ID 0, Router ID 10.1.1.10<br />
&nbsp; Network Type POINT_TO_POINT, Cost: 11111<br />
&nbsp; Transmit Delay is 1 sec, State POINT_TO_POINT,<br />
&nbsp; Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5<br />
&nbsp; &nbsp; Hello due in 00:00:04<br />
&nbsp; Index 1/1/1, flood queue length 0<br />
&nbsp; Next 0x0(0)/0x0(0)/0x0(0)<br />
&nbsp; Last flood scan length is 1, maximum is 3<br />
&nbsp; Last flood scan time is 0 msec, maximum is 0 msec<br />
&nbsp; Neighbor Count is 1, Adjacent neighbor count is 1 <br />
&nbsp; &nbsp; Adjacent with neighbor 10.1.1.9<br />
&nbsp; Suppress hello for 0 neighbor(s)</div></div>
<p><strong>RIPng</strong><br />
&bull; IPv6 multicast address FF02::9 is the destination address for RIPng update messages.<br />
&bull; Link-local addresses used for next-hop addresses<br />
&bull; Metric is hop count and 15 is still the maximum, 16 is unreachable.<br />
&bull; Distance-vector</p>
<p><strong>Configure RIPng</strong><br />
To set up a 3560 switch for IPv6 you must first configure the <a href="http://www.cisco.com/en/US/customer/docs/switches/lan/catalyst3560/software/release/12.2_40_se/configuration/guide/swsdm.html#wpxref88774">switch database management (SDM)</a> template to one that supprts IPV6.  The rest of the configuration is the same on a router and a layer 3 switch.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">DSW1(config)#sdm prefer dual-ipv4-and-ipv6 routing<br />
DSW1(config)#^Z<br />
DSW1#wri mem<br />
DSW1#reload<br />
DSW1(config)#ipv6 cef<br />
DSW1(config)#ipv6 unicast-routing <br />
DSW1(config)#ipv6 router rip RIP_ZONE<br />
DSW1(config-rtr)#int fa0/1<br />
DSW1(config-if)#ipv6 address 2026::2:2/122<br />
DSW1(config-if)#ipv6 rip RIP_ZONE enable</div></div>
<p><strong>Troubleshoot RIPng</strong><br />
sh ipv6 protocols &#8212; What protocols are running on what interfaces.<br />
sh ipv6 rip RIP_ZONE &#8212; Show general RIPng information concerning the specific RIP_ZONE.<br />
sh ipv6 rip database &#8212; Shows the routes in the RIB.<br />
sh ipv6 rip next-hops &#8212; Next hops out of this router as seen by RIPng.</p>
<p><strong>sh ipv6 protocols</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv6 protocols <br />
IPv6 Routing Protocol is &quot;connected&quot;<br />
IPv6 Routing Protocol is &quot;static&quot;<br />
IPv6 Routing Protocol is &quot;ospf 6&quot;<br />
&nbsp; Interfaces (Area 34):<br />
&nbsp; &nbsp; Tunnel0<br />
&nbsp; Redistribution:<br />
&nbsp; &nbsp; None<br />
IPv6 Routing Protocol is &quot;rip RIP_ZONE&quot;<br />
&nbsp; Interfaces:<br />
&nbsp; &nbsp; FastEthernet0/1<br />
&nbsp; &nbsp; FastEthernet0/0<br />
&nbsp; Redistribution:<br />
&nbsp; &nbsp; Redistributing protocol ospf 6 with metric 5</div></div>
<p><strong>sh ipv6 rip RIP_ZONE</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv6 rip RIP_ZONE<br />
RIP process &quot;RIP_ZONE&quot;, port 521, multicast-group FF02::9, pid 195<br />
&nbsp; &nbsp; &nbsp;Administrative distance is 120. Maximum paths is 16<br />
&nbsp; &nbsp; &nbsp;Updates every 30 seconds, expire after 180<br />
&nbsp; &nbsp; &nbsp;Holddown lasts 0 seconds, garbage collect after 120<br />
&nbsp; &nbsp; &nbsp;Split horizon is on; poison reverse is off<br />
&nbsp; &nbsp; &nbsp;Default routes are not generated<br />
&nbsp; &nbsp; &nbsp;Periodic updates 15471, trigger updates 7<br />
&nbsp; Interfaces:<br />
&nbsp; &nbsp; FastEthernet0/1<br />
&nbsp; &nbsp; FastEthernet0/0<br />
&nbsp; Redistribution:<br />
&nbsp; &nbsp; Redistributing protocol ospf 6 with metric 5</div></div>
<p><strong>sh ipv6 rip database</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">R4#sh ipv6 rip database <br />
RIP process &quot;RIP_ZONE&quot;, local RIB<br />
&nbsp;2026::2:0/122, metric 2<br />
&nbsp; &nbsp; &nbsp;FastEthernet0/0/FE80::212:D9FF:FEA5:1541, expires in 166 secs<br />
<br />
&lt;strong&gt;sh ipv6 rip next-hops&lt;/strong&gt;<br />
&lt;code&gt; &nbsp; &nbsp; <br />
R4#sh ipv6 rip next-hops <br />
&nbsp;RIP process &quot;RIP_ZONE&quot;, Next Hops<br />
&nbsp; FE80::212:D9FF:FEA5:1541/FastEthernet0/0 [1 paths]</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=1986</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The rest of the story.</title>
		<link>http://www.chainringcircus.org/?p=2038</link>
		<comments>http://www.chainringcircus.org/?p=2038#comments</comments>
		<pubDate>Sun, 30 May 2010 21:08:39 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2038</guid>
		<description><![CDATA[In short, I returned my e-book to Narbik. I would recommend Micronicstraining to anyone. In fact I am now even more likely to go to Narbik&#8217;s class then I was before this incident. The long version. Later that day I called Micronicstraining to discuss my misgivings with them and actually spoke with Narbik. He was [...]]]></description>
			<content:encoded><![CDATA[<p>In short, I returned my e-book to Narbik.  I would recommend Micronicstraining to anyone.  In fact I am now even more likely to go to Narbik&#8217;s class then I was before this incident.</p>
<p><strong>The long version.</strong><br />
Later that day I called Micronicstraining to discuss my misgivings with them and actually spoke with Narbik.  He was very helpful and understood my concerns saying that there would be no problem giving me licenses for more than one computer.  With that I got off the phone placated to some extent.  I tried to install LockLizard onto Wine and figured I would just deal with the inconvenience.  But the installation onto Wine failed and I did not install LockLizard on Windows nor did I try to open the e-book.  I didn&#8217;t even unrar the files.</p>
<p>That night I tossed and turned, woke up in the middle of the night and pondered my predicament.  I figured I had nothing to loose by asking for my money back.  That next morning I sent an email to Narbik explaining my dilemma.  It is below.</p>
<blockquote><p>
Sir,</p>
<p>Regretfully I am writing to you to request a refund.  I have not<br />
activated my LockLizard license and am requesting that you have it<br />
deactivated.</p>
<p>I would like to thank you for taking the time with me on the phone<br />
yesterday.  I had fewer misgivings concerning the number of computers<br />
I would be allowed to study on after our conversation, however, I have<br />
developed a study routine over the past 18 months and shoehorning<br />
Windows into that process would not be beneficial at this time.  I do<br />
realize the lab PC runs Windows but I had already decided the last few<br />
months of lab practice would be done in a Windows environment, not the<br />
core of my studies.</p>
<p>I am truly disappointed.  I downloaded the free workbook and have done<br />
a number of labs from it.  Because of that previous experience with<br />
Micronics I did not expect the type of copy protection used in the<br />
workbook as there is no mention of LockLizard on the Micronics<br />
website.  Over the past few months I have frequently visited the table<br />
of contents for your workbook to map out my studies.  My work<br />
environment is based upon Linux, I do not have a Windows PC at home,<br />
and I would be forced to change my study process in order to use the<br />
workbook.</p>
<p>If you decide to change your copy protection to something more along<br />
the lines of O&#8217;Reilly Media or Internetwork Expert please contact me,<br />
I will be the first to purchase your workbook in a more portable<br />
format.  If you need to speak with me directly, my office phone number<br />
is (xxx) xxx-xxxx and my cell phone number is (xxx) xxx-xxxx.</p>
<p>Sincerely,</p>
<p>Jud Bishop
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2038</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I feel like I got ripped off.</title>
		<link>http://www.chainringcircus.org/?p=2027</link>
		<comments>http://www.chainringcircus.org/?p=2027#comments</comments>
		<pubDate>Tue, 25 May 2010 14:50:38 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Musings]]></category>
		<category><![CDATA[Routing]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2027</guid>
		<description><![CDATA[Yesterday I ordered the Advanced CCIE Routing &#038; Switching 2.0 Work Book from Narbik and figured I would share my experience. If you have read my post on the TSHOOT book you have an understanding of my disdain for DRM and the reasons for it. It boils down to the fact that I use Linux [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday I ordered the <a href="http://www.micronicstraining.com/classes/index.php?dispatch=products.view&#038;product_id=29816">Advanced CCIE Routing &#038; Switching 2.0 Work Book</a> from Narbik and figured I would share my experience.</p>
<p>If you have read my post on the <a href="http://www.chainringcircus.org/?p=1188">TSHOOT</a> book you have an understanding of my disdain for DRM and the reasons for it.  It boils down to the fact that I use Linux as my primary environment at work and home, we don&#8217;t even have a Windows PC at home, and most of the DRM out there <em>requires</em> Windows.  So then I have to load whatever I need on my work laptop, but if I am studying at home I have to make sure I bring my laptop home.</p>
<p>Imagine my disappointment when I got the following email from Micronics after I spent $350 on an e-book.  I could not find anything on the Micronics website that says the DRM is this draconian.</p>
<p>If you follow the link inside the quote, it says you must use either Windows or a Mac.  I am going to say this again, get <a href="http://safaribooksonline.com">SafariBooksOnline</a>, O&#8217;Reilly is a company that understands technical people and caters to them.  I am sure that Narbik is a great teacher and I hope these books are as good as they say, otherwise I will <em>know</em> I got ripped off.</p>
<blockquote><p>
Dear Student,</p>
<p>You will receive three separate emails.<br />
1. Locklizard License<br />
2. Vol. I &#038; II<br />
3. Vol. III</p>
<p>Since you will have only one license, choose a PC or Laptop that your Secured File will reside.</p>
<p>Please follow these procedures before you open the attached file:<br />
1.      First you need to open, Download and Install Lizard Safeguard Secure PDF Viewer Email (sometimes this email is considered a SPAM and if you have Gmail it goes to &#8220;7 or More&#8221; section of your Gmail). </p>
<p>2.     Once you completed this step, you need to scroll down the page and double click on the .llv file and download.</p>
<p>3.       After installing your PDF Viewer, open the Secured PDF Files that you have received as an attachment.</p>
<p> You can check the operating systems requirement on the following link:</p>
<p>http://www.locklizard.com/LockLizard_Secure_PDF_Viewer_v25.pdf</p>
<p>If you have difficulty opening your files you contact me as soon as possible so we can walk you through this process.</p>
<p>Thank you for your business &#8211; we appreciate it very much.</p>
<p>Janet Kocharians<br />
Director of Marketing &#038; Sales<br />
Micronics Inc.<br />
Mobile: (818) 331-2419<br />
Fax: (818) 249-8388
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2027</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Integrate McKesson MSE into AD</title>
		<link>http://www.chainringcircus.org/?p=2018</link>
		<comments>http://www.chainringcircus.org/?p=2018#comments</comments>
		<pubDate>Tue, 25 May 2010 00:23:28 +0000</pubDate>
		<dc:creator>jud</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.chainringcircus.org/?p=2018</guid>
		<description><![CDATA[I use the term hacking in the classic sense, not in the cracker sense. We moved one of our enterprise electronic medical records (EMR) from AIX to Linux over the last few weeks. Go-live was last Thursday night, and I would like to take the time to discuss one of the more interesting hacks we [...]]]></description>
			<content:encoded><![CDATA[<p><em>I use the term hacking in the classic sense, not in the cracker sense.</em></p>
<p>We moved one of our enterprise electronic medical records (EMR) from AIX to Linux over the last few weeks.  Go-live was last Thursday night, and I would like to take the time to discuss one of the more interesting hacks we did.  It was a long project with some interesting puzzles but this was the most interesting to me.</p>
<p>We were told that you cannot integrate Star/MSE into active directory.  As far as I was concerned that was throwing down the gauntlet of a challenge to make it work.  We have had our fair share of problems with Samba and AD over the years so my boss was pushing to use <a href="http://www.likewise.com">Likewise</a> rather than pure Samba.  We have split infrastructure, most of the virtual servers use Likewise because my boss set them up, whereas all of the pure Linux servers use Samba because I set them up.  It boiled down to my boss can hack around Likewise and I am more comfortable hacking Samba.  I talked him into Samba so I <em>had</em> to make it work.  My boss had hacked Likewise to do something similar so we discussed it and the resulting code is below.</p>
<p>For those who use Star/MSE you probably understand the login process, however, for those who don&#8217;t let me explain.  Every user who gets a GUI interface on a Star server shares the same home directory under a restricted korn shell.  We have about 1,500 users that all share one home directory but it doesn&#8217;t matter because the .profile just fires off a GUI program.  In a typical setup all of the users are in the hbo group and in the password file their home points to /home/mse.  </p>
<p>We configured winbind to use the system files first, then AD.  This is so that we could have an orderly move from system authentication to AD authentication.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># cat /etc/nsswitch.conf | grep winbind<br />
passwd: &nbsp; &nbsp; files winbind<br />
shadow: &nbsp; &nbsp; files winbind<br />
group: &nbsp; &nbsp; &nbsp;files winbind</div></div>
<p>In AD we made two groups, hbo to map to the Linux hbo group and a nomse group.  Then we forced every AD user into /home/mse directory upon login with the following configuration in /etc/samba/smb.conf.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">template shell = /bin/rksh<br />
template homedir = /home/mse<br />
winbind use default domain = true<br />
obey pam restrictions = yes</div></div>
<p>The point of the nomse group is to be able to pick out the users who should not have the GUI fired off upon login.  Even though the group numbers do not match and they are not group mapped with the <em>net groupmap</em> command it doesn&#8217;t matter.  The trick here is that I am looking for group names in the .profile rather than gids.  Below is a portion of the .profile, I would include more but I am not sure of the copyright and it is not pertinent to the discussion.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">## 2010-05-19 &nbsp;Jud Bishop</span><br />
<span style="color: #666666; font-style: italic;">## This is for Active Directory integration of MSE.</span><br />
<span style="color: #666666; font-style: italic;">## DO NOT CHANGE THIS PORTION OF THE FILE OR USERS WILL NOT BE ABLE TO LOGIN.</span><br />
<br />
<span style="color: #007800;">USER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">whoami</span><span style="color: #000000; font-weight: bold;">`</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> I <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">groups</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span> \: <span style="color: #660033;">-f</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$I</span>&quot;</span> = <span style="color: #ff0000;">&quot;nomse&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HOME</span>=<span style="color: #ff0000;">&quot;/home/AD/<span style="color: #007800;">$USER</span>&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">SHELL</span>=<span style="color: #ff0000;">&quot;/bin/bash&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># The MSEFLAG used to be set below, it is now set here for AD integration.</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">MSEFLAG</span>=NO<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># This break is crucial because it exits out with the correct $HOME</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">break</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">HOME</span>=<span style="color: #ff0000;">&quot;/home/mse&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007800;">MSEFLAG</span>=YES<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Setting home directory to <span style="color: #007800;">$HOME</span>&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$HOME</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.chainringcircus.org/?feed=rss2&amp;p=2018</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
