cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2179
Views
0
Helpful
8
Replies

Any way to confirm the interface your are in?

SpicyTako321
Level 1
Level 1

When jumping around between interfaces on switches/routers, is there any way to view which interface you are currently in?

 

For example in Unix and Linux you can view the current directory you are in with "pwd" command (Present Working Directory).

 

In IOS when at an interface prompt (config-if)# is there any command to view the interface your in? Such as VLAN(s) or FastEthernet 0/1, etc?

8 Replies 8

balaji.bandi
Hall of Fame
Hall of Fame

Not that I am aware of cisco IOS has this feature, maybe new improvement may add.

 

Good to have as mentioned "pwd" - like a  Linux command. (in the IOS)

 

feature available in Nexus command "where" should show us ( you are in  config mode interface gi 0/1)

 

like below :

 

switch(config-if)# where
conf; interface Ethernet1/1 admin@switch%default

BB

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

Hello,

 

I guess you could do something like this:

 

Configure archive logging:

 

archive
 log config
  logging enable
  notify syslog
  hidekeys

 

Whenever you get into interface configuration mode, a syslog message such as the one below will be generated:

 

000073: *Oct 26 23:51:23: %PARSER-5-CFGLOG_LOGGEDCMD: User:console logged command:interface GigabitEthernet0/0

 

In order for these message not to clog your console, configure this logging discriminator (otherwise these message will show up in your console):

 

logging discriminator NOLOG severity drops 5 facility drops CFGLOG mnemonics drops LOGGEDCMD
!
logging console discriminator NOLOG

 

Now when you are in interface mode, you can issue the command:

 

Router(config-if)#do show log | include interface

 

it will give you the exact same output and tells you what interface you are currently in.

 

The only thing I haven't figured out is how to just display the last line matching the pattern. If multiple lines are being
displayed, the last line will show the interface you are currently in...

Cisco IOS has a terminal shell (Router#term shell) that lets you use the 'grep' command, it might be possible to filter the last line with that...

Interesting. I didn't know it supported a grep command in a terminal shell.

luis_cordova
VIP Alumni
VIP Alumni

Hi @SpicyTako321 

 

If there is no problem in changing the description of the interface, you can try this:

(config-if)#description HEREAIM

(config-if)#do show run


Then, the interface that has that description will be where you are.

If there is a problem in changing the description, you just have to make a screenshot of the show run before the change, then you can return the description to its previous state.

 

Regards

 

Thats very clever to add a description to the location your in. Didn't know that was possible.

I have slightly altered the procedure to make it easier to display the current active interface you are in. The first part remains the same:

 

Configure archive logging:

 

archive
 log config
  logging enable
  notify syslog
  hidekeys

 

Whenever you get into interface configuration mode, a syslog message such as the one below will be generated:

 

000073: *Oct 26 23:51:23: %PARSER-5-CFGLOG_LOGGEDCMD: User:console logged command:interface GigabitEthernet0/0

 

In order for these message not to clog your console, configure this logging discriminator (otherwise these message will show up in your console):

 

logging discriminator NOLOG severity drops 5 facility drops CFGLOG mnemonics drops LOGGEDCMD
!
logging console discriminator NOLOG

 

I have created the command alias:

 

Router(config)#alias exec sai show archive log config all | sec interface

 

The command alias displays the content of:

 

show archive log config all | sec interface

 

which looks like this:

 

1 0 console@console |interface GigabitEthernet0/0
5 0 console@console |interface GigabitEthernet0/1

 

Now when you are in interface mode, you can issue the command:

 

Router(config-if)#do sai

 

The last line (GigabitEthernet0/1 in this case) is the current interface you are in.

 

You might want to clear the config archive from time to time, either manually:

 

clear archive log config force

 

or you can use the EEM script below to periodically clear it (every hour in the example):

 

event manager applet CLEAR_ARCHIVE
event timer watchdog time 3600
action 1.0 cli command "enable"
action 2.0 cli command "clear archive log config force"
action 3.0 cli command "end"

 

 

 

Wow thanks George. Thanks, that will work. However it does require doing this on each switch/router you want to have this ability on right? But nice to know there is a work around.

I really though Cisco had thought of this and had some way to print out your current working interface.  Which you would think would be easy to add. Or maybe change the prompts to indicated this. Such as (config-if-fa0/1) or (config-if-fa-0/1/2) etc.

 

Thanks again for the responses.

Hello,

 

it is a rather tedious way, and yes, you would need to configure that on each device. Having the current active interface shown in the prompt would indeed be nice...I haven't seen that anywhere on any IOS roadmap though...