How to Create and Edit the Junos CLI Configuration

By Walter J. Goralski, Cathy Gadecki, Michael Bushong

You create or edit your device’s configuration in the configuration mode of the Junos command-line interface (CLI). To enter configuration mode, use the configure command at the operational mode prompt:

wiley@netnik> configure
Entering configuration mode
[edit]
wiley@netnik#

This allows you to create or edit the candidate configuration. Enter set ? after the configuration mode prompt to see the complete list of top-level configuration statements that are available for the set up of your device. These top-level groups organize all Junos configuration statements into hierarchies of related commands.

 [edit]
wiley@netnik# set ?
Possible completions:
> chassis       Chassis configuration
> class-of-service   Class-of-service configuration
> firewall       Define a firewall configuration
> forwarding-options  Configure options to control packet forwarding
> interfaces      Interface configuration
> policy-options    Routing policy option configuration
> protocols      Routing protocol configuration
> routing-instances  Routing instance configuration
> routing-options   Protocol-independent routing option
    configuration
> snmp         Simple Network Management Protocol configuration
> system        System parameters

You use these top-level commands and their underlying hierarchies to set up the various properties of your device. You can enter them into the candidate configuration line by line, copy them as text, or import them from a file. To add a new Gigabit Ethernet interface you would directly enter the appropriate set command via the CLI:

[edit]
wiley@netnik# set interfaces ge-1/1/0 unit 0 family inet
   address 192.168.0.1/24

You can use Junos automation to strictly guide users in making changes to a configuration. By creating an op script for the device, users can perform controlled configuration changes based on supplied input from command-line arguments, interactive prompts, or Junos show commands.

The advantage of this approach is that you can code the structure of the change into the script itself. This mitigates human error and lets users with less expertise change the configuration in controlled ways.