Monday, January 15, 2018

Junos Op Script Hello World

This is example and demo uses Junos on-box script for hello world. Basically on-box script divide into 3: operational script (op script), commit script and event script. On this posting I will show you the very simple about op script.

# Running Op Script from operational mode


awa@JUNOS> show configuration system scripts 

op {
    file hello.slax;
    file show.slax;
}

{master:0}

awa@JUNOS> file list /var/db/scripts/op 

/var/db/scripts/op:

hello.slax
show.slax*

{master:0}

awa@JUNOS> file show /var/db/scripts/op/hello.slax 
version 1.0;

ns junos = "http://xml.juniper.net/junos/*/junos";

ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";

import "../import/junos.xsl";


match / {

    {
  "Hello World";
    }
}

{master:0}

awa@JUNOS> op hello 
Hello World

{master:0}

awa@JUNOS> 

# Running Op Script from start shell

*not all op script can running from start shell

awa@JUNOS> start shell 

% cd /var/db/scripts/op
% ls -l
total 16
-rw-r--r—  1 awa  wheel  275 Jan  9 17:02 hello.slax
-rwxrws---  1 awa  wheel  442 Jan  8 16:29 show.slax
% cat hello.slax
version 1.0;

ns junos = "http://xml.juniper.net/junos/*/junos";

ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";

import "../import/junos.xsl";


match / {

    {
  "Hello World";
    }
}
% cli op hello
Hello World

%

Tuesday, October 31, 2017

Juniper vSRX Flow-based to Packet-based

This posting explains how to change the forwarding mode on Juniper vSRX from flow-based to packet-based for IPv4 traffic.


Juniper vSRX 'show version'
So basically An Juniper vSRX can operate in two different modes: packet mode and flow mode. In flow mode, vSRX processes all traffic by analyzing the state or session of traffic. This is also called stateful processing of traffic. In packet mode, vSRX processes the traffic as a traditional router on a per-packet basis. This is also known as stateless processing of traffic. Security features like IPsec, NAT, UTM, and so on, do not work in packet mode. By default, Junos OS on Juniper vSRX devices works in flow mode.

Juniper vSRX or vSRX is virtual form of security platform from Juniper Networks, as we know appliance form called Juniper SRX or SRX.

1. To check the forwarding mode 'show security flow status'.


Juniper vSRX flow-based 'show security flow status'

2. To change Juniper vSRX from flow-based to packet-based, delete the security feature configuration then change the mode to packet-mode using following command and commit.


change the mode to packet-mode

3. Reboot the vSRX to make the changes effective.


reboot needed to change to packet mode

4. Once the vSRX is up after reboot, check the flow status again. As you can see, the forwarding mode is now packet-based.


Juniper vSRX packet-based

Tuesday, August 16, 2016

Runnng JUNOS CLI from Shell

This is one tips how to execute JUNOS CLI from shell ( BSD shell ).

Execute / running command from JUNOS CLI

lab@D23_EX4200> show version 
fpc0:
--------------------------------------------------------------------------
Hostname: D23_EX4200
Model: ex4200-48t
JUNOS Base OS boot [12.3R9.4]
JUNOS Base OS Software Suite [12.3R9.4]
JUNOS Kernel Software Suite [12.3R9.4]
JUNOS Crypto Software Suite [12.3R9.4]
JUNOS Online Documentation [12.3R9.4]
JUNOS Enterprise Software Suite [12.3R9.4]
JUNOS Packet Forwarding Engine Enterprise Software Suite [12.3R9.4]
JUNOS Routing Software Suite [12.3R9.4]
JUNOS Web Management [12.3R9.4]
JUNOS FIPS mode utilities [12.3R9.4]

{master:0}

lab@D23_EX4200>

Execute / running command from BSD shell

lab@D23_EX4200> start shell 
% cli show version
fpc0:
--------------------------------------------------------------------------
Hostname: D23_EX4200
Model: ex4200-48t
JUNOS Base OS boot [12.3R9.4]
JUNOS Base OS Software Suite [12.3R9.4]
JUNOS Kernel Software Suite [12.3R9.4]
JUNOS Crypto Software Suite [12.3R9.4]
JUNOS Online Documentation [12.3R9.4]
JUNOS Enterprise Software Suite [12.3R9.4]
JUNOS Packet Forwarding Engine Enterprise Software Suite [12.3R9.4]
JUNOS Routing Software Suite [12.3R9.4]
JUNOS Web Management [12.3R9.4]
JUNOS FIPS mode utilities [12.3R9.4]

%