Pages

Monday, April 26, 2010

STP notes


  1. Root bridge selection: Lowest bridge id [unique bridge id + priority.
  2. Priority is considered first if tie happens then check MAC address]
  3. Select a least cost path from each bridge to root bridge.
  4. Any active port that is not a root port or a designated port is a blocked port.
  5. Tie breaker for root port: If a bridge has 2 candidate ports for root position, then the port connecting to the lowest bridge id (neighbor) will be selected as root port
  6. Tie breaker for designated port: If a bridge has 2 candidate ports for designated position, then the port connecting to the lowest bridge id (neighbor) will be selected as designated port; in case of tie, port connecting the bridge with lowest MAC address will be designated port.
  7. Tie breaker if two bridges are connected with more than one cable: In this case port with lowest port priority will be opted.
  8. STP uses multicast address 01:80:C2:00:00:00 for BPDU transmission.
  9. BPDU – 8 bytes length [2 bytes priority, 6 bytes MAC]
  10. BPDU exchange in every 2 seconds

    TCNs are injected into the network by a non-root switch and propagated to the root.
    Upon receipt of the TCN, the root switch will set a Topology Change flag in its normal BPDUs
  11. Three types of BPDU
  • Configuration BPDU [CBPDU]
  • Topology change notification [TCN]
  • Topology change notification acknowledgement [TCA]
.

Wednesday, April 7, 2010

Perl:: deleting log files older than 'N' days

#!/usr/bin/perl -w

use strict;

# Script to delete the files older than "N" days.

# The directory to be cleaned up.(e.g ' ' means current directory)

my $DIR='';

# The age of file to be deleted. (e.g if given 2, files older than two days will get deleted)

my $life=2;

# File format to be matched can be enhanced. formats are seperated by whitespace

foreach my $t (glob("$DIR*.pl_* $DIR*stc $DIR*tcl $DIR*topo"))

{

my $age =int(-M $t);

if($age > $life)

{

print "$t is " . $age . " days old. Hence deleting it...\n";

unlink $t;

}

}