juniper

更新时间:2022-12-29 01:20:54 阅读: 评论:0


2022年12月29日发(作者:上海外语教育出版社)

Juniper路由器

中文配置文档

深圳傲天信息技术有限公司

二零零零年十二月

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

1

目录

JUNOS配置简介.....................................................................................................................2

JUNOS软件简介.............................................................................................................2

JUNOS软件安装.............................................................................................................3

JUNOS命令行简介.........................................................................................................5

初始化配置.......................................................................................................................6

路由器的调试...................................................................................................................7

端口配置...........................................................................................................................8

系统整体配置.................................................................................................................11

IS-IS配置.......................................................................................................................12

OSPF配置......................................................................................................................14

BGP配置........................................................................................................................16

RoutingPolicy.................................................................................................................18

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

2

JUNOS配置简介

JUNOS软件简介

JUNOS软件的三大功能:

1)ROUTING

2)ENHANCEDROUTINGSERVICES

3)MPLS

TRAFFICENGINEERING

VPNS

它所支持的特性有:

1)模块化设计

2)EGP:BGP4

Routereflectors

Confederations

Communities

Routeflapdamping

TCPMD5authentication

REGEX

3)IGP:

IntegratedIS-IS

OSPF

RIPv2

4)Juniperpolicyengine

5)Multicast

DVMRPPIMDIMPIMSMMSDP(MulticastSource

DiscoveryProtocol)

6)MPLS

Trafficengineering

VPNs

7)ClassofService

在传统VPN方面,JUNIPER路由器需加插一块TunnelPIC板来支持。

它支持PIMSM隧道模式和GRE封装。

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

3

JUNOS软件安装

1、启动设备和媒介

启动顺序

1、可移动媒介:

a)用于安装和升级,通常为空

b)M40使用120MB软驱

c)M20/160使用110MBPCMCIAFLASH卡

2、FLASH驱动器

a)在一个新的Juniper路由器中,JUNOS软件预先安装在FLASH驱动

器中

3、硬盘

a)在一个新的Juniper路由器中,与安装一个备份JUNOS软件,还用

于存储系统log文件和诊断文件

2、软件安装

1、出厂预安装软件

a)FLASH驱动器

b)硬盘(备份)

c)可移动媒介(用于系统恢复)

2、存储媒介使用下列设备名,在路由器启动的时候显示出来

a)FLASH驱动器-wd0

b)硬盘-wd2

c)可移动媒介-wfd0

3、可以从各种拷贝启动

a)如果FLASH驱动器坏了,还可以从硬盘或者软驱启动

4、升级

a)可以从可移动媒介或者从Internet上升级

3、完全安装-准备阶段

1、记录下基本信息

a)路由器名

b)管理接口IP地址

c)缺省路由器IP地址

d)域名和DNS服务器IP地址

2、将已存在的配置文件COPY到安全的地方

a)配置文件位于/config/

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

4

3、确定你要安装的媒介

4、完全安装-重新安装

1、插入安装媒介

a)M40LS-120软盘

b)M20PCMCIAFLASH卡

2、重新启动路由器

a)从console口使用命令:root@lab2>systemhalt

b)重新启动电源

3、输入安装前保存的一些信息

4、系统安装完后自动重新启动

5、升级软件

1、JUNOS软件包含三个包

a)jkernel-操作系统

b)jroute-路由引擎软件

c)jpfe-包转发引擎软件

d)jbundle-所有的三个软件包

2、下列是软件包的名字举例:

a)

b)

c)

3、每个包可以个别的单独升级

4、CLI命令模式下使用showsystemsoftware显示安装的软件信息

5、命名规范:

a)m.n是主版本号

b)number是relea号码

c)Z是大写字母

i.A-Alpha

ii.B-Beta

iii.R-Relea

iv.I-Internal

6、例如:

6、升级软件包

root@lab2>requestsystemsoftwareaddnew-package-name

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

5

root@lab2>requestsystemreboot

7、备份已存在的软件

系统软件和配置可以备份到硬盘中,最好在稳定的时候进行

使用requestsystemsnapshot命令备份软件到/altroot和/altconfig文件系统中,

通常情况下,root文件系统/备份到/altroot中,/config备份到/altconfig中。Root和

config都在flash驱动器中,备份的都在硬盘中。

8、升级所有的软件包

1、download下软件包

2、将软件包拷贝到的/var/tmp中,这个目录位于硬盘中,是一个大文件系

ur@host>filecopyftp://ftp/directory/package-name/var/tmp

3、删除旧的软件包安装新的软件包

ur@host>requestsystemsoftwareadd

/var/tmp/jbundle-package-name

4、重新启动路由器:

ur@host>requestsystemreboot

JUNOS命令行简介

你可以通过三种管理接口访问路由器

console(Db9EIA-232@9600Bps,8/N/1-pre-configured)、

auxiliary、

fxp0、Telnet、SSH也可访问路由器

你必须掌握需要访问路由器的密码

当你第一次访问路由器时,你必须使用root帐号登陆访问CLI(用户命令行),

然后为路由器配置一个新的帐号

当你通过用户帐号及密码登录路由器后,你就可以顺利的进入控制平台,可

以在用户名和路由器名前看到“>”提示符

Juniper需要通过用户名和密码来访问,路由器管理员可以创建用户帐号和分

配权限,新的Juniper路由器只有没有密码的root帐号访问,你必须使用cli命令

从CLI开始配置。

命令行方式可以从console口、从管理口、telnet、ssh、RADIUS、TACACS+

等方式进入,用户认证使用用户名和口令

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

6

show命令和cisco的show很相似,?可以提供可用命令的提示。JUNOS本

身是一个UNIX操作系统,CLI模式只是其中的一个shell,在UNIX模式下输入

cli可以进入CLI模式下。

输入命令的前几个字母,如果以这几个字母开头的命令唯一,按空格或TAB

键可以将命令补全,否则显示所有可用命令。

一行显示不完的结果,按空格显示下一屏幕,b返回上一屏幕,d卷动一半

屏幕,回车逐行显示,/string搜索指定字符串,n重复搜索字符串,q返回CLI

模式,h显示help。

输入configure进入配置模式,修改完毕后要输入commit激活配置,而不像

cisco的修改是立即有效的。

Commit以后,上次的配置文件/config/变成了

/config/.1,再次commit以后,则产生新的/config/.1,而

/config/.1变成/.2;如此下去,/config/目录下一共可以存放

/config/juniper.n(n=1-3),而n=4-9存放于/var/db/config/.n。使用rollback

n恢复配置

使用edit命令进入每一级配置,使用t、rename、inrt命令设置、修改、

插入下一级属性。使用show显示当前级一下的配置,commit激活配置,rollback

恢复配置,使用delete删除配置,显示其它当前正在配置路由器的用户使用status

命令。

在配置模式下,要使用普通模式下的命令,要在命令前面使用run

初始化配置

启动时候的顺序:连接好所有的cables,打开第一个电源,打开第二个电源

关机的顺序:输入requestsystemhalt命令,关闭电源

M40的craftinterface上显示:

StartingRoutingEngine启动路由引擎

StartingPFE启动转发引擎

StartingCards启动PIC卡

FPC的LED灯显示闪烁的绿灯表示在测试,测试通过则显示固定绿色

PIC的LED在系统被配置之前一直为关闭

使用控制台进入

root密码出厂时没有被配置

必须使用console配置root密码,使用configure进入配置模式,使用

root@#tsystemroot-authenticationplain-text-password设置root密码

配置路由器名和域名

root@#tsystemhost-namelab2

root@#

root@#commit

管理接口的IP地址

root@#tinterfacesfxp0unit0familyinetaddress

ipaddress/prefix-length

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

7

缺省路由IP地址

root@#tsystembackup-routergateway-address

备份路由,当有两台路由器时,可以定义另一台路由器为备份路由,当

主路由器发生问题时,数据包可以由另一台路由器转发。

root@#trouting-optionsstaticroutedefaultnexthopgateway-address

retainno-readverti

DNS服务器的IP地址

root@#tsystemname-rverns-address

恢复出厂设置

按前面的RESET键直到前面的状态灯由绿变红再变绿,然后再按一次

RESET键

路由器的调试

LOG文件:

系统LOG文件保存在硬盘的/var/log目录下。

观看LOG文件用命令:showlog文件名

实时观看用命令:monitorstart文件名

附加的LOG信息可用关键词来打开:traceoptionsflag

让系统记录LOG文件的命令是traceoptions

例:ttraceoptionsospf-log(文件名)

ttraceoptionsospf-logflagerrors(记录OSPF的出错信息,该LOG

文件名为ospf-log)

跟踪命令:

PingTraceRoute

观看系统警告:

showchassisalarms

showchassishardware

showchassinvironment

系统支持信息:

requestsupportinformation

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

8

端口配置

1.物理端口

1)需要注意的选项为:

Clocking

Scrmbling

FCS(Framecheckquence)

MTU(Maximumtransmissionunit)

Keepalives

2)标准配置语句:

interfaces{

interface-name{

clockingclock-source;

dce;

disable;

descriptiontext;

encapsulationtype;

hold-timeupmillicondsdownmilliconds;

link-modemode;

macmac-address;

mtubytes;

no-keepalives;

no-traps;

receive-bucket{

overflow(tag|discard);

ratepercentage;

thresholdnumber;

}

speed(10m|100m);

transmit-bucket{

overflow(tag|discard);

ratepercentage;

thresholdnumber;

}

}

}

默认值:

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

9

端口处为PPP封装

MTU默认为4474,最大为9192

默认为打开Keepalives

时钟默认为internal

FCS默认为16-bitchecksum

PayloadScrambling默认为打开

3)SONET/SDH配置:

[editinterfacesso-fpc/pic/port]

sonet-options{

bytes{

e1-quietvalue;

}

fcs(32|16);

loopback(local|remote);

path-tracetrace-string;

(payload-scrambler|no-payload-scrambler);

rfc-2615;

(z0-increment|no-z0-increment);

}

4)FastEthernet与GE配置:

FastEthernet口:

[editinterfacesinterface-name]

link-mode(full-duplex|half-duplex)

fastether-options{

(loopback|no-loopback);

source-address-filter{

mac-address;

}

(source-filtering|no-source-filtering);

}

GE口:

[editinterfacesinterface-name]

gigether-options{

flow-control;

(loopback|no-loopback);

source-address-filter{

mac-address;

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

10

}

(source-filtering|no-source-filtering);

}

加入802.1QVLAN标志:

[editinterfacesinterface-name]

vlan-tagging;

5)E1接口:

[editinterfacesinterface-name]

e1-options{

fcs(32|16);

framing(g704|unframed);

idle-cycle-flag(flags|ones);

loopback(local|remote);

start-end-flag(shared|filler);

timeslotsslot-number;

}

2.逻辑端口

1)需要注意的选项为:

端口上的封装协议

地址(IP地址,ISONET地址)

VC(VCI/VPI,DLCI)

2)配置语句(含FrameRelay):

[editinterfacesinterface-name]

unitlogical-unit-number{

disable;

dlcidlci-identifier;

encapsulationtype;

inver-arp;

multicast-dlcidlci-identifier;

-identifier;

multipoint;

tunnel{

sourceaddress;

destinationaddress;

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

11

ttlnumber;

}

-identifier;

vlan-idnumber;

}

3)在端口处可配置的逻辑地址可按关键词family分为:

inet:IP地址

iso:ISOCLNP地址

mpls:MPLS流量工程

在一个逻辑端口可按unit起用多个协议族

配置语句为:tinterfaceXXXunitXXfamilyinetaddress10.0.20.1/24

系统整体配置

配置语句:

[editsystem]

thost-name

ttime-zone

tdomain-name

tnamerver

tloginurXXXclassXXX

tloginurXXXauthentication

plain-text-passwordXXX

domain-nameXXX

tsystemname-rverXXX

trvicestelnet

trvicesftp

tsnmpcommunityXXXauthorizationread-only

设置Outband管理端口

[editinterface]

tfxp0unit0familyinetaddressXXX

tfxp0unit0description“xxx”

配置文件范例:

version“4.010[tlim]”

system{

host-nameobi-wan

;

time-zoneAmerica/Los_Angles;

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

12

name-rver{

208.197.168.252;

}

login{

urlab{

uid2000;

classsuper-ur;

authentication{

encrypted-password

“XXXXXXXXXXXXXXX”

}

}

rvices{

telnet;

ftp;

}

syslog{

ur*{

anyemergency;

}

filemessage{

anynotice;

}

}

}

IS-IS配置

路由的配置:

1)标准配置语句:

protocols{

isis{

disable;

authentication-keykey;

authentication-typeauthentication;

export[policy-names];

levellevel-number{

authentication-keykey;

authentication-typeauthentication;

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

13

external-preferencepreference;

preferencepreference;

wide-metrics-only;

}

lsp-lifetimeconds;

no-authentication-check;

overload;

traffic-engineering{

disable;

shortcuts;

}

traceoptions{

filename

<(world-readable|no-world-readable)>;

flagflag;

}

interfaceinterface-name{

disable;

csnp-interval(conds|disable);

hello-authentication-keykey;

hello-authentication-typeauthentication;

lsp-intervalmilliconds;

mesh-group(value|blocked);

passive;

levellevel-number{

disable;

hello-authentication-keykey;

hello-authentication-typeauthentication;

hello-intervalconds;

hold-timeconds;

metricmetric;

passive;

prioritynumber;

te-metricmetric;

}

}

}

}

2)最小化配置方案:

interfaces{

lo0{

unitlogical-unit-number{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

14

familyiso{

addressaddress;

}

}

}

type-fpc/pic/port{

unitlogical-unit-number{

familyiso;

}

}

}

protocols{

isis{

interfaceall;

}

}

路由的校验

showisisadjacency(brief)

showisisdataba

showisisdatabasystem-iddetail

showisisroutes

showrouteprotocolisister

showisisinterfaceXXXdetail

showisisspflog

showisisstatistics

在JUNIPER的ISIS中,区域级别为:

LEVEL1:LEVEL1ONLY

LEVEL2:LEVEL2ONLY

LEVEL3:LEVEL1AND2

OSPF配置

路由的配置

1)最小的配置

[edit]

protocols{

ospf{

area0{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

15

interfaceinterface-name;

}

}

}

2)OSPF配置语句:

protocols{

ospf{

disable;

export[policy-names];

external-preferencepreference;

preferencepreference;

reference-bandwidthreference-bandwidth;

areaarea-id{

area-rangenetwork/mask-length;

authentication-typeauthentication;

interfaceinterface-name{

disable;

authentication-keykey;

dead-intervalconds;

hello-intervalconds;

interface-typetype;

metricmetric;

neighboraddress;

passive;

prioritynumber;

}

nssa{

area-rangenetwork/mask-length;

default-metricmetric;

(summaries|no-summaries);

}

stub

no-summaries>;

virtual-linkneighbor-idrouter-idtransit-areaarea-id{

disable;

authentication-keykey;

dead-intervalconds;

hello-intervalconds;

retransmit-intervalconds;

transit-delayconds;

}

}

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

16

}

}

路由的校验

showospfinterfacebrief/extensive

showospfroutedetail

showospfdatababrief

showospfstatistics

BGP配置

1)BGP配置语句

protocols{

bgp{

numerousglobalBGPstatements

groupgroup-name{

peer-asautonomous-system;

typetype;

allow[network/mask-length];

numerousgroup-specificstatements

neighboraddress{

numerouspeer-specificstatements

}

}

}

}

2)IBGP配置与EBGP

bgp{

groupcore{

typeinternal;

local-address192.168.255.7

peer-as65000;

authentication-keyXXXXXXXXXXXX

neighbor192.168.255.1;

neighbor192.168.255.2;

}

groupAS_692{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

17

typeexternal;

peer-as692;

importnext-hop-lf;

authentication-keyXXXXXXXXXXXXXXX

neighbor172.16.5.1;

}

policy-options{

policy-statementnext-hop-lf{

then{

nexthoplf;

}

}

}

}

IBGP与EBGP在上述范例中的设置区别为:在TYPE类型上的不同。

3)BGP路由反射器的设置

editprotocolsbgp]

groupgroup-name{

typeinternal;

peer-asautonomous-system;

neighboraddress1;

neighboraddress2;

}

groupgroup-name{

typeinternal;

peer-asautonomous-system;

clustercluster-identifier;

neighboraddress3;

neighboraddress4;

}

4)BGP的校验

showbgpsummary

showbgpneighbor

showbgpnext-hop-databa

showroutereceive-protocolbgp

showrouteextensive

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

18

RoutingPolicy

RoutingPolicy简介

在JUNOS中,所有的路由信息都存在路由表中,由JUNOS提出的routing

policy,可以控制路由信息在两个不同的路由表中传递。

IMPORT

Import是指由外部注入到指定路由表的信息方向。

EXPORT

Export是指由本路由表中希望向其他路由协议输出的信息。

在IGP路由协议中,如OSPF,ISIS等,只有Export;而EGP中,如BGP

等,可以有import和export。

策略运行及routefilters

routingpolicy语法范例:

policy-options{

policy-statementpolicy-name{

termterm-name{

from{

match-conditions;

}

to{

match-conditions;

{

then{

action;

}

}

final-action;

}

}

routefilters语法范例

[…]

termterm-name{

from{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

19

route-filterprefix/prefix-lengthmatch-type

[…]

}

[…]

routefilters满足条件的类型可分为:

exactprefix-lengthiqualtotheroute’sprefixlength

longerprefix-lengthisgreaterthantheroute’sprefixlength

orlongerprefix-lengthiqualtoorgreaterthantheroute’s

prefixlength

uptoroutesharesthesamemostsignificantbitsandthe

route’sprefixlengthfallsbetweenprefix-lengthand

prefix-lenght2

throughroutefallxactlybetweenthefirst

prefix/prefix-lengthspecifiedtothecond

prefix/prefix-lengthspecified

RoutingPolicy基本配置

范例:

宣告OSPF

policy-options{

policy-statementadverti-ospf{

termpick-ospf{

fromprotocolospf

thenaccept

}

}

}

BGP的范例(包含import和export)

protocols{

bgp{

exportlocal-customers;

groupmeganet-inc{

typeexternal;

peer-as47;

import[martian-filterlong-prefix-filteras-47-filter]

neighbor1.2.2.4

neighbor1.2.2.5

}

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

20

groupproblem-child{

typeexternal;

peer-as54;

exportkill-private-address;

import[as-47-filterlong-prefix-filtermartina-filter]

neighbor1.2.2.6

neighbor1.2.2.7

neighbor1.2.2.8{

import[reject-unwantedas-666-routes]

}

}

}

}

routerfilter范例

termsample{

fromroute-filter192.168/16exact

thenaccept

}

termsample{

fromroute-filter192.168/16upto/24

thenaccept

}

测试RoutingPolicy

可用以下命令测试RoutingPolicy的正确性:

testpolicypolicy-name0.0.0.0/0(测试在路由表里的所有路由)

testpolicypolicy-name10.49.0.0/16(测试指定的路由)

路由重分布范例(将BGP的路由送入IS-IS中)

[edit]

protocols{

isis{

exportedu-to-isis{

}

}

policy-options{

communityedumembers655:5

policy-statementedu-to-isis{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

21

from{

protocolbgp

communityedu

}

then{

metic14

accept

}

}

}

Juniper的基本配置

root#cli

#相当于cisco的en

root@>

cli>configure

#相当于cisco的configureterminal

[edit]

root@#tsystemhost-namerouter1

#配置路由器的名字为router1

root@#

#配置路由器所在域为

root@#tinterfacesfxp0unit0familyinetaddress192.168.15.1/24

#配置fxp0unit0的接口地址,fxp0代表管理接口,unit0代表子接口,inet代

表是ipv4地址。

root@#tsystembackup-router192.168.15.2

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

由软件(routingprotocolprocess,RPD)没有立即启动,路由器将自动生成一条到

back-uprouter的缺省路由,当路由器启动完成后再自动删除这条路由。

root@#tsystemname-rver192.168.15.3

#DNS的地址

root@#tsystemroot-authenticationplain-text-password

#设置明文密码

Newpassword:

Retypepassword:

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

root@#commit

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

root@router1#exit

root@router1>

#保存配置用save命令

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

22

[edit]

aviva@router1#saveconfiguration-march02

Wrote433linesofconfigurationtoconfiguration-march02

#察看保存过的文件用runfilelist命令

aviva@router1#runfilelist

/var/home/aviva:

.ssh/

configuration-march02

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

aviva@router1#loadreplaceXXX

#接口配置

1、直接配置

从用户模式进入config模式,怎么进?当然用config命令了,

然后依次直接使用命令:

aviva@router1#tinterfacefe-1/0/3unit0familyinetaddress10.0.20.1/24

aviva@router1#tinterfacefe-1/0/3unit0familympls

这样配置的结果就是上面的样子了

或者用第二种方法配置

2、逐层配置

aviva@router1#editinterfacefe-1/0/3unit0familyinet

aviva@router1#taddress10.0.20.1/24

aviva@router1#up

aviva@router1#tfamilympls

aviva@router1#top

解释一下上面的命令中的几个关键字段,和几个命令的区别:

unit0配合使用,代表此接口的第一个逻辑口

family后有inet、inet6、mpls等,代表支持的协议

up到上层配置层,同dos中的cd..

top到config的根层

interfaces{

fe-1/0/3{

unit0{

familyinet{

address10.0.20.1/24;

}

familympls

}

}

}

#OSPF路由协议配置

方法1:

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

23

一进入配置模式[edit]就使用命令

tprotocolospfarea0interfacefe-1/1/1

方法2:

进入[edit]后依次使用命令

[edit]

editprotocol

[editprotocol]

editospf

[editprotocolospf]

editarea0

[editprotocolospfarea0.0.0.0]

tinterfacefe-1/1/1

或者

[edit]

editprotocolospfarea0

[editprotocolospfarea0.0.0.0]

tinterfacefe-1/1/1

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

}

}

JunOS的show命令

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

视图

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

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

[edit]

root@stim#show

version7.2R4.2;

system{

host-namestim;

;

syslog{

ur*{

anyemergency;

}

filemessages{

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

24

anynotice;

authorizationinfo;

}

fileinteractive-commands{

interactive-commandsany;

}

}

}

interfaces{

fxp0{

unit0{

familyinet{

address10.1.1.1/24;

}

}

}

}

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

一样的。

进入接口视图

root@stim#editinterface

[editinterfaces]

root@stim#show

fxp0{

unit0{

familyinet{

address10.1.1.1/24;

}

}

}

下面要介绍的命令是show|displayt,这个命令能够查看在该视图下曾经做

过一些什么操作。

[editinterfaces]

root@stim@RouterA#show|displayt

tinterfacesfe-0/0/1unit0familyinetaddress10.0.15.2/24

tinterfaces-0/0/2unit0familyinetaddress10.0.21.1/24

tinterfaces-0/0/3rial-optionsclocking-modedce

tinterfaces-0/0/3unit0familyinetaddress10.0.16.1/24

tinterfaceslo0unit0familyinetaddress192.168.13.1/32

用showcompare命令查看配置过的脚本

root@stim#editsystemrvices

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

25

[editsystemrvices]

root@stim#ttelnet

[editsystemrvices]

root@stim#exit

[edit]

root@stim#exit

Theconfigurationhasbeenchangedbutnotcommitted

Exitwithuncommittedchanges?[yes,no](yes)no

root@stim#show|compare

[editsystem]

+rvices{

+telnet;

+}

JunOS其他常用操作:

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

cisco、huawei不是很一样,

Cisco、huawei的做法是配置上去立即生效。用commitcheck查看配置是否

正确,如图在commitcheck的时候发生报错,需要修改。

[edit]

root@stim@router1#commitcheck

[editprotocolsripgroupalpha-rip-group]

neighborfe-0/0/0.0

Failedtoconfigureneighborfe-0/0/0.0:alreadyingroupalpha-rip-group

error:configurationcheck-outfailed

每次我们想commit配置的时候都需要退出到cli界面,需要打多个quit命令,

这里介绍一个直接的办法,

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

[editprotocolsospf]

root@stim#editarea0

[editprotocolsospfarea0.0.0.0]

root@stim#commitand-quit

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

[editprotocolsospf]

root@stim#top

[edit]

root@stim#editprotocolsospf

[editprotocolsospf]

root@stim#editarea0

[editprotocolsospfarea0.0.0.0]

root@stim#top

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

26

[edit]

root@stim

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

root@stim#rollback?

Possiblecompletions:

<[Enter]>Executethiscommand

02007-09-3013:58:53UTCbyrootviacli

12007-09-3013:42:55UTCbyrootviacli

22007-09-2815:47:34UTCbyrootviacli

32007-09-2815:47:16UTCbyrootviacli

42007-09-2815:46:44UTCbyrootviacli

52007-09-2800:54:45UTCbyrootviaother

|Pipethroughacommand

[edit]

查看当前版本:

root@stim>showversion

Hostname:stim

Model:olive

JUNOSBaOSboot[7.2R4.2]

JUNOSBaOSSoftwareSuite[7.2R4.2]

JUNOSKernelSoftwareSuite[7.2R4.2]

JUNOSPacketForwardingEngineSupport(M20/M40)[7.2R4.2]

JUNOSRoutingSoftwareSuite[7.2R4.2]

JUNOSOnlineDocumentation[7.2R4.2]

JUNOSCryptoSoftwareSuite[7.2R4.2]

Juniper命令行入门

juniper命令行有两层:

操作模式,配置模式:如果对比其他厂商的设备,就是用户模式,和特权模式的区别。

进入配置模式:configure(基本就按cisco的configt理解)

进入下一层次:edit(进入某个模式配置,可以按cisco下的intet1/0,routerospf等任何进入子模式

的命令理解)

设值命令:t(设置命令,具体赋值使用,比如加ip地址,ospf中的什么命令等)

删除命令:delete(同no)

提交:commit(和cisco理解不同,cisco是命令一旦执行即生效,juniper是先放在一个叫“擦写块”

(具体怎么写忘记了)的东西里面,然后只有commit才能放在runningconfig中,就这么理解即可)

空格键完成未敲完的单词(同cisco中的tab建)

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

27

juniper中的接口定义:

Cisco中的接口定义大家都很明白了,比如e1/1,rial0/2等等

Juniper中的接口定义如下:接口名称-大槽号/小槽号/端口号

接口名称包括:

at—ATM类的口,没有用过,不清楚

e1—E1接口

e3—E3接口

fe—100M口

so—POS口

t1—T1口

t3—DS-3口

ge—GE口

fxp0是特殊的,代表管理网口的名称,固定的!

别说你不明白E1/E3/SO/T3/T1是什么,不明白以后再说吧,我对SDH的理解也就技术支持的水平,

还得请教别人哩,呵呵

大槽号:

小槽位:

从上到下0,1,2,3

其他的从右到左|3|2|1|0|

端口号:

M40/M160从上到下,从右到左

|2|0|

|3|1|

其他的从右到左,从下到上

|3|2|

|1|0|

一个例子:Fe-5/2/3〔端口名称-大槽号/小槽号/端口号〕

看一个接口配置的基本例子:

节选

###interfaces{

fe-1/0/3{

unit0{

familyinet{

address10.0.20.1/24;

}

familympls

}

}

}

节选结束

#是不是感觉和C有点象?呵呵,完全是结构层次的配置命令,上面配置的含义就是接口fe-1/0/3配置

ipv4地址10.0.20.1/24。并且此接口支持mpls,如果这些配置是其他设备呢?会是什么样子,大家应该都

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

28

很熟,如下:

interfaceethernet7/10

ipaddress10.0.20.1255.255.255.0

mplsip

exit

JUNIPER的两种配置方法

1、直接配置

从用户模式进入config模式,怎么进?当然用config命令了,

然后依次直接使用命令:

tinterfacefe-1/0/3unit0familyinetaddress10.0.20.1/24

tinterfacefe-1/0/3unit0familympls

这样配置的结果就是上面的样子了

或者用第二种方法配置

2、逐层配置

editinterfacefe-1/0/3unit0familyinet

taddress10.0.20.1/24

up

tfamilympls

top

解释一下上面的命令中的几个关键字段,和几个命令的区别:

unit0配合使用,代表此接口的第一个逻辑口

family后有inet、inet6、mpls等,代表支持的协议

up到上层配置层,同dos中的cd..

top到config的根层

再讲几个最最常用的命令

设置设备hostname

root@#tsystemhost-namehost-name

设置管理网口的ip地址:

root@#tinterfacesfxp0unit0familyinetaddress100.100.100.100/28

显示配置,在用户模式下:showconfig

在特权模式下:show

静态路由的配置方法

routing-options{

static{

route192.168.2.2/32next-hop192.168.2.2;

}

}

对应命令:trouting-optionstaticroute192.168.2.2/32next-hop192.168.2.2

或者:editrouting-optionstatic

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

29

troute192.168.2.2/32next-hop192.168.2.2

OSPF路由协议配置

假设有设备,其上面有接口Fe-1/1/1等等,ip地址分别为10.1.1.1/24,10.1.2.1/24……

依次递增。接口地址的配置就不说了,前面章节里面都有。

下面这个例子中的配置说明了启动了OSPF路由协议,并且等同在cisco中使用了

network10.1.1.0/24area0命令。

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

}

}

上面显示的就是在juniper中配置了ospf后看到的配置信息,如何配置?这就用到前面讲的

juniper配置方法了,有两种方法,忘记了请回忆一下前面的章节。

方法1:

一进入配置模式[edit]就使用命令

tprotocolospfarea0interfacefe-1/1/1

方法2:

进入[edit]后依次使用命令

[edit]

editprotocol

[editprotocol]

editospf

[editprotocolospf]

editarea0

[editprotocolospfarea0.0.0.0]

tinterfacefe-1/1/1

或者

[edit]

editprotocolospfarea0

[editprotocolospfarea0.0.0.0]

tinterfacefe-1/1/1

用心体会一下,就发现了,配置还是比较简单的,主要命令还是edit,t这几个,是

不是感觉有点意思了?

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

30

上面的配置很纯粹,就是一个骨干域的Router,再在上面配置的基础上添加一个area1,

使之成为ABR。

命令如下:

tprotocolospfarea1interfacefe-1/2/1

配置后的结果为:

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

area1{

interfacefe-1/2/1;

}

}

}

这样,就等于又在cisco上执行了一条:network10.1.2.0/24area1的命令。

这样,最最基本的ospf配置完了,后面再说说metric,端口优先级什么的怎么设置。

没有消化的话,就再看看前面的。

好了再在上面的基础上配置一下接口fe-1/2/1的接口优先级,它能选上DR

命令参考:

tprotocolospfarea1interfacefe-1/2/1priority50

配置后的结果:

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

area1{

interfacefe-1/2/1{

priority50;

}

}

}

}

再讲一下如何配接口的metric;

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

31

命令参考:

tprotocolospfarea1interfacefe-1/2/1metric150

配置后的结果:

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

area1{

interfacefe-1/2/1{

priority50;

metric150;

}

}

}

}

如果还想加什么passive接口什么的,也是同理,结果如下

配置后的结果:

[edit]

protocols{

ospf{

area0{

interfacefe-1/1/1;

}

area1{

interfacefe-1/2/1{

priority50;

metric150;

passive;

hello-intervalXX;

interface-typeXX;

XXXXX;

}

}

}

提供几个常用调试命令:

juniper@M10>showconfiguration用户模式下显示配置

juniper@M10>showinterfacesfe-0/1/2用户模式下显示端口信息

juniper@M10>showroute用户模式下显示路由信息

juniper@M10>showsystemurs用户模式下显示登陆用户,同cisco的who

深圳傲天信息技术有限公司

深圳傲天工程文档第页共20页

32

juniper@M10#showsystemloginur?配置模式下显示账号列表

Possiblecompletions:

Urname(login)

biszUrname(login)

ciscoUrname(login)

juniperUrname(login)

juniper端口怎么shut,noshut

关闭端口

[edit]

juniper@M10#tinterfacesfe-0/1/1disable

打开端口:

[edit]

juniper@M10#deleteinterfacesfe-0/1/1disable

juniper@M10#commit

验证端口状态,先退出配置模式

[edit]

juniper@M10#quit

查看端口状态:

juniper@M10>showinterfacesfe-0/1/1

Physicalinterface:fe-0/1/1,Administrativelydown,PhysicallinkisDown

本文发布于:2022-12-29 01:20:54,感谢您对本站的认可!

本文链接:http://www.wtabcd.cn/fanwen/fan/90/50233.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

上一篇:vendor
下一篇:address
标签:juniper
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图