Description

Using the shell to create the same configuration across multiple interfaces and applying the configuration file.  This is an alternate method from the usual configuration options.

Symptoms

Using the shell as an alternate method to create the same configuration across multiple interfaces. 

Solution

For example, if there is a need to configure "no flow control" on the first 10 interfaces the following steps can be done:

  1. Go to csh shell:
    > start shell user root
  2. Go to sh shell:
    % sh
    #
  3. Run the following line to create the configuration lines for the first 10 interfaces and redirect them to a file named set-file2.txt:
    # X=0; while [ $X -lt 10 ]; do echo "set interface ge-0/0/$X ether-options no-flow-control" >> juniper.txt; X=`expr $X + 1`; done
  4. Checking now the created file:
    # cat juniper.txt
    set interface ge-0/0/0 ether-options no-flow-control
    set interface ge-0/0/1 ether-options no-flow-control
    set interface ge-0/0/2 ether-options no-flow-control
    set interface ge-0/0/3 ether-options no-flow-control
    set interface ge-0/0/4 ether-options no-flow-control
    set interface ge-0/0/5 ether-options no-flow-control
    set interface ge-0/0/6 ether-options no-flow-control
    set interface ge-0/0/7 ether-options no-flow-control
    set interface ge-0/0/8 ether-options no-flow-control
    set interface ge-0/0/9 ether-options no-flow-control
  5. Then the file can be loaded from the CLI:
            config# load set juniper.txt
            config# commit

 

Note: The name of the file used in this example is juniper.txt