Strict Standards: Redefining already defined constructor for class wpdb in /var/www/myfoto.se/jbits.se/blog/wp-includes/wp-db.php on line 56

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 384

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 560

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 684

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-content/plugins/code-highlighter/codehighlighter.php on line 42

Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line 82
jbits.se <br /> <b>Deprecated</b>: preg_replace() [<a href='http://php.net/manual/en/function.preg-replace'>function.preg-replace</a>]: The /e modifier is deprecated, use preg_replace_callback instead in <b>/var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php</b> on line <b>82</b><br /> » Cisco

jbits.se

Jörgen Björkmans blog

Archive for the ‘
Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line 82
Cisco’ Category

Feb
27

Cisco ASA Packet Capture

Posted by jbjorkman on February 27, 2011 under Cisco

Start capture of everything on interface outside:
#capture CAPFILE interface outside packet-length 1500 buffer 8192

Start capture on interface outside using access-list (define access-list first):
#capture CAPFILE interface outside packet-length 1500 access-list 345 buffer 8192

Stop capture
# no capture CAPFILE interface outside
Fire up a browser and go to the following URL to fetch your capture (Other protocols can be used too):
https://ASA-IP/capture/CAPFILE/pcap

Clean up
# no capture MYCAP

Jan
27

Cisco icmp route-map failover

Posted by jbjorkman on January 27, 2011 under Cisco

ip route 1.1.1.1 255.255.255.255 192.168.0.2
ip route 2.2.2.2 255.255.255.255 192.168.0.3

track 101 rtr 1 reachability
track 102 rtr 2 reachability

interface vlan1
ip address 192.168.0.1 255.255.255.0
ip policy route-map failover

route-map failover permit 10
set ip next-hop verify-availability 192.168.107.2 10 track 101
set ip next-hop verify-availability 192.168.107.3 20 track 102

rtr 1
type echo protocol ipIcmpEcho 1.1.1.1
rtr schedule 1 life forever start-time now

rtr 2
type echo protocol ipIcmpEcho 2.2.2.2
rtr schedule 2 life forever start-time now

Jun
08

Get Log from Cisco device via SNMP

Posted by jbjorkman on June 8, 2010 under Cisco

I made this little script to be able to retrieve log data from any cisco device via snmp.
Unfortunately most devices seem to have a default setting that only keeps the last line in history, this can however be increased by entering: logging history [numlines] in config mode.
Our table is located in Cisco-SysLog-MIB and has the following OID: 1.3.6.1.4.1.9.9.41.1.2.3
The following steps must be taken to allow access to this Mib via WMI:

  • Install WMI SNMP Provider ( A Windows component )
  • Download the following mibfiles:
    CISCO-SYSLOG-MIB.mib
    CISCO-SMI.mib
    SNMP-FRAMEWORK-MIB.mib
    INET-ADDRESS-MIB.mib
  • Run the SNMP information module compiler smi2smir.exe (located in C:\WINDOWS\system32\wbem\snmp) to compile a mof from your mibfiles
    smi2smir.exe /g CISCO-SYSLOG-MIB.mib CISCO-SMI.mib SNMP-FRAMEWORK-MIB.mib INET-ADDRESS-MIB.mib > cisco-syslog-mib.mof
  • Run mofcomp.exe (located in C:\WINDOWS\system32\wbem) to install your newly created mof into the WMI repository:
    mofcomp.exe cisco-syslog-mib.mof

Finally, here's the script to make it all happen:

Option Explicit

Dim strSNMPCmnt, strSNMPTarget

Dim objWmiLocator, objWmiServices, objWmiNamedValueSet
Dim colLogTable, objLogEntry, strLogEntry

strSNMPCmnt="public"
strSNMPTarget="172.16.0.1"

Set objWmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWmiServices = objWmiLocator.ConnectServer("","root\snmp\localhost")
Set objWmiNamedValueSet = CreateObject("WbemScripting.SWbemNamedValueSet")

objWmiNamedValueSet.Add "AgentAddress", strSNMPTarget
objWmiNamedValueSet.Add "AgentReadCommunityName", strSNMPCmnt

Set colLogTable = objWmiServices.InstancesOf("SNMP_CISCO_SYSLOG_MIB_clogHistoryTable", , objWmiNamedValueSet)

For Each objLogEntry In colLogTable
with objLogEntry
strLogEntry=    "Facility:" & .clogHistFacility & vbCRLF & _
"Index:   " & .clogHistIndex & vbCRLF & _
"Severity: " & .clogHistSeverity & vbCRLF & _
"Timestamp: " & .clogHistTimestamp & vbCRLF & _
"MsgName: " & .clogHistMsgName & vbCRLF & vbCRLF & _
.clogHistMsgText
End with
WScript.Echo strLogEntry
next

Set colLogTable=Nothing
Set objWmiNamedValueSet=Nothing
Set objWmiServices=Nothing
Set objWmiLocator=Nothing

Apr
19

Cisco - List SNMP ifindexes

Posted by jbjorkman on April 19, 2010 under Cisco, Network

show snmp mib ifmib ifindex

http://www.cisco.com/en/US/docs/security/asa/asa80/configuration/guide/inspect.html#wp1478746

Nov
21

Cisco Stackwise - excerpts from whitepaper

Posted by jbjorkman on November 21, 2007 under Cisco

 Stack Creation and Modification
Stacks are created when individual switches are joined together with stacking cables. When the stack ports detect electromechanical activity, each port starts to transmit information about its switch. When the complete set of switches is known, the stack elects one of the members to be the master switch, which will be responsible for maintaining and updating configuration files, routing information, and other stack information. The entire stack will have a single IP address that will be used by all the switches.

Online Stack Adds and Removals
Switches can be added and deleted to a working stack without affecting stack performance. When a new switch is added, the master switch automatically configures the unit with the currently running Cisco IOS® Software image and configuration of the stack. The stack will gather information such as switching table information and update the MAC tables as new addresses are learned. The network manager does not have to do anything to bring up the switch before it is ready to operate. Similarly, switches can be removed from a working stack without any operational effect on the remaining switches. When the stack discovers that a series of ports is no longer present, it will update this information without affecting forwarding or routing.

Master Switch Election
The stack behaves as a single switching unit that is managed by a master switch elected from one of the member switches. The master switch automatically creates and updates all the switching and optional routing tables. Any member of the stack can become the master switch. Upon installation, or reboot of the entire stack, an election process occurs among the switches in the stack. There is a hierarchy of selection criteria for the election.

  1. User priority-The network manager can select a switch to be master.
  2. Hardware and software priority-This will default to the unit with the most extensive feature set. The Cisco Catalyst 3750 Advanced IP Services IPv6 (AIPv6) image has the highest priority, followed by Cisco Catalyst 3750 switches with Enhanced Multilayer Software Image (EMI) and then the Standard Multilayer Software Image (SMI) versions.
  3. Default configuration-If a switch has preexisting configuration information, it will take precedence over switches that have not been configured.
  4. Uptime-The switch that has been running the longest is selected.
  5. MAC address-Each switch reports its MAC address to all its neighbors for comparison. The switch with the lowest MAC address is selected.

Adding New Members
When the switching stack has established a master, any new switch added afterward automatically becomes a subordinate. All the current routing and addressing information is downloaded into the subordinate so that it can immediately begin transmitting traffic. Its ports become identified with the IP address of the master switch. Global information, such as QoS configuration settings, is downloaded into the new subordinate member.

Cisco IOS Software Images Must Be Identical
The Cisco StackWise technology requires that all units in the stack run the same release of Cisco IOS Software. When the stack is first built, it is recommended that all of the stack members have the same level of software - either all SMI, all EMI, or AIPv6. This is because later upgrades of Cisco IOS Software mandate that all the switches to be upgraded to the same version as the master.
Automatic Cisco IOS Software Upgrade/Downgrade from the Master Switch
When a new switch is added to an existing stack, the master switch communicates with the switch to determine if the Cisco IOS Software image is the same as the one on the stack. If it is the same, the master switch sends the stack configuration to the device and the ports are brought online. If the Cisco IOS Software image is not the same, one of three things will occur:

  1. If the hardware of the new switch is supported by the Cisco IOS Software image running on the stack, the master will by default download the Cisco IOS Software image in the master's Flash memory to the new switch, send down the stack configuration, and bring the switch online.
  2. If the hardware of the new switch is supported by the Cisco IOS Software image running on the stack and the user has configured a Trivial File Transfer Protocol (TFTP) server for Cisco IOS Software image downloads, then the master will automatically download the Cisco IOS Software image from the TFTP server to the new switch, configure it, then bring it online.
  3. If the hardware of the new switch is not supported by the Cisco IOS Software image running on the stack, the master will put the new switch into a suspended state, notify the user of a version incompatibility, and wait until the user upgrades the master to a Cisco IOS Software image that supports both types of hardware. The master will then upgrade the rest of the stack to this version, including the new switch, and bring the stack online.