网络管理

Juniper JUNOS模拟器配置导航

日期:2015/6/28来源: IT猫扑网

   本文中,我们会看一看如何多JUNOS配置文件进行操作。JUNOS配置文件在层级结构中很有条理;一旦你明白其结构和不同的层级,就可以轻松浏览文件并准确找到需要检测和更改的部件,而且还不会受到其他不需要部件的影响。

   首先,我们登录路由:

   Juniper5 (ttyd0) login: jeffPassword:

   --- JUNOS 8.5R1.13 built 2007-11-14 17:54:24 UTC

   jeff@Juniper5>
 

   该指令显示了用户名(jeff)和路由器的名称(Juniper5)。路由器现在处于可操作状态,处于这种状态下的时候,我们可以执行显示路由状态和数据库,ping和跟踪路由,远程登录(telnet)和ssh,重启系统进程等任务——这些任务大都是我们在监视和解决系统问题时需要用到的命令。JUNOS可操作模式相当于IOS用户的EXEC模式。

   使用IOS的时候,问号可以为我们提供很多帮助;当我们不记得命令字符串中的下一个语句时或者只需要查看可用选项时,问号就成了基础信息工具。我们可以使用问号来查看可操作状态中所有可用的命令:

   jeff@Juniper5> ?Possible completions:clear     Clear information in the systemconfigure Manipulate software configuration informationdiagnose  Invoke diagnose script|file      Perform file operationshelp      Provide help informationmonitor   Show real-time debugging informationmtrace    Trace multicast path from source to receiverping      Ping remote targetquit      Exit the management sessionrequest   Make system-level requestsrestart   Restart software processset Set CLI properties, date/time, craft interface messageshow      Show system informationssh Start secure shell on another hoststart     Start shelltelnet    Telnet to another hosttest      Perform diagnostic debuggingtraceroute      Trace route to remote host

   为了对配置进行更改, 笔者通过输入configure命令来输入配置模式:

   jeff@Juniper5> configure
 
   JUNOS配置模式相当于IOS中专有的EXEC或启用的模式。注意指令从>改为了#,在你输入enable命令后IOS会有同样的更改。

   另一种JUNOS配置模式的特性是位于指令上面的[edit]栏目。我们可以围绕配置层级来操作以便观察或更改文件的某部分;[edit]栏目准确指出了你所在层级的位置。当这一栏显示[edit]的时候,说明我们位于最顶层。因此,举例来说,如果在你的类型显示这一层级且没出现修改程序的时候,JUNOS会显示整个构造。

   将show命令与问号一起使用,我们会看到构造顶部的层级:

   [edit]jeff@Juniper5# show ?Possible completions:<[Enter]>      Execute this command> access   Network access configuration> accounting-options   Accounting data configuration> applications   Define applications by protocol characteristics+ apply-groups   Groups from which to inherit configuration data> chassis  Chassis configuration> class-of-service     Class-of-service configuration> event-options  Event processing configuration> firewall Define a firewall configuration> forwarding-options   Configure options to control packet forwarding> groups   Configuration groups> interfaces     Interface configuration> policy-options Routing policy option configuration> protocols      Routing protocol configuration> routing-instances    Routing instance configuration> routing-options      Protocol-independent routing option configuration> security Security configuration> services Service PIC applications settings> snmp     Simple Network Management Protocol configuration> system   System parameters|  Pipe through a command

   与该列表一起的标签对层级做了很好的诠释。例如,所有的界面都配置在了interfaces级别下,所有的协议都配置在了protocols级别下,而所有的路由策略都位于policy-options级别下。

   在每个顶层下面存在许多子层级。例如,在protocols下你可以找到BGP,OSPFv2,OSPFv3,MPLS,RSVP等。在those下可以发现更下一层的子层级。比方,在OSPF下,我们可以找到区域配置的层级,而在每个区域层级以下还可以找到用来指定区域内界面的层级。

   配置的层级结构让我们可以只关注感兴趣的局部配置上。假设你只想看一下构造中的BGP部分。show protocols bgp会显示出整个BGP配置:

   [edit]jeffr@Juniper5# show protocols bgp local-address 192.168.50.10;local-as 65503;group CustomerX {export XPolicy;peer-as 65510;neighbor 192.168.1.1 {authentication-key "$9$-Ud2aji.5z6qm"; ## SECRET-DATA}neighbor 192.168.1.5 {authentication-key "$9$JiZHmzF/t0I69ev"; ## SECRET-DATA}neighbor 192.168.1.10 {authentication-key "$9$mPF/u0Icrv1Rbs"; ## SECRET-DATA}}group CustomerY {neighbor 192.168.10.20;neighbor 192.168.10.30;neighbor 192.168.10.40;}group CustomerZ {neighbor 192.168.20.100;}

   在上面的配置中,我们看到出现了一个本地地址(192.168.50.10),所有的BGP TCP对话都源自该地址,本地AS号码是65503,而且还存在三个同级组:CustomerX,CustomerY和CustomerZ。CustomerX具备一个输出路由策略,我们已将其命名为Xpolicy;由于用于该组(65510)的AS号码不同于本地AS号码,所有它们就是EBGP同级组。位于这个组之下有三个临近组,所有这些组都经由个人密码验证。同级组CustomerY(拥有三个临近组)和CustomerZ(有一个临近组)是IBGP,因为他们不具备指定单独AS号码,而且也没有配备验证。

   假设,你所感兴趣的只是CustomerX下的临近组192.168.1.5的配置而不是整个BGP配置。我们可以用更明确的show命令,让JUNOS只显示出所需部分:

   [edit]jeff@Juniper5# show protocols bgp group CustomerX neighbor 192.168.1.5    authentication-key "$9$JiZHmzF/t0I69ev"; ## SECRET-DATA

   当然,如果你处于配置模式,可能会想作出更多操作。在配置模式中单独使用问号,就可以看到你能使用的各种操作:

   [edit]jeff@Juniper5# ?     Possible completions:<[Enter]>      Execute this commandactivate Remove the inactive tag from a statementanno

相关文章

相关下载

网友评论

我要评论...
    没有更早的评论了
    取消