06-09-2023 02:17 PM
I'm using a Catalyst 9300 series with IOS XE 17.06.05. Inside of "banner exec" I'm trying to use variables / tokens to confer that info to the users. Specifically, i'm trying to use $(line-desc). Example: "banner exec * You are logged in on line $(line) of $(line-desc). *"
Where I expect a result like "You are logged in on line 0 of Console." or similar.
However, I get "You are logged in on line 0 of ." And said, "Ok, well, that's not what I expected."
When I looked closer at Cisco's documentation it stated that $(line-desc) is a "User-specified description of the Line". So I was like, "Oh, ok just add a description line to define the text to replace the token with." Except when I look at either Line Con 0 or Line VTY 0 15 - there is no description command for them. Do I have to define this text elsewhere or where do I specify the text that I want to replace the token when logging in via serial console or SSH/VTY?
Solved! Go to Solution.
06-15-2023 08:22 AM
For anyone that ends up on this in the future from a google search - I found the answer.
$(line-desc) is configured with the command: location
So, enter config mode, switch to your line: con 0 or line vty 0 4 (or 15, or whatever). And then type: location <arbitrary string> And you'll get output that differs based on it.
"You are logged in on line 0 of <switch name> on <location string> in <domain>."
I suppose you could -literally- name the physical location of the device, but that seems kind of odd to me. Anyway, mystery solved.
06-12-2023 09:44 AM
I did some further experimentation this morning. I typed in all the banner tokens listed then additionally some I didn't expect to work.
banner exec *
You are logged in on line $(line) of $(hostname) on $(line-desc) in $(domain). With ($peer-ip) and a gateway $(gate-ip) at $(mtu) mtu.
*
It results in: "You are logged in on line 0 of <switch name> on in <domain>. With $(peer-ip) and a gateway $(gate-ip) at $(mtu) mtu."
So to me it appears that $(line-desc) is a supported token compared to peer-ip, gate-ip, and mtu which just get ignored and taken as literal text. It's just that $(line-desc) has no value to display. It's just that my ablity to utilize Google to find out where to define the text for the $(line-desc) token fails me.
If anyone knows where to define the description for "line con 0" or, say, "vty 0 15" I'd appreciate that. Thank you.
06-15-2023 08:22 AM
For anyone that ends up on this in the future from a google search - I found the answer.
$(line-desc) is configured with the command: location
So, enter config mode, switch to your line: con 0 or line vty 0 4 (or 15, or whatever). And then type: location <arbitrary string> And you'll get output that differs based on it.
"You are logged in on line 0 of <switch name> on <location string> in <domain>."
I suppose you could -literally- name the physical location of the device, but that seems kind of odd to me. Anyway, mystery solved.
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