01-13-2012 01:57 PM - edited 03-07-2019 04:20 AM
Hello,
I would like to know, if it is possible to set the interface range FastEthernet 1/0/1-10 to "no shutdown" via marco, if Interface FastEthernet 1/0/48 changes state to down (e.g. Networkcable unplugged).
If it ist possilbe could you provide the macro here?
Kind regards
01-13-2012 02:36 PM
Kai -
You absoultely can script items like this with Cisco devices - they are standard telnet/SSH. However you have to take a few things into consideration.
1. The device is a switching/routing operating system, meaning it has limited adminsitrative tools; in your case, there is no way on the device to have it recognize if an interface went down and to executive a script.
2. What you're wanting to accomplish can easily be handled by some SNMP monitoring software and having that software run a script which logs into the device, and issues the appropriate commands.
The key to accomplishing what you want to do is the fact that it cannot be handled internally, but my be handled by a third-party device.
Thanks,
Sean Brown
(Rate me, if i'm helpful)
01-13-2012 10:04 PM
Hi Sean,
Thank you for your quit answer. Please tell if I'm wrong. The the Switch can recognize, if an interface changes his state to up. After this a macro will be executed.
Like this for example
configure terminal
macro name changevlan
switchport access vlan $access
@
!=== Create macro
interface FastEthernet 0/1
macro apply changevlan $access 100
!=== Apply macro - variable = 100 - put interface in vlan 100
So, if I understood you correctly, the switch can not execute an macro on port down only on port up like in my sample?
Kind Regard
01-14-2012 08:58 AM
I got a few steps closer to my target, currently I'm trying this
function MyFunction () {
if [[ $LINKUP -eq NO ]]; then
interface $INTERFACE
no shutdown
exit
fi
}
But now I'v to setup, that $LINKUP tracks the port state of GigabitEthernet 0/48 and $INTERFACE hast to be raplaced with interface range gigabitEthernet 0/1-10
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide