JUNIPER JUNOS COMMAND SERIES – 3

Hi All, lets continue our useful Junos command series by looking at 2 more interesting commands. One is another flexibility which Juniper provides and 2nd is to see the command structure in way which can be directly pasted on CLI.

So this is our example policy config from MX104:

MX104-PE> show configuration policy-options policy-statement test
term 1 {
 from community test;
 then accept;
}
term 2 {
 from neighbor 1.1.1.1;
 then accept;
}
term 3 {
 then reject;

Now lets suppose you need to add one term (term 4) between before term 3 so that it doesn’t get reject by last reject term. Lets puts a term 4 and see what’s the result.

[edit policy-options policy-statement test]
MX104-PE# set term 4 from family inet

[edit policy-options policy-statement test]
MX104-PE# set term 4 then accept
[edit policy-options policy-statement test]
MX104-PE# show
term 1 {
 from community test;
 then accept;
}
term 2 {
 from neighbor 1.1.1.1;
 then accept;
}
term 3 {
 then reject;
}
term 4 {
 from family inet;
 then accept;
}

Now if you see above Junos has added the term 4 at the end which won’t be useful to us if we commit now as term 3 is reject and term 4 won’t be validated at all because of reject term 3 above it. So to get away with this problem Junos provides us one command “insert” which will insert the term 4 before term 3. Let’s see it in action.

[edit policy-options policy-statement test]
MX104-PE# insert term 4 before term 3

[edit policy-options policy-statement test]
MX104-PE# show
term 1 {
 from community test;
 then accept;
}
term 2 {
 from neighbor 1.1.1.1;
 then accept;
}
term 4 {
 from family inet;
 then accept;
}
term 3 {
 then reject;
}

Now lets check the another command which is very easy hack

Sometimes you need the configuration from Juniper in set form so that you can paste it directly on the other or same box after some modifications.

This is our example configuration:

show configuration interfaces ge-0/1/8
vlan-tagging;
mtu 1522;
encapsulation vlan-ccc;
unit 601 {
 encapsulation vlan-ccc;
 vlan-id 601;
 family ccc;
}

Now to get the set form of this configuration, Junos gives us this command:
show configuration interfaces ge-0/1/8 | display set
set interfaces ge-0/1/8 vlan-tagging
set interfaces ge-0/1/8 mtu 1522
set interfaces ge-0/1/8 encapsulation vlan-ccc
set interfaces ge-0/1/8 unit 601 encapsulation vlan-ccc
set interfaces ge-0/1/8 unit 601 vlan-id 601
set interfaces ge-0/1/8 unit 601 family ccc

This is exact same config but in separate form and can be easily copy pasted from top edit mode on other device.

In next blogs we will see more commands to copy paste the config without set form.

So that’s all, I hope you liked this article as well and will make use of these commands in your day to day operational work or troubleshooting.

Regards

Mohit Mittal

Advertisements

One thought on “JUNIPER JUNOS COMMAND SERIES – 3”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s