您好,欢迎来到意榕旅游网。
搜索
您的当前位置:首页Juniper--Juniper的基本配置

Juniper--Juniper的基本配置

来源:意榕旅游网


Juniper--Juniper的基本配置(献给要学juniper的同学)

本专题所有Juniper的配置环境均为qemu+free bsd 4.8 mini+JUNOS Base OS boot [7.2R4.2]+4块虚拟出来的tap网卡,由于Juniper的路由器支持传统意义的VR-VPN,也就是可以把一个路由器当成多个路由器来用(16个),所以用一个路由器也可以完成多个路由器的互连。

————————————————————————————————

Juniper的基本配置:

root# cli

#相当于cisco的en

root@>

cli> configure

#相当于cisco的configure terminal

[edit]

root@# set system host-name router1

#配置路由器的名字为router1

root@# set system domain-name mynetwork.com

#配置路由器所在域为mynetwork.com

root@# set interfaces fxp0 unit 0 family inet address 192.168.15.1/24

#配置fxp0 unit 0的接口地址,fxp0代表管理接口,unit 0代表子接口,inet代表是ipv4地址。

root@# set system backup-router 192.168.15.2

#backup-router是本路由器的直连路由器,在路由器启动的时候,

#JUNOS路由软件(routing protocol process, RPD)没有立即启动,

#路由器将自动生成一条到back-up router的缺省路由,当路由器启动完成后再自动删除这条路由。

root@# set system name-server 192.168.15.3

#DNS的地址

root@# set system root-authentication plain-text-password

#设置明文密码

New password:

Retype password:

#输入并且确认密码,要求字母和数字。

root@# commit

#确认配置,在没有确认配置的时候所有配置都是不生效的!

root@router1# exit

root@router1>

#保存配置用save命令

[edit]

aviva@router1# save configuration-march02

Wrote 433 lines of configuration to 'configuration-march02'

#察看保存过的文件用run file list命令

aviva@router1# run file list

/var/home/aviva:

.ssh/

configuration-march02

#用保存的文件载入配置用load replace命令。

load replace XXX

JunOS的show命令

在configure模式下可以用show命令查看当前视图下的配置,Juniper有多种视图

在命令前面的方括号里面能看到所在的视图名称:

确省视图为system视图,如下,只有[edit]显示在上面

[edit]

root@stim# show

version 7.2R4.2;

system {

host-name stim;

domain-name huawei.com;

syslog {

user * {

any emergency;

}

file messages {

any notice;

authorization info;

}

file interactive-commands {

interactive-commands any;

}

}

}

interfaces {

fxp0 {

unit 0 {

family inet {

address 10.1.1.1/24;

}

}

}

}

下面一种是interface视图,不同视图下,用show命令show出来的结果是不一样的。

[edit interfaces]

root@stim# show

fxp0 {

unit 0 {

family inet {

address 10.1.1.1/24;

}

}

}

下面要介绍的命令是show | display set,这个命令能够查看在该视图下曾经做过一些什么操作。

[edit interfaces]

root@stim@RouterA# show | display set

set interfaces fe-0/0/1 unit 0 family inet address 10.0.15.2/24

set interfaces se-0/0/2 unit 0 family inet address 10.0.21.1/24

set interfaces se-0/0/3 serial-options clocking-mode dce

set interfaces se-0/0/3 unit 0 family inet address 10.0.16.1/24

set interfaces lo0 unit 0 family inet address 192.168.13.1/32

用show compare命令查看配置过的脚本

root@stim# edit system services

[edit system services]

root@stim# set telnet

[edit system services]

root@stim# exit

[edit]

root@stim# exit

The configuration has been changed but not committed

Exit with uncommitted changes? [yes,no] (yes) no

root@stim# show | compare

[edit system]

+ services {

+ telnet;

+ }

JunOS其他常用操作:

无论做什么操作的时候Juniper都需要通过commit命令使配置生效,这点和cisco huawei不是很一样,

cisco huawei的做法是配置上去立即生效。用commit check查看配置是否正确,如图在commit check的时

候发生报错,需要修改。

[edit]

root@stim@router1# commit check

[edit protocols rip group alpha-rip-group]

'neighbor fe-0/0/0.0'

Failed to configure neighbor fe-0/0/0.0: already in group alpha-rip-group

error: configuration check-out failed

每次我们想commit配置的时候都需要退出到cli界面,需要打多个quit命令,这里介绍一个直接的办法,

如果想保存配置并且回到用户视图下可以用commit and-quit

[edit protocols ospf]

root@stim# edit area 0

[edit protocols ospf area 0.0.0.0]

root@stim# commit and-quit

用top命令直接回到system视图下

[edit protocols ospf]

root@stim# top

[edit]

root@stim# edit protocols ospf

[edit protocols ospf]

root@stim# edit area 0

[edit protocols ospf area 0.0.0.0]

root@stim# top

[edit]

root@stim#

如果配置出问题需要回滚配置的时候可以用rollback命令。

root@stim# rollback ?

Possible completions:

<[Enter]> Execute this command

0 2007-09-30 13:58:53 UTC by root via cli

1 2007-09-30 13:42:55 UTC by root via cli

2 2007-09-28 15:47:34 UTC by root via cli

3 2007-09-28 15:47:16 UTC by root via cli

4 2007-09-28 15:46:44 UTC by root via cli

5 2007-09-28 00::45 UTC by root via other

| Pipe through a command

[edit]

查看当前版本:

root@stim> show version

Hostname: stim

Model: olive

JUNOS Base OS boot [7.2R4.2]

JUNOS Base OS Software Suite [7.2R4.2]

JUNOS Kernel Software Suite [7.2R4.2]

JUNOS Packet Forwarding Engine Support (M20/M40) [7.2R4.2]

JUNOS Routing Software Suite [7.2R4.2]

JUNOS Online Documentation [7.2R4.2]

JUNOS Crypto Software Suite [7.2R4.2]

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- yrrf.cn 版权所有 赣ICP备2024042794号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务