rset(1) : Formulas

Juniper Switches and Routers

Juniper Networks develops switches and routers with very flexible management capabilities:

  1. Full-featured Unix userland (FreeBSD)
  2. Standard shell for root login
  3. A CLI which accept input as arguments or from a pipe

Configure SSH

Enabling root login provides access to the Unix shell over SSH, which will allow us to use rset(1) to configure the switch

set system root-authentication ssh-ed25519 "ssh-ed25519 key..."
set system services ssh root-login deny-password

Now that we have SSH access to the Junos OS/FreeBSD userland we can add a route entry

# routes.pln juniper/

Change the default connecting user to root

# ssh_config
  User root

Inline Commands

Run individual commands inline

   cli set date ntp

Configure Mode

The Juniper cli tool accepts multi-line commands, and is able to load configuration from a file

# ex2300-c.pln
   cli <<-!!
   load set juniper/ex2300-c
   show | compare

In this example, an environment variable can be set to override commit

rset -E 'COMMIT="rollback"'