marți, 31 martie 2015

[Cisco] Archive error

This feature was introduced into Cisco IOS Release 12.3(4), the Archive command enables the administrator to configure snapshots of the configuration files.[inspiration here]

On a 3750 Switch, I bumped into the following error:

%ARCHIVE_CONFIG-4-ARCHIVE_SKIPPED: Archive of router configuration was skipped due to a previous initiation.

I also tried to save a copy on the switch, but still, the archive didn't worked:

BEFORE:
switch#show archive
The maximum archive configurations allowed is 14.
There are currently 1 archive configurations saved.
The next archive file will be named flash:/ARCHIVE-<timestamp>-1
 Archive #  Name
   1        flash:/ARCHIVE-Mar--1-02-01-51.358-EET-0 <- Most Recent
   2        
   3        
   4        
   5        
   6        
   7        
   8        
   9        
   10       
switch# archive config
Mar 31 11:55:23.016 EET: %ARCHIVE_CONFIG-4-ARCHIVE_SKIPPED: Archive of router configuration was skipped due to a previous initiation.


AFTER: (the same result)
switch#show archive   
The maximum archive configurations allowed is 14.
There are currently 1 archive configurations saved.
The next archive file will be named flash:/ARCHIVE-<timestamp>-1
 Archive #  Name
   1        flash:/ARCHIVE-Mar--1-02-01-51.358-EET-0 <- Most Recent
   2        
   3        
   4        
   5        
   6        
   7        
   8        
   9        
   10       



There seems to be 2 workarounds: one that solves the problem after a reboot, but you can figure out on your own that reloading a production device in the middle of the day is not exactly dream hack.

The second one assumes to erase and reconfigure the archive configuration, and so I did. And IT WORKS. You can see the results bellow:

switch(config)#no archiveswitch(config)#archive
switch(config-archive)# log config
switch(config-archive-log-cfg)#  logging enable
switch(config-archive-log-cfg)#  logging size 500
switch(config-archive-log-cfg)#  hidekeys
switch(config-archive)# path flash:ARCHIVE/
switch(config-archive)# write-memory
switch(config-archive)# time-period 10080
switch#show archive
The maximum archive configurations allowed is 14.
There are currently 1 archive configurations saved.
The next archive file will be named flash:ARCHIVE/-<timestamp>-1
 Archive #  Name
   1        flash:ARCHIVE/Mar-31-12-05-16.835-EET-0 <- Most Recent
   2        
   3        
   4        
   5        
   6        
   7        
   8        
   9        
   10       

switch#archive config

switch#show archive  
The maximum archive configurations allowed is 14.
There are currently 2 archive configurations saved.
The next archive file will be named flash:ARCHIVE/-<timestamp>-2
 Archive #  Name
   1        flash:ARCHIVE/Mar-31-12-05-16.835-EET-0
   2        flash:ARCHIVE/Mar-31-12-06-08.944-EET-1 <- Most Recent
   3        
   4        
   5        
   6        
   7        
   8        
   9        
   10      
 

vineri, 27 martie 2015

[Cisco] Shell Processing

I've recently discovered another way to automate you work load, through shell processing.

From Cisco doc:
To restore the default behavior of Cisco IOS Shell (IOS.sh) processing, use the shell processing command in global configuration mode.

Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#shell processing full
-> full is optional

A very good explanation can be found here


Examples on a Cisco ASR 903, right on the privileged mode:

I needed to configure the following set of commands on a list of interfaces:
   description UNUSED
   storm-control broadcast level pps 300
   storm-control multicast level pps 300
   storm-control action trap

Step1: First, I defined the following function right on the privileged mode:

function set_interface_storm-control_settings() {
 configure terminal
  interface $1
   description UNUSED
   storm-control broadcast level pps 300
   storm-control multicast level pps 300
   storm-control action trap
end
}

Step2: You can call the function for one particular interface:

Router#set_interface_storm-control_settings  GigabitEthernet0/2/2

or use it like this:

for i in GigabitEthernet0/2/2 GigabitEthernet0/2/3 GigabitEthernet0/2/4 GigabitEthernet0/2/5
 do
  set_interface_default_seting $i
 done

Parts of the logs after running the script:

Enter configuration commands, one per line.  End with CNTL/Z.
Trace info: Executed: configure terminal
Trace info: Executed: interface GigabitEthernet0/2/2
Trace info: Executed: description UNUSED
Trace info: Executed: storm-control broadcast level pps 300
Trace info: Executed: storm-control multicast level pps 300
Trace info: Executed: storm-control action trap
Trace info: Executed:       end


Requirements:
- Cisco IOS Release 15.1(4)M, 15.1(2)S, and later releases.
- Cisco IOS.sh must be configured and enabled to use the Cisco IOS.sh features and functions on your router.
- configuration rights with the user you logged in


miercuri, 25 martie 2015

[Cisco] Setting SNMP trap IP source

On a Cisco C3560 switch, after a maintenance work that changed the management VLAN, syslog started showing the following message:

 %IP_SNMP-4-NOTRAPIP: SNMP trap source Vlan123 has no ip address

Vlan123 is the previous management VLAN.


I managed to stop the log by configuring SNMP trap IP source as follows:

switch(config)#snmp-server trap-source vlan 321

where VLAN 321 is the new management VLAN.


More info here