浙江电力信息数据网 Juniper路由器配置手册
Juniper Networks, Inc.
2009-4-13
目 录
路由器开箱启动软硬件检测 ........................................ 错误!未定义书签。 SYSTEM基本配置 ................................................. 错误!未定义书签。 设置系统名称及时区 ............................................. 错误!未定义书签。 设置帐号密码 ................................................... 错误!未定义书签。 用户级别定义 ................................................... 错误!未定义书签。 设置系统登录 ................................................... 错误!未定义书签。 SYSLOG设置 ..................................................... 错误!未定义书签。 GROUP配置 ...................................................... 错误!未定义书签。 CHASSIS配置 .................................................... 错误!未定义书签。 SYSTEM下的应用配置 ............................................. 错误!未定义书签。 INTERFACE配置 .................................................. 错误!未定义书签。 路由协议配置配置 ................................................ 错误!未定义书签。 OSPF协议配置 .................................................. 错误!未定义书签。
Ospf基本配置 ................................................ 错误!未定义书签。
OSPF邻居间认证配置 .......................................... 错误!未定义书签。 路由重发布 ................................................... 错误!未定义书签。 OSPF配置示例 ................................................ 错误!未定义书签。 IBGP协议配置 .................................................. 错误!未定义书签。 EBGP协议配置 .................................................. 错误!未定义书签。 RR配置 ........................................................ 错误!未定义书签。 MPLS协议配置 .................................................. 错误!未定义书签。 采用LDP信令建LSP ........................................... 错误!未定义书签。 采用RSVP信令建LSP .......................................... 错误!未定义书签。
VPN配置 ........................................................ 错误!未定义书签。 INSTANCE配置 .................................................... 错误!未定义书签。 MBGP的配置 .................................................... 错误!未定义书签。 CLASS OF SERVICE配置 ........................................... 错误!未定义书签。
路由器开箱启动软硬件检测
确认设备电源连接正确,加点启动,使用Console线连接路由器Console接口,首次登陆用户名:root,无密码。进入根模式: %cli
进入Operating Mode
Root> Show chassis hardware
查看硬件信息,检测是否所有板卡在线,对应配置清单确认机箱、板卡配置信息是否正确,
Root> Show chassis environment
查看机箱温度,正常温度不应超过40摄氏度。
Root> Show chassis alarms
查看告警信息,联调阶段应该有电源模块(因为没有连接冗余电源)和带外管理接口fxp0(没有连接带管接口)告警,属正常。
Root> Show version
查看JUNOS软件版本信息。
System基本配置
System配置是路由器基本信息的配置,包括路由器名称、管理员名称和口令、管理协议、Log等相关信息,
设置系统名称及时区
Root#Set system hostname 设置系统的主机名称 Root# Set time-zone Asia/Shanghai 配置路由器的时区 Root# Set ntp server 配置NTP Server, Root# Set system root-authentication plain-text-password 设备初次启动只有root用户,root用户为最高权限用户,缺省没有密码,配置root管理员口令,日常运维不使用root用户。 Root# Set system login user 设置帐号密码 增加一个用户,此用户为管理员(Super-user)级别, Root# Set system login user 增加一个用户,此用户为ReadOnly (read-only)级别,用来查看配置信息、机箱状况和log信息。 用户级别定义 terry# set system login class testclass permissions all 增加一个用户类别名称为testcalss,其权限为所有权限,根据不同的权限组合,可以定义不同级别 的管理员用户 可以定义的权限有: access 可以查看访问配置 access-control 可以改变访问控制 admin 可以查看用户帐号 admin-control 可以改变用户帐号 all 所有的要限均打开 clear 可以清除学习到的路由信息 configure 可以进入配置模式 control 可以改变任何配置 field 可以用DEBUG工具 firewall 可以查看防火墙(ACL)配置 firewall-control 可以改变防火墙(ACL)配置 flow-tap 可以查看 flow-tap 配置 flow-tap-control 可以改变flow-tap 配置 flow-tap-operation 能够 tap flows interface 可以查看 interface 配置 interface-control 可以改变interface 配置 maintenance 可以变成超级用户 network 可以访问网络信息 reset 可以 reset/restart 接口和进程 rollback 可以回退到以前保存下来的配置s routing 可以查看 routing 配置 routing-control 可以改变routing 配置 secret 可以查看加密信息 secret-control 可以改变secret 加密信息 security 可以查看安全配置 security-control 可以改变安全配置 shell 进以进入shell界面 snmp 可以查看 SNMP 配置 snmp-control 可以改变SNMP 配置 system 可以查看 system 配置 system-control 可以改变system 配置 trace 可以查看 trace file 设置 trace-control 可以改变trace file 设置 view 可以查看当前的运行状态信息 view-configuration 可以查看所有配置(不包括加密部分) 设置系统登录 terry# set system services ssh 设置系统允许SSH登录 terry# set system services ssh protocol-version v2 设置登录使用的SSH版本为V2版本 terry# set system services ssh protocol-version v2 rate-limit 5 设置通过SSH方式每分钟最多登录进来的人数为5 人 terry# set system services ssh rate-limit 5 connection-limit 4 设置通过SSH方式能够同时登录进来4人 Syslog设置 Root# Set system syslog file 设置SYSLog文件容量为2m和数量为10个。 Root# Set system syslog file 设置SYSLog文件中log下来的内容 terry# set system syslog file 为方便审计,将管理员操作时输入的所有命令LOG下来,syslog文件名为log-com 例: # show system syslog syslog { user * { any emergency; } file messages { any notice; authorization info; } file log-com { interactive-commands any; } } Group配置 Group配置的目的是清晰的显示目前连接的RE信息。此配置仅对配置冗余RE的路由器有用。 Set groups re0 system hostname Chassis配置 Username# Edit chassis; 进入Chassis配置子层 Username# Set redundancy routing-engine 0 master 配置RE0为主RE Username# Set redundancy failover on-loss-of-keepalive Username# Set redundancy failover on-disk-failure 配置冗余RE的切换条件:丢失Keepalive或者硬盘故障 Username# Set redundancy graceful-switchover enable 启动RE的平滑切换功能 Username# Set alarm management-ethernet link-down ignore 关闭带管接口link down的告警。注:本次项目不使用带管。 System下的应用配置 Juniper路由器在缺省情况下不打开任何服务,要开启服务,均需要管理员去开启, Set system service ftp 打开FTP服务 Set system service telnet 打开FTP服务 Set interface fe-0/0/0 proxy-arp 在接口上打开ARP PROXY服务 Interface配置 此项配置内容最为烦杂,在配置时需特便仔细。为了维护方便,所有端口均配置Description,标识连接的对端设备端口。 Edit Interface 进入端口配置子层。 浙江电力共有以下几种端口类型: GE:; POS 155M/622M:核心和骨干设备配置大量的POS端口;POS端口需要配置描述、时钟、封装PPP、Sonet Option等信息;所有的POS接口均配置IP地址信息,打开MPLS功能。 E1/CE1:部分路由器的互联端口,所有E1/CE1均配置Unframe格式;所有的POS接口均配置IP地址信息,打开MPLS功能。 FE: GE端口配置实例: Set ge-0/0/0 description “ConnectToWZ-M20-GE-0/0/0” Set ge-0/0/0 mtu 1600 Set ge-0/0/0 unit 0 family inet address /30 Set ge-0/0/0 unit 0 family mpls POS端口配置实例: Set so-0/1/0 description “ConnectToWZ-M20-SO-0/0/0” Set so-0/1/0 clock internal Set so-0/1/0 encapsulation ppp Set so-0/1/0 sonet-option fcs 32 Set so-0/1/0 sonet-option payload-scrambler Set so-0/1/0 sonet-option rfc-2615 Set so-0/1/0 unit 0 family inet address /30 Set so-0/1/0 unit 0 family inet mpls E1端口配置实例: Set ce1-0/3/0 no-partition interface-type e1 Set so-0/1/0 description “ConnectToNingbo-M20-E1-0/0/0” Set e1-0/3/0 e1-option fcs 16 Set e1-0/3/0 e1-option framing g704 Set e1-0/3/0 encapsulation ppp Set e1-0/3/0 family inet address /30 Set e1-0/3/0 family inet mpls FE端口配置实例: Set fe-1/3/0 description \"connect to -rt switch\" Set fe-1/3/0 vlan-tagging Set fe-1/3/0 unit 1 vlan-id 1 family inet address /30 Set fe-1/3/0 unit 3 vlan-id 3 family inet address /24 Set fe-1/3/0 unit 1 vlan-id 4 family inet address . 24 Set fe-1/3/0 unit 1 vlan-id 5 family inet address . 24 Set fe-1/3/0 unit 1 vlan-id 6 family inet address . 24 LoopBack端口配置:loopback端口是路由器的一个虚端口,往往用来标识路由器,作为Route ID使用。 Set unit 0 family inet address /32 路由协议配置 OSPF协议配置 Ospf基本配置 Terry# edit protocols ospf 进入OSPF协议配置 Terry# set ospf area 0 interface 设置路由器接口属于ospf area 0 Terry# set ospf area 0 interface passive 设置路由器loopback接口属于ospf area 0 Terry# set ospf area 1 interface 设置路由器接口属于ospf area 1并设置其metric值 Terry# set ospf area 1 nssa // stub区域设置类似,只需将nssa改为stub 设置ospf area 1 为NSSA类型 Terry# set ospf area 1 nssa default-lsa default-metric 10 设置ospf area 1 为NSSA类型,并且为AREA 1产生一个缺省路由 Terry# set ospf area 1 nssa default-lsa type-7 设置ospf area 1 为NSSA类型,并且不向该区发送type-3的LSA Terry# set ospf area 1 nssa no-summaries 设置ospf area 1 为totally NSSA类型, Terry# set ospf area 1 area-range /22 将AREA 1的路由归纳后,传到AREA 0 OSPF邻居间认证配置 Terry# set ospf area 0 authentication-type md5 在OSPF协议AREA 0启用MD5认证方式 Terry# set ospf area 0 interface interface-name authentication md5 10 key \"$9$FJwU6CK\" 在接口上设置认证密码 Terry# set area 1 authentication-type simple 在OSPF协议AREA 1启用明文认证方式 Terry# set area 1 interface interface-name authentication simple-password \"$9$bUY4ZQO\" 在接口上设置认证密码 路由重发布 ### 以一个路由器把从RIP学来的路由重发布到OSPF中为例来说明### 1,配置重发布的策略 Terry# edit policy-options policy-statement rip-ospf 编辑一个策略,名字为rip-ospf,目的是把从RIP学来的路由,发布到OSPF中去 terry# set term 1 from protocol rip //来自于RIP协议的路由 terry# set term 1 then accept //发布到OSPF terry# set term 2 from route-filter /24 exact //来自路由表中的一个确定的路由 terry# set term 2 then accept //重发布到OSPF中去 terry# set term 3 then reject //其他的路由不做重发布 2,应用重发布的策略 terry# set protocols ospf export rip-ospf OSPF配置示例: protocols { ospf { reference-bandwidth 1g; area { authentication-type md5; ## Warning: 'authentication-type' is deprecated interface { authentication { md5 10 key \"$9$FJwU6CuKvLX-w\"; ## SECRET-DATA } } interface { interface-type nbma; authentication { md5 10 key \"$9$fQ39SyKvLN\"; ## SECRET-DATA } } interface { passive; } } area { nssa { default-lsa { default-metric 10; metric-type 2; type-7; } no-summaries; } area-range /22; interface { metric 20; } interface { metric 20; } } } } se protocols ospf reference-bandwidth 1g se protocols ospf area authentication-type md5 set protocols ospf area interface authentication md5 10 key \"$9$FJwU6CuKvLX\" se protocols ospf area interface interface-type nbma se protocols ospf area interface authentication md5 10 key \"$9$fQ39SyKvLN\" set protocols ospf area interface passive set protocols ospf area nssa default-lsa default-metric 10 set protocols ospf area nssa default-lsa metric-type 2 set protocols ospf area nssa default-lsa type-7 set protocols ospf area nssa no-summaries set protocols ospf area area-range /22 set protocols ospf area interface metric 20 set protocols ospf area interface metric 20 IBGP协议配置 terry# set protocols bgp group 设置一个IBGP GROUP,类型为internal terry# set protocols bgp group 设置本地地址,一般为本机LOOPBACK地址 terry# set protocols bgp group 设置路由重发布,把特定的路由发布到BGP中去,policy的写法见OSPF中的路由重发布 terry# set protocols bgp group 设置邻居地址。一般是邻居的Loopback地址。 terry# set routing-options autonomous-system 612 设置本机的AS号 案例: terry# set protocols bgp group internal type internal terry# set protocols bgp group internal local-address terry# set protocols bgp group internal export ibgp terry# set protocols bgp group internal neighbor terry# set protocols bgp group internal neighbor terry# set protocols bgp group internal neighbor terry# set protocols bgp group internal neighbor terry# set protocols bgp group internal neighbor terry# set protocols bgp group internal neighbor protocols { bgp { group internal { type internal; local-address ; export ibgp; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; } EBGP协议配置 terry# set protocols bgp group 设置一个IBGP GROUP,类型为external terry# set protocols bgp group 设置邻居的地址和AS号 例: terry# set protocols bgp group ext type external terry# set protocols bgp group ext neighbor peer-as 65222 RR配置 Terry# set protocols bgp group 通过Cluster命令在BGP协议中启用RR功能, 例: set protocols bgp group internal type internal set protocols bgp group internal local-address set protocols bgp group internal cluster set protocols bgp group internal neighbor set protocols bgp group internal neighbor set protocols bgp group internal neighbor set protocols bgp group internal neighbor set protocols bgp group internal neighbor set protocols bgp group internal neighbor group internal { type internal; local-address ; cluster ; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; } **** BGP协议的路由重分发与OSPF的路由重分发配置相同**** MPLS协议配置 采用LDP信令建LSP terry# set interfaces 首先在接口上配置支持MPLS协议 terry# set protocols mpls interface 启用MPLS协议,并且指定MPLS协议所作用的接口,若为all参数时,则所有支持MPLS协议的接口均参与MPLS的运行 terry# set protocols ldp interface 启用LDP信令协议, 例: terry# set interfaces em7 unit 1 vlan-id 57 terry# set interfaces em7 unit 1 family inet address /30 terry# set interfaces em7 unit 1 family iso terry# set interfaces em7 unit 1 family mpls terry# set interfaces em7 unit 2 vlan-id 47 terry# set interfaces em7 unit 2 family inet address /30 terry# set interfaces em7 unit 2 family iso terry# set interfaces em7 unit 2 family mpls terry# set interfaces em7 unit 3 vlan-id 71 terry# set interfaces em7 unit 3 family inet address /30 terry# set interfaces em7 unit 4 vlan-id 404 terry# set interfaces em7 unit 4 family inet address /30 terry# set interfaces em7 unit 4 family iso terry# set interfaces em7 unit 4 family mpls terry# set protocols mpls interface all terry# set protocols ldp interface terry# set protocols ldp interface interfaces { em7 { unit 1 { vlan-id 57; family inet { address /30; } family iso; family mpls; } unit 2 { vlan-id 47; family inet { address /30; } family iso; family mpls; } unit 3 { vlan-id 71; family inet { address /30; } } unit 4 { vlan-id 404; family inet { address /30; } family iso; family mpls; } } lo0 { unit 7 { family inet { address /32; } family iso { address } } } } protocols { mpls { interface all; } ldp { traffic-statistics { file ldp-stats; interval 90; } keepalive-interval 5; interface ; interface ; } 采用RSVP信令建LSP terry# set interfaces 首先在接口上配置支持MPLS协议 terry# set protocols mpls interface 启用MPLS协议,并且指定MPLS协议所作用的接口,若为all参数时,则所有支持MPLS协议的接口均参与MPLS的运行 terry# set protocols rsvp interface 启用RSVP信令协议, RSVP与LDP不同的是,RSVP不会自动建立LSP。需要手工建立, terry# set protocols mpls label-switched-path 建立并命名一个到另一路由器的LSP通道 例: terry# set interfaces em7 unit 1 vlan-id 57 terry# set interfaces em7 unit 1 family inet address /30 terry# set interfaces em7 unit 1 family iso terry# set interfaces em7 unit 1 family mpls terry# set interfaces em7 unit 2 vlan-id 47 terry# set interfaces em7 unit 2 family inet address /30 terry# set interfaces em7 unit 2 family iso terry# set interfaces em7 unit 2 family mpls terry# set interfaces em7 unit 3 vlan-id 71 terry# set interfaces em7 unit 3 family inet address /30 terry# set interfaces em7 unit 4 vlan-id 404 terry# set interfaces em7 unit 4 family inet address /30 terry# set interfaces em7 unit 4 family iso terry# set interfaces em7 unit 4 family mpls terry# set protocols mpls interface all terry# set protocols rsvp interface all terry# set protocols mpls label-switched-path r7-r3 to terry# show interfaces { em7 { unit 1 { vlan-id 57; family inet { address /30; } family iso; family mpls; } unit 2 { vlan-id 47; family inet { address /30; } family iso; family mpls; } unit 3 { vlan-id 71; family inet { address /30; } } unit 4 { vlan-id 404; family inet { address /30; } family iso; family mpls; } } lo0 { unit 7 { family inet { address /32; } family iso { address } } } } protocols { rsvp { interface all; } mpls { label-switched-path r7-r3 { to ; } interface all; } } VPN配置 Instance配置 # set routing-instances 设置一个新的instance,并且类型设置为VRF set routing-instances 配置这个VRF中所使用的接口地址 set routing-instances 配置VPN的路由标识号 set routing-instances 配置vrf-target set routing-instances 配置和CE之间所运行的路由协议 MBGP的配置 # set protocol bgp group 配置MBGP来支持VPN的数据传输,只需在BGP原来的配置中增加 family inet- unicast即可 例: group internal { type internal; local-address ; family inet- { unicast; } cluster ; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; neighbor ; } Class of Service配置 Class of Service,简称CoS,提供基于业务的QOS功能;其基本原理是根据业务特征进行分类,对不同的业务提供不同的转发策略。 业务特征可以根据接口、源和目的IP地址、源和目的端口号进行部署,本次项目中,不同业务通过不同端口接入,所以,根据路由器接入端口进行业务分类是最合适的做法。 因为COS相对比较复杂,需要多个配置步骤才能完成,所以COS配置我们以一个例子来说明如何配置 假设网络中有两个VPN:-nrt 和 -rt 我们要对这两个VPN进行COS控制 配置步骤如下: Edit class-of-service 进入Class of service配置目录; Set forwarding-class queue 1 -nrt Set forwarding-class queue 2 -rt 定义两个业务队列,queue1为-nrt队列,queue2为-rt队列 Set classifiers exp classifier1 forwarding-class -rt loss-priority low code-points 100 Set classifiers exp classifier1 forwarding-class -nrt loss-priority low code-points 010 此处定义一个分类器,转发类型-rt和-nrt,对两种业务标识不同的EXP字段,-rt为100,-nrt为010。路由器转发分类可以根据IP TOS字段或者MPLS EXP字段进行定义,用EXP位进行业务流标记。此分类器加载在路由器端口上。 Set rewrite-rules exp rewrite1 forwarding-class -rt loss-priority low code-point 100 Set rewrite-rules exp rewrite1 forwarding-class -nrt loss-priority low code-point 010 定义两个Rewrite规则,是对进入路由器的流量进行EXP位的重写。 Set schedulers -rt transmit-rate percent 30 Set schedulers -rt priority strict-high Set schedulers -nrt transmit-rate percent 30 Set schedulers -nrt priority high 定义-rt和-nrt的调度规则,每个VPN均拥有广域网带宽的30%,本次项目的两个VPN均需要较高的优先级,分别占据strict-high和high转发优先级。 Set scheduler-maps scheduler-map1 forwarding-class -rt scheduler -rt Set scheduler-maps scheduler-map1 forwarding-class -nrt scheduler -nrt 把转发优先级和调度机制进行映射,forwarding-class -rt映射的调度机制是scheduler -rt;forwarding-class -nrt映射的调度机制是scheduler -nrt; Set interface fe-2/3/ forwarding-class -rt Set interface fe-2/3/ forwarding-class -rt Set interface fe-2/3/ forwarding-class -nrt Set interface fe-2/3/ forwarding-class -nrt 配置业务接入接口到相应的forwarding-class。 Set so-0/0/0 unit 0 scheduler-map scheduler-map1 Set so-0/0/0 unit 0 classifiers exp classifier1 Set so-0/0/0 unit 0 rewrite-rules exp rewrite1 Set e1-0/0/0 unit 0 scheduler-map scheduler-map1 Set e1-0/0/0 unit 0 classifiers exp classifier1 Set e1-0/0/0 unit 0 rewrite-rules exp rewrite1 所有的广域网接口均需配置调度规则、分类器和Rewrite规则 因篇幅问题不能全部显示,请点此查看更多更全内容
Copyright © 2019- sarr.cn 版权所有 赣ICP备2024042794号-1
违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com
本站由北京市万商天勤律师事务所王兴未律师提供法律服务