To configure the router or to modify an existing router configuration, you add statements to the configuration, in the process creating a statement hierarchy. For each statement hierarchy, you create the hierarchy starting with a statement at the top level and continuing with statements that move progressively lower in the hierarchy.
For example, to configure an interface in OSPF area 0, you must configure the following hierarchy of statements:
protocols
ospf
area 0
interface interface-name
-
set
—Creates a statement hierarchy and sets identifier values. After you issue aset
command, you remain at the same level in the hierarchy.
set <statement-path
>
statement
<
identifier
>
statement-path
is the hierarchy to the configuration statement and the statement itself. If you have already moved to the statement's hierarchy level, you omit this.identifier
is a string that identifies an instance of a statement. Not all statements require identifiers. In the example shown at the beginning of this section, the area name and the interface names are identifiers. In many cases, the identifier can contain a space. When you type these identifiers in the configuration, you must enclose them in quotation marks. When the CLI displays these identifiers in the output of a show
or other command, it encloses them in quotation marks. The
set
command is analogous to an operating system command in which you specify the full path name of the statement you are performing an action on, for example, mkdir /usr/home/boojum/files
or mkdir f:\home\boojum\files
. For statements that can have more than one identifier, when you issue a
set
command to set an identifier, only that identifier is set. The other identifiers that are specified in the statement remain.-
edit
—Moves to a particular hierarchy level. If that hierarchy level does not exist, theedit
command creates it and then moves to it. After you issue anedit
command, the banner changes to indicate your current level in the hierarchy.
edit <statement-path
>
statement
<
identifier
>
The
edit
command is analogous to the combination of operating system commands that you would use to first change to a directory and then perform an action; for example, cd /usr/home/boojum;mkdir files
.Examples: Create and Modify the Configuration
To configure an interface to run OSPF, you could issue a single
set
command from the top level of the configuration hierarchy. The initial [edit]
banner indicates that you are at the top level. Notice that after you issue the set
command, you remain at the top level of the statement hierarchy, as indicated by the second [edit]
banner. [edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 5
[edit]
user@host#
You also can use the
edit
command to create and move to the [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
hierarchy level and then issue a set
command to set the value of the hello-interval
statement. After you issue the edit
command, you move down in the hierarchy, as indicated by the [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
banner.[edit]
user@host# edit protocols ospf area 0.0.0.0 interface so-0/0/0
[edit protocols ospf area 0.0.0.0 interface so-0/0/0]
user@host# set hello-interval 5
[edit protocols ospf area 0.0.0.0 interface so-0/0/0]
user@host#
Because
hello-interval
is an identifier and not a statement, you cannot use the edit
command to set the hello interval value. You must use the set
command. You can determine that hello-interval
is an identifier by listing the available commands at the [edit protocols ospf area 0.0.0.0 interface so-0/0/0]
banner. All the statements not preceded by a > are identifiers. [edit]
user@host# edit protocols ospf area 0.0.0.0 interface so-0/0/0
[edit protocols ospf area 0.0.0.0 interface so-0/0/0]
user@host# set ?
Possible completions:
+ apply-groups Groups from which to inherit configuration data
> authentication-key Authentication key
dead-interval Dead interval (seconds)
disable Disable OSPF on this interface
hello-interval Hello interval (seconds)
interface-type Type of interface
metric Interface metric (1..65535)
> neighbor NBMA neighbor
passive Do not run OSPF, but advertise it
poll-interval Poll interval for NBMA interfaces
priority Designated router priority
retransmit-interval Retransmission interval (seconds)
transit-delay Transit delay (seconds)
transmit-interval OSPF packet transmit interval (milliseconds)
[edit protocols ospf area 0.0.0.0 interface so-0/0/0]
user@host# set
In both examples above, using either just the
set
command or a combination of the set
and edit
commands, you create the same configuration hierarchy:[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 5;
}
}
}
}
Notice that the CLI uses indentation to visually represent the hierarchy levels, and it also places braces at the beginning and end of each hierarchy level to set them off. The CLI also places a semicolon at the end of the line that configures the
hello-interval
statement. You also use the
set
command to modify the value of an existing identifier. The following example changes the hello interval in the configuration shown above:[edit]
user@host# set protocols ospf area 0.0.0.0 interface so-0/0/0 hello-interval 20
[edit]
user@host# show
protocols {
ospf {
area 0.0.0.0 {
interface so-0/0/0 {
hello-interval 20;
}
}
}
}
No comments:
Post a Comment