Category: junos

Simple shell script

When I was looking at one of my earlier posts, I noticed that sometimes I do repeat cli commands manually instead of scripting. Life is short! If you can’t find any other shell, junos has also C shell and following is a simple loop which generates several commands following a similar pattern. For example I
Read More »

How to disable root logins in JUNOS

If you want to prevent root user being used in ssh logins, one command is sufficient to accomplish this. After commit, root user will be rejected and you can login with any other super-user. #set system services ssh root-login deny

SRX DHCP Configuration

DHCP configuration is very straight forward in junos. However if you are like me, you can even forget that gateway address must be within the advertised pool. Here is a simple config set system services dhcp default-lease-time infinite set system services dhcp domain-name set system services dhcp name-server set system services dhcp name-server
Read More »

Recovering primary JUNOS image

When I booted my SRX device I saw the following output on the console;  WARNING: THIS DEVICE HAS BOOTED FROM THE BACKUP JUNOS IMAGE   It is possible that the primary copy of JUNOS failed to boot up  properly, and so this device has booted from the backup copy.  Please re-install JUNOS to recover the
Read More »

SRX password reset/recovery

Here are some basic steps to reset the password on an SRX firewall. Note: If you are looking for a default password, there is no default password in SRX. A new SRX out of the box has the root user with no password. 1) Reboot the box and press SPACE when you see the following
Read More »

Junos factory default configuration

I know that it is an easy command but for a few minutes I tried to remember the command to bring a junos box to factory default configuration. Isn’t it funny? I am taking a note here if I need to remember this just prior to my retirement:) [edit] root# load factory-default warning: activating factory
Read More »

Fetching JUNOS config as xml

If you want to fetch a junos device config remotely first configure netconf on the device via; junos#set system services netconf ssh junos#commit Then connect to the junos device (IP via an ssh client from a linux host and redirect the output to a file which is the xml config of the device indeed:
Read More »

Maximum rollback configuration in SRX

I used to remember that junos by default keeps 50 configuration rollbacks by number through 0 to 49. However in a default setup when I saw that I only have up to number 5 rollback, I realized that default isn’t 50 config files. Once you set the command; #set system max-configuration-rollbacks 49 you can keep
Read More »

Simple Junos Commit Script

Here is a simple junos commit script that checks if a given interface is assigned to trust zone or not. It is very basic of course but can be extended using junos automation reference documents. /* basic-sanity-check.slax */ version 1.0; ns junos = "*/junos"; ns xnm = ""; ns jcs = ""; import "../import/junos.xsl"; match
Read More »