EX交换机配置手册v1.2 - 图文 联系客服

发布时间 : 星期二 文章EX交换机配置手册v1.2 - 图文更新完毕开始阅读f62870deba4cf7ec4afe04a1b0717fd5360cb267

lab@EX4200> configure Entering configuration mode

[edit] lab@EX4200#

1.2.2 交换机配置结构

Juniper交换机的配置是一种层次化的配置模式,如下图所示:第一层次protocols协议层里面,可以包含bgp、isis和ospf等第二层次参数配置,而ospf层次里面,又可以定义第三层参数,比如area和traceoptions等,area下面又可以定义interface、area-range等第四层参数,而dead-interval、hello-interval等第五层参数则属于第四层interface下面的参数。

由于是层次化结构,因此配置一个参数有两种方式,一是在最外层使用一条set命令将所有层的参数

一次写完,另外一种方式是利用edit逐层进入需要配置参数的层次,然后用set命令直接设置参数。例如要在ospf协议area 0中将interface ge-0/0/1.0的hello-interval时间设置为10秒,那么可以有两种设置方式: 方法一:

lab@EX4200# set protocols ospf area 0 interface ge-0/0/1.0 hello-interval 10 方法二:

lab@EX4200# edit protocols

[edit protocols] lab@EX4200# edit ospf

第9页 共110页

[edit protocols ospf] lab@EX4200# edit area 0

[edit protocols ospf area 0.0.0.0] lab@EX4200# edit interface ge-0/0/1.0

[edit protocols ospf area 0.0.0.0 interface ge-0/0/1.0] lab@EX4200# set hello-interval 10

[edit protocols ospf area 0.0.0.0 interface ge-0/0/1.0] lab@EX4200#

在edit这种方式中,exit可以退回上一次用edit进入以前的层,直接输入top则退回最上层: lab@EX4200# edit protocols

[edit protocols] lab@EX4200# edit ospf

[edit protocols ospf] lab@EX4200# exit

[edit protocols] lab@EX4200#

分两次输入edit进入ospf,最后输入exit退回protols那层。

lab@EX4200# edit protocols ospf

[edit protocols ospf] lab@EX4200# exit [edit] lab@EX4200#

分一次edit进入ospf,最后输入exit退回最外层.

第10页 共110页

lab@EX4200# edit protocols

[edit protocols] lab@EX4200# edit ospf

[edit protocols ospf] lab@EX4200# top [edit] lab@EX4200#

输入top直接退出到最外层。

另外,juniper的配置参数有些可以一次写几个,比如要一次配置ospf的hello-time和dead-time可以按照下面写法:

lab@EX4200# set protocols ospf area 0 interface ge-0/0/1.0 hello-interval 10 dead-interval 10

输入以上命令之后,交换机的配置如下:

protocols { ospf {

area 0.0.0.0 {

interface ge-0/0/1.0 { hello-interval 10; } }

} }

注意:如果不知道一条命令里面后面是否还可以跟其它配置参数,那么最好使用 ? 帮助一下:

lab@EX4200# set protocols ospf area 0 interface ge-0/0/1.0 hello-interval 10 ?

第11页 共110页

Possible completions:

<[Enter]> Execute this command

+ apply-groups Groups from which to inherit configuration data + apply-groups-except Don't inherit configuration data from these groups > authentication

> bfd-liveness-detection Bidirectional Forwarding Detection options dead-interval Dead interval (seconds) (1..65535) demand-circuit Interface functions as a demand circuit disable Disable OSPF on this interface interface-type Type of interface

ipsec-sa IPSec security association name

> ldp-synchronization Advertise maximum metric until LDP is operational metric Interface metric (1..65535) > neighbor NBMA neighbor

no-neighbor-down-notification Don't inform other protocols about neighbor down events > passive Do not run OSPF, but advertise it

poll-interval Poll interval for NBMA interfaces (1..65535) priority Designated router priority (0..255)

retransmit-interval Retransmission interval (seconds) (1..65535) te-metric Traffic engineering metric (1..65535) transit-delay Transit delay (seconds) (1..65535) | Pipe through a command [edit]

1.2.3 TAB和空格键的使用

交换机JUNOS命令配置中,可以使用TAB键和空格键来进行参数的补全,在补全系统参数中两个键的作用是一样的,例如:

lab@EX4200# set pro <-输入TAB键或者空格键,则会补全protocols lab@EX4200# set protocols

而对于用户自己定义的参数,则只能用TAB来补全,比如我们定义了一个Test_Policy_1的策略,要在ospf中配置时可以使用 ?来显示:

lab@EX4200# set protocols ospf export ?

第12页 共110页