Junos OS has many helpful commands to shorten the time it takes to make changes in the existing configuration. Using rename, copy, replace, and insert commands in Command Line Interface (CLI) configure mode lets you quickly make changes to your device configuration.
Rename a section of the configuration
Sometimes you may want to rename a section of the Junos configuration, for example, to alter an older naming convention to adhere to a new policy. Assume that you want to rename ge-0/0/0 to the new naming convention of ge—1/0/0. Here is the current configuration snippet:
root@host-name# show interfaces ge-0/0/0
unit 0 {
family inet {
address 100.100.100.1/24;
}
}
You can rename the interface in one step with the rename command:
root@host-name# rename interfaces ge-0/0/0 to ge-1/0/0
Now, use the show command to check that the change occurred:
root@host-name# show interfaces ge-1/0/0
unit 0 {
family inet {
address 100.100.100.1/24;
}
}
Copy parts of the configuration
Junos also allows you to make copies of parts of the configuration by using the copy command. For example, assume that you create a template for a local user called logintemplate, and you want to make a copy for a new user named joe who has recently joined your team:
root@host-name# show system login user
user logintemplate {
full-name "Generate network operations user";
class netops;
authentication {
encrypted-password "$1$Naeta3Iw$./sgTTPK0NoH0PJdsXvP6."; ## SECRET-DATA
}
}
You can make a copy of this template for the new user, joe, by using the copy command:
root@host-name# edit system login
root@host-name# copy user logintemplate to user joe
And, again, check to confirm that Junos created the new local user:
root@host-name# show
user logintemplate {
full-name "Generate network operations user";
class netops;
authentication {
encrypted-password "$1$Naeta3Iw$./sgTTPK0NoH0PJdsXvP6."; ## SECRET-DATA
}
}
user joe {
full-name "network operations user";
class netops;
authentication {
encrypted-password "$1$Naeta3Iw$./sgTTPK0NoH0PJdsXvP6."; ## SECRET-DATA
}
}
To complete the setup of joe, you can modify his password, and he’s ready to go.
Replace a part of the configuration
Another useful command is replace, which changes a given character string throughout the configuration to something else. For example, assume that interface ge-0/0/0 is referenced in the protocols branch of the configuration, because you configured OSPF on it, as shown here:
root@host-name# show interfaces ge-0/0/0
unit 0 {
family inet {
address 100.100.100.1/24;
}
}
root@host-name# show protocols ospf
area 0.0.0.0 {
interface ge-0/0/0.0;
}
In this example, you can use the replace command to rename the interface to the new naming convention throughout the entire configuration:
root@host-name# replace pattern ge-0/0/0 with ge-1/0/0
You can use show interfaces to view the configuration, and you can see that the name changes in both the interfaces and the protocols:
root@host-name# show interfaces ge-1/0/0
unit 0 {
family inet {
address 100.100.100.1/24;
}
}
root@host-name# show protocols ospf
area 0.0.0.0 {
interface ge-1/0/0.0;
}
Insert a configuration statement
Finally, the insert command allows you to insert a configuration statement either before or after an item in an ordered sequence. This command is especially useful if you are configuring firewall filters and routing policies and need to change the ordering of terms, as shown in this example:
[edit policy-options policy-statement multiterm]
jadmin@juniper1# insert term accept before term reject
Here, you are inserting the accept term before the reject term, which in a routing policing, can save you hours upon hours of midnight troubleshooting. Just remember that like copy, replace, and rename, the insert command can save you time and effort when you are configuring your Junos device.
dummies
Source:http://www.dummies.com/how-to/content/make-faster-changes-to-the-junos-os-configuration.html
No comments:
Post a Comment