Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Load a Base Configuration

This commit script example sets up a sample base configuration on a device running Junos OS.

Requirements

This example uses a device running Junos OS.

Overview and Commit Script

This script is a macro that sets up a device running Junos OS with a sample base configuration. With minimal manual user input, the script automatically configures:

  • A device hostname

  • Authentication services

  • A superuser login

  • System log settings

  • Some SNMP settings

  • System services, such as FTP and Telnet

  • Static routes and a policy to redistribute the static routes

  • Configuration groups re0 and re1

  • An address for the management Ethernet interface (fxp0)

  • The loopback interface (lo0) with the device ID as the loopback address

The example script is shown in both XSLT and SLAX syntax:

XSLT Syntax

SLAX Syntax

Configuration

Procedure

Step-by-Step Procedure

To download, enable, and test the script:

  1. Copy the script into a text file, name the file config-system.xsl or config-system.slax as appropriate, and copy it to the /var/db/scripts/commit/ directory on the device.

  2. Select the following test configuration stanzas, and press Ctrl+c to copy them to the clipboard.

    If you are using the SLAX version of the script, change the filename at the [edit system scripts commit file] hierarchy level to config-system.slax.

    The host-name and mgmt-address statements are mandatory. The backup-router statement is optional. You can substitute a hostname, a management Ethernet (fxp0) IP address, and a backup router IP address that are appropriate for your device.

  3. In configuration mode, issue the load merge terminal command to merge the stanzas into your device configuration.

    1. At the prompt, paste the contents of the clipboard by using the mouse and the paste icon.

    2. Press Enter.

    3. Press Ctrl+d.

  4. Commit the configuration.

Verification

Verifying the Configuration

Purpose

Verify that the script behaves as expected.

Action

After committing the configuration, issue the show | display commit-scripts configuration mode command to view the device base configuration.