Pages

7/14/2009

LOOKING GLASS
Example script to check several telnet route servers and create html file of AS-PATH


use Net::Telnet ();

my $outdir = "\\inetpub\\wwwroot\\look\\data";
my $idxdir = "\\inetpub\\wwwroot\\look";
my $url = "data";
mkdir ($idxdir);
mkdir ($outdir);
#list of public routers accepting telnet with no logon
my @list2 = (
"route-views.optus.net.au" ,
"route-server.videotron.net" ,
"route-server.ipilink.net" ,
"route-server.host.net" ,
"public-route-server.is.co.za" ,
"route-server-east.gt.ca" ,
"route-server-west.gt.ca" ,
"route-server.gt.ca" ,
"route-views.on.bb.telus.com" ,
"route-views.ab.bb.telus.com" ,
"routeserver.sunrise.ch" ,
"route-server.belwue.de" ,
"route-server.ip.tiscali.net" ,
"route-server.eu.gblx.net" ,
"route-server.cerf.net" ,
"route-server.gblx.net" ,
"route-server.host.net" ,
"route-server.he.net" ,
"route-server.twtelecom.net" ,
"public-route-server.is.co.za" ,
"route-server.central.allstream.com" ,
"route-server.east.allstream.com" ,
"route-server.west.allstream.com" ,
"route-server.vtl.net" ,
"route-server.eastlink.ca" ,
);

#date
my ($sec,$min,$hour,$mday,$mon,$year,
$wday,$yday,$isdst) = localtime time;
$year = $year+1900;
$mon = $mon+1;
$mon = sprintf("%02d", $mon);
$mday = sprintf("%02d", $mday);
$hour = sprintf("%02d", $hour);
$min = sprintf("%02d", $min);
my $date = "$mon\-$mday\-$year $hour:$min";

#Build report

my $file = "$outdir\\$year\-$mon\-$mday\-$hour$min.html";
open FIL , ">$file";

print FIL <<ENDHEADER;
<HTML>
<HEAD>
<TITLE>Looking Glass Results</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="300">
<META HTTP-EQUIV="Cache-Control" content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="Mon, 16 May 2005 13:59:00 GMT">
<style type="text/css">
H1 {font-family:serif; border-width: 0; border-bottom: solid; text-align: left}
H3 {font-family:serif; padding-top:0px;color:#000000;padding-bottom:0px;margin-bottom:0px;}
body {font-family:monospace;font-size:.75em;margin:3%;padding:0px;background:#aabbcc;color:#000000;}
</style>
</HEAD>

<BODY bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000">

<H1>AS-PATH to 4.4.4.0/24</H1>
<H4>$date</H4>
<HR>
ENDHEADER
;
#telnet to each router and query for info
foreach $router (@list2) {
print ".";
my (@result, $t);
print FIL "<H2>$router</H2>\n";
$t = new Net::Telnet (Timeout => 20, Errmode => "return");
$t->open("$router");

## Wait for prompt and enter command.
$t->waitfor('/>/') or print "X";
$t->print("show ip bgp 4.4.4.0/24");
($result) = $t->waitfor('/>/');

#Filter results for lines containing (AS) 32166
@result = split(/\n/, $result);
my $prev = "prior line\n";
print ".";
foreach $line (@result) {
if ($line eq $prev) {
next
};
if ($line =~ /32166/) {
push (@output, "$line<br>\n");
$prev = $line;
}
print ".";
}

print FIL "<p>@output</p>\n";
print FIL "<HR>\n";
@output="";
$result="";
@result="";
print ".";
}

print "\n";
print FIL <<ENDTAIL;
</TABLE>

</BODY>
</HTML>

ENDTAIL
;

close FIL;

#Build index of reports

open IDX , ">$idxdir\\look.html";

print IDX <<IDXHEADER;
<HTML>
<HEAD>
<TITLE>Looking Glass Results</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="300">
<META HTTP-EQUIV="Cache-Control" content="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="Mon, 16 May 2005 13:59:00 GMT">
<style type="text/css">
H1 {font-family:serif; border-width: 0; border-bottom: solid; text-align: left}
H3 {font-family:serif; padding-top:0px;color:#000000;padding-bottom:0px;margin-bottom:0px;}
body {font-family:monospace;font-size:.75em;margin:3%;padding:0px;background:#aabbcc;color:#000000;}
</style>
</HEAD>

<BODY bgcolor="#ffffff" text="#000000" link="#000000" vlink="#000000" alink="#000000">

<H1>INDEX</H1>
<H3>AS-PATH to 4.4.4.0/24</H3><BR>
IDXHEADER
;

my ($path, $file, @files, $file_full_path);
opendir (SOURCE, $outdir) or die "Cannot open the source folder for reading: $!\n";
my @sorted_files =
map $_->[1],
sort { $a->[0] <=> $b->[0] }
map -f "$outdir/$_" ? [ ( stat _ )[9], $_ ] : (),
readdir SOURCE;


closedir (SOURCE);
for (@sorted_files){
$file_full_path = "$url/$_";
print IDX qq(<a href="$file_full_path" target="_blank">$_</a>     \n);
} #end for






print IDX <<IDXTAIL;
</TABLE>

</BODY>
</HTML>

IDXTAIL
;

close IDX

NAT ORDER OF OPERATIONS


MRTG

CONFIG MAKER USING INTERFACE DESCRIPTIONS
perl cfgmaker -ifref=name -ifdesc=descr community@router > output.fil

SNMPv2 TO SUPPORT LARGE BANDWIDTH LINKS
interfaces 1Gb or greater:
add "::::2" to end of target line in CFG this asks to use SNMP v2 which supports a greater number of bits for the bandwidth field.
e.g.:
Target[10.1.1.4_Te1_4_1]: #Te1/4/1:community@10.1.1.4:::::2

PNGTITLE
Add a title inside the graphic using PNGTitle

Use this regex to add this line:

Find: SetEnv\[\(.*\)\]:.*MRTG_INT_IP="\(.*\)".*MRTG_INT_DESCR="\(.*\)".*\n
Replace: &PNGTitle[\1]: \2 - \3\n

6/17/2009

Cisco::VRF::Routing


Segregating WAN traffic to provide public internet access from a central location

We provide wireless internet in public areas in every office. For this purpose we provide cable internet, DSL, or dedicated T1 circuits. To save money and better control this traffic, we want to direct that traffic back through our headquarters' internet circuits. To do this we need a way to segregate this traffic on our WAN links for security and to keep it from overutilizing our WAN.
VRF and tunnels seems to be the answer.

Cisco Design Guide
Good Overview

Extranet::Sharepoint::Design


This will be an interesting project. putting an ISA server in a DMZ and pointing it to a front end Sharepoint sever.
Some good design links on technet:
IAG

DMZ Architecture

scaling

high availability

VMWare::Internals


Some of our VM's still have the little ".flat" file that points to the real .vmdk file. It is bad when that file goes away.


Free utility to rebuild the descriptor file:

http://www.phdvirtual.com/wrapgen