Intro
When you spend a lot of time googling or reading documentation trying to find a solution for some unexpected task and, at the end, it's startworking, you says "WOW! Now then I will use it next time!" But after few months you get the same task and... start from scratch. So I started writing Tips and Tricks for every Network OS (Juniper, Cisco , Huawei etc.) in my notes. After few years I decided to start publish my own collection. Hope it will help me and may be someone else to solve a problem in the future.
Some of them are from Day One collection, some from my everyday tasks. Enjoy.
CLI
To start Juniper OS Command Line Interface just type cli in the BSD shell.
'cli' - enable CLI 😉 ( BTW, I have to call my friend then I first logged to Juniper device by root account and get shell prompt instead of expected junOS cli prompt> )
You could just type ‘configure‘ on the CLI and dive into making changes, but that would probably be a mistake.
'configure' - Go to configuration mode. I highly discourage everyone from using plain old ‘configure‘.
Why? - you may ask me. Because you start your configuration in, so called, shared mode, so someone can "help" you or you can "help" someone. Not good to mess your device.
Here’s a couple configuration modes that will help you step up your Juniper game:
'configure private' - Private mode basically forks the configuration for each user making changes. Allows multiple engineers to make changes simultaneously. Discards all uncommitted changes when you exit.
'configure exclusive' - Exclusive mode allows only one person to make changes at a time by locking everyone else out until they exit.
'show cli' - Check current CLI setting.
'set cli screen-lenght' - set screen length
'set cli screen-length 0' - disable pagination
Idle timeout is disable by default. If you want the users to disconnect after some time, configure idle timeout according to your requirements using the following command:
'set cli idle-timeout 1' - set CLI idle timeout to 1 minute.
If you want the users to logout on their own and have the changes saved after a reboot, create a custom class and call the idle-timeout in that class
'set system login class <class> idle-timeout <minutes>'
'set system login user <user> class <class> '
Pipes
'show | compare' - When issued from configuration mode, this command sequence shows you exactly what you are about to change.
‘show configuration | compare rollback n‘ from operational mode to see the differences between the current configuration and one of the available rollbacks (“n” indicating which of the 50 config versions to compare).
'show configuration | display set | match <string>' - this command searches the configuration for any string and returns the full “set” statements.
'show interface | display xml' - this command display the output in XML format like in NETCONF RPC Response
'show interface | display xml rpc' - this command display NETCONF RPC you should send to get this information
'show bridge domain vlan100 | display xml rpc' - this command display NETCONF RPC to get infromation about bridge-domain vlan100
'show log messages | match <string1> | except <string2>' - Stacking pipes can be helpful to get more granular result
'show log messages | last 10' - Show last 10 messages in log file
'show log user [<username>]' - Show recent user or specified user logins
To be continued... next time Traffic capturing and monitoring
Comments
Post a Comment