Contents

Introduction

Prerequisites

Components Used

Background Information

Procedure

Line Breaks

HTML Escaped Characters

Reference

Introduction

This document describes the use of banner feature templates for the generation of banner and message of the day (MOTD) text blocks in Cisco IOS® XE.

Prerequisites

Create a block of text in a simple text editor that you want to appear in the Cisco IOS XE configuration. If you already use a standard banner across all devices, start with that banner in a plain text file.

Components Used

The information in this document was created from the devices in a specific lab environment. All of the devices used in this document started with a cleared (default) configuration. If your network is live, ensure that you understand the potential impact of any command.

Background Information

The use of feature templates in vManage is preferable to CLI templates because feature templates are compartmentalized and allow for minor changes to be made to a feature configuration without an impact to the rest of the device configuration.

The banner feature template works fine for a simple text message. However, over the years, CLI users have developed more complicated banners that can be generated from text with line breaks and special characters added. Unfortunately, vManage does not always interpret a banner correctly when it is simply copied and pasted in from a Cisco IOS XE CLI configuration.

Procedure

Here are a few techniques to generate the banner correctly without the need to resort to a CLI add-on template.

Line Breaks

In a Cisco IOS XE CLI configuration, line breaks are interpreted literally, so a line break that appears in a text block is treated as expected. In vManage, the entire text block must be pasted into a free-form text field where the line breaks are ignored. So it is necessary to explicitly define the locations of line breaks with the special character \n.

Warning Notice\n\n This system is restricted solely to ACME authorized users for legitimate\n business purposes only.\n

This text block renders into the Cisco IOS XE CLI as:

Warning Notice This system is restricted solely to ACME authorized users for legitimate business purposes only.

HTML Escaped Characters

Certain HTML escaped characters are not handled properly by the vManage interpreter. For example:

This system is restricted solely to Abbott & Costello authorized users

This renders into the Cisco IOS XE CLI as:

This system is restricted solely to Abbott &amp; Costello authorized users

In order to properly render the ampersand (&) character, it is necessary to work around the text interpreter that vManage uses. The simplest way to do this is to replace & with its octal escape sequence. The octal escape sequence must be escaped twice, so a double backslash is required.

This system is restricted solely to Abbott \\046 Costello authorized users

This renders in the Cisco IOS XE CLI as:

This system is restricted solely to Abbott & Costello authorized users

The same technique works for any other character or symbol that is misinterpreted by vManage. Here are the octal escape sequences for some common HTML escaped characters:

Character

HTML Escaped Character

Octal Escape Sequence

ampersand (&)

&amp;

\\046

less than (<)

&lt;

\\074

greater than (>)

&gt;

\\076

space ( )

&nbsp;

\\040

Once you have the text formatted to your satisfaction, copy and paste the formatted text into the Banner or MOTD field in the banner feature template. Be sure to verify that the text is displayed correctly, both in the Cisco IOS XE CLI and also after a successful log in.

Reference

Create a Custom Banner