文档库 最新最全的文档下载
当前位置:文档库 › Juniper配置手册

Juniper配置手册

EX3200/4200交换机命令行配置指导手册

Version 1.0

目录

1交换机基础知识 (6)

1.1认识J UNIPER交换机 (6)

1.2J UNOS操作系统基础 (8)

1.2.1 交换机配置模式 (8)

1.2.2 交换机配置结构 (9)

1.2.3 TAB和空格键的使用 (12)

1.2.4 用户模式和配置模式show的区别 (13)

1.2.5 如何将配置转换成set命令 (16)

1.2.6 commit和rollback (16)

1.3EX交换机命令菜单结构 (18)

2操作指导 (30)

2.1通过CONSOLE线连接交换机 (30)

2.2 SYSTEM系统参数配置 (31)

2.2.1 设置root密码 (32)

2.2.2 设置主机名 (32)

2.2.3 设置DNS服务器 (32)

2.2.4 设置日期时间 (32)

2.2.5 设置NTP服务器 (33)

2.2.6 开启远程Telnet登陆服务 (33)

2.2.7 开启远程Ftp服务 (33)

2.2.8 开启远程ssh登陆 (34)

2.2.9 开启远程http登陆服务 (34)

2.2.10 添加/删除用户 (34)

2.2.10.1 添加用户 (34)

2.2.10.2 修改用户类别 (35)

2.2.10.3 修改用户密码 (35)

2.2.10.4 删除用户 (35)

2.2.11 用户权限设置 (35)

2.3VLAN配置 (36)

2.3.1 VLAN配置步骤 (37)

2.3.2 VLAN配置规范要求 (37)

2.3.3 添加VLAN (37)

2.3.4 修改端口VLAN (39)

2.3.5 删除VLAN (39)

2.3.6 配置VLAN网关IP (40)

2.4.2 如何设置Trunk (40)

2.4.3 允许/禁止VLAN通过Trunk (40)

2.5端口配置 (41)

2.5.1 端口配置规范要求 (41)

2.5.2 修改端口速率 (41)

2.5.3 修改端口工作模式 (41)

2.5.4 修改端口为L3模式 (42)

2.5.5 修改端口为L2模式 (42)

2.6生成树配置 (42)

2.6.1 STP配置实例 (42)

2.6.2 RSTP配置实例 (43)

2.6.3 MSTP配置实例 (47)

2.7端口捆绑 (50)

2.7.1 端口捆绑步骤 (50)

2.7.2 L2端口捆绑 (51)

2.7.3 L3端口捆绑 (51)

2.8ECMP负载均衡配置 (51)

2.9路由协议配置 (53)

2.9.1 静态路由配置 (53)

2.9.1.1 添加静态路由 (53)

2.9.1.2 删除静态路由 (53)

2.9.1.3 调整静态路由优先值 (53)

2.9.1.4 设置备份静态路由 (53)

2.9.1.5 指定静态路由下一跳端口 (53)

2.9.2 OSPF配置 (54)

2.9.2.1 OSPF配置步骤 (54)

2.9.2.2 OSPF配置实例 (57)

2.9.2.3 OSPF路由过滤 (59)

2.10端口镜像 (59)

2.10.1 端口输入输出流量镜像 (59)

2.10.2 带过滤条件的端口镜像 (60)

2.11端口MAC地址限制 (61)

2.12端口广播风暴控制 (61)

2.13VRRP配置 (61)

2.13.3 如何切换VRRP (62)

2.14BFD配置 (63)

2.14.1 OSPF中配置BFD (63)

2.14.2 静态路由中配置BFD (63)

2.15交换机F IREWALL限制功能 (63)

2.15.1 限制IP地 (64)

2.15.2 限制MAC地址 (64)

2.16V IRTUAL-C HASSIS设置 (65)

2.17VC知识 (65)

2.17.1 如何建立VC组 (66)

2.17.2 如何扩充VC组交换机 (67)

2.17.3如何利用uplink链路组成VC (68)

2.17.4 如何对VC组进行切换 (70)

2.18SNMP配置 (70)

2.19S YSLOG配置 (71)

2.20 MULTI-VRF配置 (72)

2.21 MULTI-VRF OSPF配置 (73)

3交换机维护操作 (73)

3.1交换机启动和关闭 (74)

3.1.1 重新启动 (74)

3.1.2 关闭 (74)

3.2配置备份和恢复 (74)

3.2.1 配置备份 (74)

3.2.2 配置恢复 (75)

3.3如何升级交换机OS (76)

3.4如何恢复出厂设置 (76)

3.5密码恢复 (76)

3.6日常维护命令 (78)

3.6.1 查看序列号show chassis hardware (78)

3.6.2 查看硬件show chassis hardware (78)

3.6.3 查看软件版本show version (78)

3.6.4 查看CPU show chassis routing-engine (78)

3.6.5 ping命令 (78)

3.6.6 查看设备告警信息show chassis alarms (78)

3.6.7 查看详细的硬件温度及状态信息show chassis environment (78)

3.6.8 查看接口VRRP状态信息show vrrp (78)

3.6.9 收集CASE需要的信息request support information (79)

4如何获取技术支持 (79)

4.1技术资料获取 (79)

4.2EX交换机故障技术支持流程 (79)

4.2.1 故障申报流程 (79)

4.2.1.1 传真/电话申报 (80)

4.2.1.2 邮件申报 (80)

4.2.1.3 网上申报 (80)

4.2.2 CASE客户网上处理指南 (80)

4.2.2.1 网上登录 (80)

4.2.2.2 更改密码 (80)

4.2.2.3 新建CASE (81)

4.2.2.4 更新CASE信息/上传附件 (82)

4.2.2.5 更改CASE故障信息 (84)

4.2.2.6 重开CASE (85)

4.2.2.7 CASE统计 (86)

1 交换机基础知识1.1 认识Juniper交换机

产品型号端口数端口类型

PoE

端口数

最大电源容量

(包括 PoE)

EX 3200-24T 2410/100/1000B-T8190 (320) W EX 3200-24P 2410/100/1000B-T24190 (600) W EX 3200-48T 4810/100/1000B-T8190 (320) W EX 3200-48P 4810/100/1000B-T48190 (930) W

产品型号端口数端口类型

PoE

端口数

最大电源容量

(包括 PoE)

EX 4200-24T 24 10/100/1000B-T 8 190 (320) W EX 4200-24P 24 10/100/1000B-T 24 190 (600) W EX 4200-24F 24 100B-FX/1000B-X N/A 190 (190) W

EX 4200-48T 48 10/100/1000B-T 8

190 (320) W

EX 4200-48P 48 10/100/1000B-T 48 190 (930) W

1.2 Junos操作系统基础

Juniper交换机可以采用CLI(command-line interface)命令行配置方式,也可以采用web浏览器界面配置方式。本指导书主要是采用命令行的配置方式。

交换机配置可以采用console终端配置方式,也可以采用远程telnet方式进行配置,第一次配置的时候必须采用console方式,然后在交换机上打开telnet服务并且配置网络IP地址以及设置用户名和密码,然后才可以进行远程telnet配置。系统初始化用户名是root,密码是空。

1.2.1 交换机配置模式

CLI有两种模式:用户模式和配置模式,用户模式的提示符是>,配置模式的提示符是#,在数用户模式下输入configure或者edit可以进入配置模式:

用户模式:

lab@EX4200> #用户模式

在用户模式下可以显示交换机的配置、端口状态、路由信息等。登录到交换机上即进入交换机的用户模式:

Example:

login: ZTE

Password:

lab@EX4200>

配置模式:

lab@EX4200##配置模式

通过在用户模式使用edit命令或者configure命令进入配置模式:

Example:

lab@EX4200>edit

Entering configuration mode

{master}[edit]

lab@EX4200#

Example:

lab@EX4200>configure

Entering configuration mode

{master}[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

[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退回最外层.

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 ?

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 ?

Possible completions:

Export policy

( Open an expression

Test_Policy_1

[ Open a set of values

[edit]

也可以直接输入T之后按TAB键来补全,而此时按空格键则无法补全:

lab@EX4200# set protocols ospf export T <-输入TAB键,则会补全Test_Policy_1

lab@EX4200# set protocols ospf export Test_Policy_1

1.2.4 用户模式和配置模式show的区别

在用户模式下,是无法进行配置操作的,而只能查看系统的一些参数。所以用户模式下的show命令是查看系统参数。要看系统配置则使用show configure命令。例如用户模式下show interface是查看端口信息:

lab@EX4200> show interfaces

Physical interface: ge-0/0/1, Enabled, Physical link is Up

Interface index: 142, SNMP ifIndex: 31

Link-level type: Ethernet, MTU: 1518, Speed: 100mbps, Loopback: Disabled, Source filtering: Disabled,

Flow control: Enabled

Device flags : Present Running

Interface flags: SNMP-Traps Internal: 0x4000

CoS queues : 4 supported, 4 maximum usable queues

Current address: 00:05:85:dc:cc:db, Hardware address: 00:05:85:dc:cc:db

Last flapped : 2007-06-29 20:37:17 HKT (1w2d 00:31 ago)

Input rate : 280 bps (0 pps)

Output rate : 1280 bps (1 pps)

Active alarms : None

Active defects : None

Logical interface ge-0/0/1.0 (Index 83) (SNMP ifIndex 71)

Flags: SNMP-Traps 0x4000 VLAN-Tag [ 0x8100.33 ] Encapsulation: ENET2

Input packets : 0

Output packets: 0

Protocol inet, MTU: 1500

Flags: None

lab@EX4200>

而在配置下show命令是显示相关的配置,比如show interface则是显示interface部分的配置:

lab@EX4200# show interfaces

ge-0/0/1 {

unit 0 {

family ethernet-switching vlan members 10 ;

family inet;

}

}

[edit]

lab@EX4200#

因此说用户模式和配置模式下的show命令是不同的,如果要在配置模式下运行用户模式命令,则需要在命令前面加一个run

lab@EX4200# run show interfaces

Physical interface: ge-0/0/1, Enabled, Physical link is Up

Interface index: 142, SNMP ifIndex: 31

Link-level type: Ethernet, MTU: 1518, Speed: 100mbps, Loopback: Disabled, Source filtering: Disabled,

Flow control: Enabled

Device flags : Present Running

Interface flags: SNMP-Traps Internal: 0x4000

CoS queues : 4 supported, 4 maximum usable queues

Current address: 00:05:85:dc:cc:db, Hardware address: 00:05:85:dc:cc:db Last flapped : 2007-06-29 20:37:17 HKT (1w2d 00:36 ago)

Input rate : 792 bps (0 pps)

Output rate : 672 bps (0 pps)

Active alarms : None

Active defects : None

Logical interface ge-0/0/1.0 (Index 83) (SNMP ifIndex 71)

Flags: SNMP-Traps 0x4000 VLAN-Tag [ 0x8100.33 ] Encapsulation: ENET2 Input packets : 0

Output packets: 0

Protocol inet, MTU: 1500

Flags: None

[edit]

lab@EX4200#

lab@EX4200# run ping 172.27.69.8

PING 172.27.69.8 (172.27.69.8): 56 data bytes

64 bytes from 172.27.69.8: icmp_seq=0 ttl=64 time=5.118 ms

64 bytes from 172.27.69.8: icmp_seq=1 ttl=64 time=7.949 ms

64 bytes from 172.27.69.8: icmp_seq=2 ttl=64 time=7.018 ms

^C

--- 172.27.69.8 ping statistics ---

3 packets transmitted, 3 packets received, 0% packet loss

round-trip min/avg/max/stddev = 5.118/6.695/7.949/1.178 ms

[edit]

lab@EX4200#

lab@EX4200# run ping 172.27.69.8命令等同于lab@EX4200> ping 172.27.69.8

1.2.5 如何将配置转换成set命令

在配置模式下使用show或者在用户模式下使用show configure命令,输出结果是“程序化”

的配置,这样的配置并不能直接粘贴到另外一台交换机上,不过可以在show后面使用管道符号加上display set将其转换成set格式命令,然后可以直接粘贴到其它交换机上:

lab@EX4200# show protocols ospf

export Test_Policy_1;

area 0.0.0.0 {

interface ge-0/0/1.0 {

hello-interval 10;

}

}

[edit]

lab@EX4200# show protocols ospf | display set

set protocols ospf export Test_Policy_1

set protocols ospf area 0.0.0.0 interface ge-0/0/1.0 hello-interval 10

[edit]

lab@EX4200#

1.2.6 commit和rollback

在cisco中只要输入命令,回车之后命令马上生效,因为我们修改的就是系统正在使用的running-config配置文件。而在JUNOS中完全不同,我们操作(增加、删除、修改)的那份配置文件只是一个候选文件(candidate configure),并不是正在运行的配置文件,只有将候选文件通过commit提交之后,配置才会真正的应用到当前系统使用的active配置文件中,从而使得修改的配置生效。

为了检查配置是否有错,可以在commit之前使用commit check来对配置进行语法检查。

为了避免提交时出错,建议不要同时两个人修改配置。

如果提交之后,可以使用rollback进行回滚,rollback 1回滚上一次提前之前的配置,rollback 2则是回滚上2次提交之前的配置:

lab@EX4200# show system host-name

host-name EX4200;

[edit]

lab@EX4200# set system host-name R1

[edit]

lab@EX4200# commit

commit complete

[edit]

lab@EX4200# show system host-name

host-name EX4200;

[edit]

lab@EX4200# rollback 1

load complete

[edit]

lab@EX4200# show system host-name

host-name EX4200;

[edit]

lab@EX4200# commit

commit complete

[edit]

lab@EX4200#

1.3 EX交换机命令菜单结构

vlans {

vlan-name { //vlan名字,自定义,下面所有参数都是针对该vlan

mac-limit action; //设置vlan允许的最大mac

description text-description; //vlan描述

filter input filter-name; //设置VLAN输入流量过滤条件

filter output filter-name; //设置VLAN输出流量过滤条件

l3-interface vlan.logical-interface-number; //将vlan绑定到L3的vlan子端口

mac-table-aging-time seconds; //设置vlan 的mac表生存时间

vlan-id number; //设置vlan id

vlan-range vlan-id-low-vlan-id-high; //同时创建多个vlan

}

}

chassis {

aggregated-devices {

ethernet {

device-count number; //设置聚合端口数量,范围是0-64

}

}

}

interfaces {

ae-x {

aggregated-ether-options { //设置聚合端口参数

lacp mode { //设置lacp模式

periodic fast/slow; //设置lacp包发送间隔时间,选择fast则隔1秒发送,选择

//slow每隔30秒发送

}

}

}

ge-chassis/pic/port { //设置ge端口参数

description text; //设置描述

ether-options { //ether-options参数

802.3ad ae x; //指定加入的聚合端口

auto-negotiation; //自动协商

flow-control; //流控制

link-mode mode; //设置端口工作模式

speed (speed | auto-negotiation | no-autonegotiation); //设置端口速率

}

mtu bytes; //设置端口MTU值,默认是1514

unit logical-unit-number { //设置逻辑单元参数

family ethernet-switching { //设置L2参数

filter input filter-name; //设置二层输入包过滤条件

filter output filter-name; //设置二层输出包过滤条件

l3-interface interface-name-logical-unit-number; //在Trunk端口模式下设置允许通过的

//L3端口流量

native-vlan-id vlan-id //指定navite vlan id

port-mode mode; //设置端口L2工作模式,为Trunk或者access模式

vlan {

members [ (names | vlan-ids) ]; //设置端口属于哪个VLAN或者允许哪些VLAN通过

}

}

vlan-id vlan-id-number; //仅对GE或者ae端口有效,范围是1 t到 4094

}

vlan-tagging; //设置端口为vlan-tagging

}

}

protocols {

dot1x {

authenticator {

authentication-profile-name access-profile-name;

static {

mac-address {

vlan-assignment (vlan-id |vlan-name);

interface interface-names;

}

}

interface (all | interface-name) {

disable;

guest-vlan (vlan-name | vlan-id);

maximum-requests seconds;

no-reauthentication;

相关文档