Wednesday, September 7, 2011

Banner Exec $(Tokens)

Tokens are variables that can display things like hostnames, which line has been connected to, etc.

There are several banner types that can take advantage of tokens, but for now, I want to configure banner exec.

When I telnet into R2 from R1, I want R2 to display its hostname, which line I am connecting to, the line description and domain name.

I need to add some configuration first:

R2(config)#ip domain-name
R2(config)#line vty 0 4
R2(config-line)#location ?
  LINE  One text line describing the terminal's location

R2(config-line)#location VTY LINE

The banner exec tokens are self explanatory. The only one that might leave a doubt is $(line-desc). This variable calls the text associated with the location command under the line configuration.

R2(config)#banner exec ^You are connected to $(hostname) on line $(line), $(line-desc) at $(domain)^

Here's the telnet in action:

Trying ... Open

User Access Verification

You are connected to R2 on line 194, VTY LINE at