Implementing Banners

Problem

You want to implement a banner message to display a security warning.

Solution

The following commands configure various types of banners on a router:

Router1#configure terminal 
Enter configuration commands, one per line.  End with CNTL/Z.
Router1(config)#banner exec  # This is an exec banner #
Router1(config)#banner login # This is a login banner #
Router1(config)#banner motd  $ This is a motd banner  $
Router1(config)#end
Router1#

Notice that the router accept almost any delimiter character, as long as the start and end delimiter is identical. These delimiters allow you to make your banner message several lines long. Our first two examples use the pound symbol, #, while the last example uses the dollar sign, $, as a delimiter. You have to be slightly careful that you don’t use the delimiter character within the banner message itself or the router will accept only part of the message.

Discussion

Cisco routers support three main types of banners and display them in strict order. First the Message of the Day (motd) and then the login banner appear before the login prompt, and the router prints the exec banner after successful authentication:

Freebsd% telnet Router1
Trying 172.22.1.4...
Connected to Router1.
Escape character is '^]'.
 This is a motd banner  
 This is a login banner 

User Access Verification

Username: ijbrown
Password: <xxxxxxxxx>
 This is an exec banner 
Router1>

Login banners are mainly used to display a warning message for security purposes, which we will ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.