Support Support Downloads Knowledge Base Case Manager My Juniper Community

Knowledge Base

Search our Knowledge Base sites to find answers to your questions.

Ask All Knowledge Base Sites All Knowledge Base Sites JunosE Defect (KA)Knowledge BaseSecurity AdvisoriesTechnical BulletinsTechnotes Sign in to display secure content and recently viewed articles

[EX] Configuring multiple interfaces with the same configuration lines using shell

0

0

Article ID: KB21155 KB Last Updated: 04 Aug 2020Version: 4.0
Summary:

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

Comment on this article > Affected Products Browse the Knowledge Base for more articles related to these product categories. Select a category to begin.

Getting Up and Running with Junos

Getting Up and Running with Junos Security Alerts and Vulnerabilities Product Alerts and Software Release Notices Problem Report (PR) Search Tool EOL Notices and Bulletins JTAC User Guide Customer Care User Guide Pathfinder SRX High Availability Configurator SRX VPN Configurator Training Courses and Videos End User Licence Agreement Global Search