10/13/2008

Cisco::SNMP::IP Accounting


Gathering IP accounting information from a router via SNMP.
Cisco document with details about SNMP calls to gather MAC table and IP accounting tables from routers via SNMP.

Perl script to do this:



#!/usr/bin/perl
use SNMP_util;

$host = $ARGV[0];
chomp($host);
if ($host eq "") {
print "Host address (return = $defaultHost) ? ";
$host = <stdin>;
chomp($host);
}
if ($host eq "") { die "Usage: ipac [host address]\n"; }


print "Gathering data from $host . . .\n";

@accounting = snmpwalk ("public\@$host",".1.3.6.1.4.1.9.2.4.9");

my @src, @dest, $pkts, $bytes;

foreach $line (@accounting) {
($pre, $data) = split (/\:/, $line);
@mib = split(/\./, $pre);
if ($mib[1] eq "1") { push (@src, $data);}
elsif ($mib[1] eq "2") { push (@dest, $data);}
elsif ($mib[1] eq "3") { push (@pkts, $data);}
elsif ($mib[1] eq "4") { push (@bytes, $data);}
elsif ($mib[1] eq "5") { last;}
else { print "unrecognized data\n";}
}

my $index = 1;


open (OUT, ">", "output.html");
open (CSV, ">", "output.csv");

print OUT "<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\" /></head><body><table border=\"1\" bordercolor=\"black\">";
print OUT "<h2>$host IP Accounting</h2><a href=\"output\.csv\" target=\"_blank\">Open in Excel</a>";
print CSV "$host IP Accounting\n";
print OUT "<tr><th>Source</th><th>Destination</th><th>Bytes</th><th>Packets</th></tr>\n";
print CSV "Source,Destination,Bytes,Packets\n";

foreach $from (@src) {
print OUT "<tr><td>$src[$index]</td><td>$dest[$index]</td><td>$bytes[$index]</td><td>$pkts[$index]</td></tr>\n";
print CSV "$src[$index],$dest[$index],$bytes[$index],$pkts[$index]\n";
$index++;
}

print OUT "</table></body></html>\n";

close OUT;
close CSV;

`output.html`
#
#

Labels: , ,

4/18/2007

Cisco::Video Conferencing::QOS::VOIP



Quality of Service Design Overview

From the book: End-to-End QoS Network Design

Labels: , , , ,

1/29/2007

Cisco::Firewall::IOS



Cisco IOS firewall implementation guide.

PDF

Labels: , ,

1/18/2007

Multicast Routing


http://www.cymru.com/Documents/Cisco/multicast-router.txt


@(#)multicast routing howto 04 AUG 1997 Rob Thomas robt@cymru.com
How to setup a router to route multicast packets
Multicast is a UDP-based protocol which literally delivers packets from one
host to many. If abused, it can be made to deliver from many hosts to
many hosts to many hosts to many hosts... This is why it's important to
setup multicasting routing on the routers in a sane manner.
1. First, enable the global multicast routing parameter by:
!
ip multicast-routing
!
This can be disabled, if you so choose, by doing:
!
no ip multicast-routing
!
2. Next, select your style of multicasting. I chose PIM (Protocol-
Independent Multicast) for the following reasons:
- PIM works with all existing multicast routing protocols.
- PIM has two modes (dense & sparse) which gives me some freedom at
configuration time.
You could also choose from IGMP (Internet Group Management Protocol,
which is good for large WANs) or DVMRP (Distance Vector Multicast
Routing Protocol, which is slightly unsupported). However, be aware
that Cisco only tacitly supports DVMRP. To use DVMRP with a Cisco
router, you need to point your Cisco to a router that DOES support
DVMRP directly.
Of the two PIM choices, I went with dense mode. Here are the differences:
- Dense mode: When the router receives a multicast packet, the router
sends the packet out of all interfaces except for the interface from
whence the packet originated. If the router discovers that a certain
interface has no multicast recipients, it sends a "prune" message back
to the sender stating that there is no need to send messages to that
interface/subnet/link/host.
- Sparse mode: In sparse mode, it is assumed that no host wants multi-
cast packets unless the host specifically asks for it. So, instead
of the shotgun approach of dense mode, one router becomes the central
hub. This central hub logs all hosts that wish to receive multicast.
Further multicast packets are sent only to those hosts.
Seeing as how we only have two routers, I did not want one router to be
burdened with the list of multicast hosts (especially since practically
ALL of our hosts "want" multicast). Additionally, I did not want to
spend time fudging entries in the multicast recipient list.
So, to configure for PIM dense mode multicast routing:
!
interface ethernet 0
ip pim dense-mode
!
interface ethernet 1
ip pim dense-mode
!
Obviously, all involved routers should be speaking the same lingo. Thus,
routerA is configured the same as routerB.
3. Next, you need to set the multicast threshold. This is the BIG TRICK[tm]
to multicast routing. In a nutshell, every multicast packet has a TTL.
That's basic to all IP. By setting the multicast threshold on a given
router interface, you create a hurdle. If the packet's TTL is higher
than the multicast threshold, the packet may pass. If the packet's TTL
is LOWER than the multicast threshold, the packet is stopped (actually,
it is bounced with an ICMP message, but that's for another "howto" ;-).
This is how one prevents multicast packets from careening out into the
great 'Net. The range for multicast threshold is 0 to 255, with 0
meaning all packets may pass (well, *almost* all) and 255 meaning
virtually no packets may pass. On the routerB router, I set up the
multicast threshold at a comfortable 1 (because this is an internal
router). The multicast threshold on the interface leading to the
Internet on routerA should be set at 255 (if, in fact, multicast is
enabled on the interface at all).
!
interface ethernet 0
ip multicast-threshold 1
!
interface ethernet 1
ip multicast-threshold 1
!
And you're set!
4. It's probably a VERY good idea at this point to save your config. I
choose to save off to tftp (in case my NVRAM gets scrammed), but you
can choose your own danger here. At the least, you should copy your
running-config to your saved config.
router#copy running-config startup-config
Enjoy!
Questions/comments/bugs to: robt@cymru.com
Famous Unix quotes: "You are not expected to understand this."
-- From the original comments in the source code for Version 7's
process scheduling algorithm.
Rob Thomas, robt@cymru.com
http://www.enteract.com/~robt

Labels: ,

12/29/2006

Cisco::Tip::Reload in X



"reload in x" and "reload cancel"

When making configuration changes remotely that you think might disconnect you if you make a mistake, setup an automatic reboot in a few minutes, make the change, if you screw up and get disconnected, it will restart with the old config. After making a successful change, write the config and then cancel the restart.


The following example reloads the software on the router in 10 minutes:
Router# reload in 10

Router# Reload scheduled for 11:57:08 PDT Fri Apr 21 1996 (in 10 minutes)

Proceed with reload? [confirm]

The following example reloads the software on the router at 1:00 p.m. today:
Router# reload at 13:00

Router# Reload scheduled for 13:00:00 PDT Fri Apr 21 1996 (in 1 hour and 2 minutes)

Proceed with reload? [confirm]

The following example reloads the software on the router on April 20 at 2:00 a.m.:
Router# reload at 02:00 apr 20

Router# Reload scheduled for 02:00:00 PDT Sat Apr 20 1996 (in 38 hours and 9 minutes)

Proceed with reload? [confirm]

The following example cancels a pending reload:
Router# reload cancel

%Reload cancelled.

Labels: ,

4/07/2006

Cisco::6509::Supervisor Module Gigabit Interface



Supervisor modules for 6509 and 4507R switches have two SFP slots for gigabit interfaces. On a Cisco 4507R with redundant supervisor modules, only the first interface on each module is active. The second interface is inactive.

This does not happen on 6509 switches, according to:

Cisco Config Guide)


Note With Release 12.2(18)SXD and earlier releases, the two Gigabit Ethernet interfaces on a redundant Supervisor Engine 720 are always active.

Labels:

1/20/2006

12/16/2005

Cisco::VOIP::Delay establishing call


PROBLEM:
Sometimes it take 5-10 seconds for both parties of a call to hear each other.
This is because the RTP channel comes up after the source router receives a connect message from the destination router. The connect message is sent after the person being called picks up the phone.
FIX:
At the router, input the following:
ROUTER(config)#voice rtp send-recv

This will make all calls establish the voice path in both directions before a connect messagee is received from the dest switch.

Labels: , ,

Cisco::HyperTerminal::Cut & Paste


FIX for problem pasting a config using HyperTerminal

Pasting a configuration into an IOS device using Hyperterminal gets muddled maybe half way into the config. This is because HyperTerm sends the data too fast for the switch.

This can be fixed by adding a character delay in HyperTerminal:
File > Properties, Settings tab, click ASCII, add character delay of 5 ms

Labels: ,

9/13/2005

7/01/2005

Network::Cisco::IOS


I often want to look at how ports are configured on a switch, the descr, what vlan, etc.
"show run | include" type commands don't really help because the port config is on multiple lines.

The following are very useful, if only I could remember them:

show int status
show int summary

Labels: , ,