To make a copy of an existing statement in the configuration, use the copy command:
-
copy existing-statement to new-statement
The existing statement and all its subordinate statements are copied and added to the configuration. After you enter the copy command, the configuration might not be valid. If necessary, modify the existing statement or the new statement to ensure the configuration is valid.
The following example shows how to copy a unit configured at the [edit interfaces ge-0/0/0] hierarchy level:
- [edit interfaces ge-0/0/0]
- user@host# show
- unit 0 {
-
- family inet {
- address 10.14.1.1/24;
- }
- }
-
- [edit interfaces ge-0/0/0]
- user@host# copy unit 0 to unit 1
-
- [edit interfaces ge-0/0/0]
- user@host# show
- unit 0 {
-
- family inet {
- address 10.14.1.1/24;
- }
- }
- unit 1 {
-
- family inet {
- address 10.14.1.1/24;
- }
- }
In this example, after you enter the copy command, unit 0 and unit 1 have the same IP address in the candidate configuration. To modify the IP address of unit 1 before committing the configuration, use the rename command as described in Renaming an Identifier.