When configuring the router, you can enter most statements and identifiers in any order. Regardless of the order in which you enter the configuration statements, the CLI always displays the configuration in a strict order. However, there are a few cases where the ordering of the statements matters because the configuration statements create a sequence that is analyzed in order.
For example, in a routing policy or firewall filter, you define terms that are analyzed sequentially. Also, when you create a named path in dynamic Multiprotocol Label Switching (MPLS), you define an ordered list of the transit routers in the path, starting with the first transit router and ending with the last one.
To modify a portion of the configuration in which the statement order matters, use the
insert
configuration mode command: insert <statement-path
>identifier1
(before | after)identifier2
If you do not use the
insert
command, but instead simply configure the identifier, it is placed at the end of the list of similar identifiers.Examples: Insert a New Identifier
Insert policy terms in a routing policy configuration. Note that if you do not use the
insert
command, but rather just configure another term, the added term is placed at the end of the existing list of terms. [edit]
user@host# show
policy-options {
policy-statement statics {
term term1 {
from {
route-filter 192.168.0.0/16 orlonger;
route-filter 224.0.0.0/3 orlonger;
}
then reject;
}
term term2 {
from protocol direct;
then reject;
}
term term3 {
from protocol static;
then reject;
}
term term4 {
then accept;
}
}
}
[edit]
user@host# rename policy-options policy-statement statics term term4 to term term6
[edit]
user@host# set policy-options policy-statement statics term term4 from protocol local
[edit]
user@host#set policy-options policy-statement statics term term4 then rejec
t
[edit]
user@host# set policy-options policy-statement statics term term5 from protocol aggregate
[edit]
user@host#set policy-options policy-statement statics term term5 then reject
[edit]
user@host# insert policy-options policy-statement statics term term4 after term term3
[edit]
user@host# insert policy-options policy-statement statics term term5 after term term4
[edit]
user@host# show policy-options policy-statement statics
term term1 {
from {
route-filter 192.168.0.0/16 orlonger;
route-filter 224.0.0.0/3 orlonger;
}
then reject;
}
term term2 { # reject direct routes
from protocol direct;
then reject;
}
term term3 { # reject static routes
from protocol static;
then accept;
}
term term4 { #reject local routes
from protocol local;
then reject;
}
term term5 { #reject aggregate routes
from protocol aggregate;
then reject;
}
term term6 { #accept all other routes
then accept;
}
[edit protocols mpls path ny-sf]
user@host# show
1.1.1.1;
2.2.2.2;
3.3.3.3 loose;
4.4.4.4 strict;
6.6.6.6;
[edit protocols mpls path ny-sf]
user@host# insert 5.5.5.5 before 6.6.6.6
[edit protocols mpls path ny-sf]
user@host# set 5.5.5.5 strict
[edit protocols mpls path ny-sf]
user@host# show
1.1.1.1;
2.2.2.2;
3.3.3.3 loose;
4.4.4.4 strict;
5.5.5.5 strict;
6.6.6.6;
No comments:
Post a Comment