Juniper EX系列交换机命令行配置手册
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Juniper EX系列交换机命令行配置手册
目录
第一章交换机基础知识 (7)
1.1认识J UNIPER交换机 (7)
1.2J UNOS操作系统基础 (10)
1.2.1 交换机配置模式 (10)
1.2.2 交换机配置结构 (11)
1.2.3 TAB和空格键的使用 (16)
1.2.4 用户模式和配置模式show的区别 (17)
1.2.5 如何将配置转换成set命令 (20)
1.2.6 commit和rollback (21)
1.3EX交换机命令菜单结构 (23)
第二章操作指导 (36)
2.1通过CONSOLE线连接交换机 (36)
2.2 SYSTEM系统参数配置 (37)
2.2.1设置root密码 (38)
2.2.2设置主机名 (38)
2.2.3设置DNS服务器 (38)
2.2.4设置日期时间 (38)
2.2.5设置NTP服务器 (39)
2.2.6开启远程Telnet登陆服务 (39)
2.2.7开启远程Ftp服务 (40)
2.2.8开启远程ssh登陆 (40)
2.2.9开启远程http登陆服务 (40)
2.2.10添加/删除用户 (41)
2.2.10.1添加用户 (41)
2.2.10.2修改用户类别 (41)
2.2.10.3 修改用户密码 (42)
2.2.11用户权限设置 (42)
2.3VLAN配置 (44)
2.3.1 VLAN配置步骤 (44)
2.3.2 VLAN配置规范要求 (45)
2.3.3 添加VLAN (45)
2.3.4 修改端口VLAN (47)
2.3.5 删除VLAN (48)
2.3.6 配置VLAN网关IP (48)
2.4T RUNK配置 (48)
2.4.1 Trunk配置步骤 (49)
2.4.2如何设置Trunk (49)
2.4.3允许/禁止VLAN通过Trunk (49)
2.5端口配置 (49)
2.5.1端口配置规范要求 (49)
2.5.2修改端口速率 (50)
2.5.3修改端口工作模式 (50)
2.5.4修改端口为L3模式 (50)
2.5.5 修改端口为L2模式 (51)
2.6生成树配置 (51)
2.6.1 RSTP协议概览 (51)
2.6.2 MSTP协议概览 (54)
2.6.3 STP配置实例(生成树) (56)
2.6.4 RSTP配置实例(快速生成树) (57)
2.6.5 MSTP配置实例(多生成树协议) (63)
2.7端口捆绑 (68)
2.7.1 端口捆绑步骤 (68)
2.8ECMP负载均衡配置 (70)
2.9路由协议配置 (72)
2.9.1 静态路由配置 (72)
2.9.1.1添加静态路由 (72)
2.9.1.2 删除静态路由 (72)
2.9.1.3调整静态路由优先值 (72)
2.9.1.4设置备份静态路由 (72)
2.9.1.5指定静态路由下一跳端口 (73)
2.9.2 OSPF配置 (73)
2.9.2.1 OSPF配置步骤 (73)
2.9.2.2 OSPF配置实例(单区域) (77)
2.9.2.3 OSPF路由过滤 (80)
2.10端口镜像 (81)
2.10.1 端口镜像的概述 (81)
2.10.2 端口镜像的目的 (82)
2.10.3 端口镜像的功能 (82)
2.10.4 端口镜像工作原理 (82)
2.10.5 端口输入输出流量镜像 (84)
2.10.6 带过滤条件的端口镜像 (85)
2.11端口MAC地址限制 (87)
2.12端口广播风暴控制 (87)
2.13VRRP虚拟路由冗余协议 (88)
2.13.1 VRRP概览 (88)
2.13.2 VRRP工作原理 (89)
2.13.3 如何配置VRRP (90)
2.14BFD配置(双向转发检测) (94)
2.14.1 BFD概览 (94)
2.14.2 BFD介绍 (95)
2.14.3 BFD的报文格式 (95)
2.14.4检测模式 (97)
2.14.5发送周期及检测时间 (98)
2.14.6参数修改 (99)
2.14.7会话建立 (99)
2.14.8BFD的标准化 (102)
2.14.9OSPF中配置BFD (103)
2.14.10静态路由中配置BFD (103)
2.15交换机F IREWALL限制功能 (104)
2.15.1限制IP地址 (104)
2.15.2限制MAC地址 (105)
2.16V IRTUAL-C HASSIS设置 (105)
2.16.1VC知识 (106)
2.16.2如何建立VC组 (107)
2.16.3如何扩充VC组交换机 (109)
2.16.4如何利用uplink链路组成VC (110)
2.16.5如何对VC组进行切换 (113)
2.17SNMP配置 (113)
2.17.1SNMP协议概览 (113)
2.17.2SNMP基本简介 (113)
2.17.3配置SNMP (114)
2.18S YSLOG配置 (116)
第三章交换机维护操作 (116)
3.1交换机启动和关闭 (116)
3.1.1 交换机重启 (116)
3.1.2交换机关闭 (116)
3.2配置备份和恢复 (117)
3.2.1 交换机文件备份 (117)
3.2.2配置文件的恢复 (119)
3.3如何升级交换机OS (119)
3.4如何恢复出厂设置 (120)
3.5密码恢复 (120)
3.6日常维护命令 (122)
3.6.1查看序列号show chassis hardware (123)
3.6.2查看硬件show chassis hardware (123)
3.6.3查看软件版本show version (123)
3.6.4查看CPU show chassis routing-engine (123)
3.6.5ping命令 (123)
3.6.6查看设备告警信息 show chassis alarms (123)
3.6.7查看详细的硬件温度及状态信息 show chassis environment (123)
3.6.8查看接口VRRP状态信息show vrrp (123)
第一章交换机基础知识
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
EX 3200-48T前面面板
EX 3200-48T 后面面板
USB
GbE
管理口Console
可插拔uplink模
块
LCD
电源模块
风扇模块
RPS 连接头
至少8 PoE端口
EX 4200-48T 前面面板EX 4200-48T Rear View
VCP (Virtual Chassis Port) 0 and
1USB GbE
管理
口
Console
可插拔uplink模
块
LCD
冗余可热插拔电源模块
可插拔风扇模块
至少8 PoE端口
1.2 Junos操作系统基础
Juniper交换机支持两种配置方式:采用命令行的CLI(command-line interface)配置方式,以及采用web浏览器界面JWeb配置方式。
本指导书主要是采用命令行的配置方
式。
交换机配置可以采用console终端配置方式,也可以采用远程telnet方式进行配置,第一次配置的时候必须采用console方式,然后在交换机上打开telnet服务并且配置网络IP 地址以及设置用户名和密码,然后才可以进行远程telnet配置。
系统初始化用户名是
root,密码是空。
1.2.1 交换机配置模式
CLI有两种模式:用户模式和配置模式,用户模式的提示符是>,配置模式的提示符是#,在用户模式下输入configure或者edit可以进入配置模式:
用户模式:
lab@EX4200> #用户模式
在用户模式下可以显示交换机的配置、端口状态、路由信息等。
登录到交换机上即进入交换机的用户模式:
Example:
login: root
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:
<value> 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;
quiet-period seconds;
reauthentication {
interval seconds;
}
retries number;
server-timeout seconds;
supplicant (single | single-secure | multiple); supplicant-timeout seconds;
transmit-period seconds;
}
}
gvrp {
<enable | disable>;
interface (all | [interface-name]) {
disable;
}
join-timer millseconds;
leave-timer milliseconds;
leaveall-timer milliseconds;
}
igmp-snooping {
traceoptions {
file filename <files number> <size size> <world-readable | no-world-readable> <match regex>;
flag flag (detail | disable | receive | send);
}
vlan (vlan-id | vlan-number {
disable {
Interface interface-name
}
immediate-leave;
interface interface-name {
multicast-router-interface;
static {
group ip-address;
}
}
query-interval seconds;
query-last-member-interval seconds;
query-response-interval seconds;
robust-count number;
}
}
lldp { //设置链路层自动检测协议(Link Layer Detection Protocol) disable;
advertisement-interval seconds;
hold-multiplier number;
interface (all | interface-name) {
disable;
}
traceoptions {
file filename <files number> <size size> <world-readable | no-world-readable> <match regex>;
flag flag (detail | disable | receive | send);
}
transmit-delay seconds;
}
lldp-med {
disable;
fast-start number;
interface (all | interface-name) {
disable;
location {
elin number;
civic-based {
what number;
country-code code;
ca-type {
number {
ca-value value;
}
}
}
}
}
}
mstp {
disable;
bpdu-block-on-edge;
bridge-priority priority; configuration-name name; forward-delay seconds;
hello-time seconds;
interface (all | interface-name) { disable;
bpdu-timeout-action {
block;
alarm;
}
cost cost;
edge;
mode mode;
no-root-port;
priority priority;
}
max-age seconds;
max-hops hops;
msti msti-id {
vlan (vlan-id | vlan-name);
interface interface-name {
disable;
cost cost;
edge;
mode mode;
priority priority;
}
}
revision-level revision-level;
traceoptions {
file filename <files number > <size size> <no-stamp | world-readable | no-world-readable>;
flag flag;
}
}
rstp {
disable;
bpdu-block-on-edge;
bridge-priority priority;
forward-delay seconds;
hello-time seconds;
interface (all | interface-name) {
disable;
bpdu-timeout-action {
block;
alarm;
}
cost cost;
edge;
mode mode;
no-root-port;
priority priority;
}
max-age seconds;
}
traceoptions {
file filename <files number > <size size> <no-stamp | world-readable | no-world-readable>;
flag flag;
}
stp {
disable;
bridge-priority priority;
forward-delay seconds;
hello-time seconds;
interface (all | interface-name) {
disable;
bpdu-timeout-action {
block;
alarm;
}
cost cost;
edge;
mode mode;
no-root-port;
priority priority;
}
max-age seconds;
}
traceoptions {
file filename <files number > <size size> <no-stamp | world-readable | no-world-readable>;
flag flag;
}
}
ethernet-switching-options {
analyzer {
name {
loss-priority priority;
ratio number;
input {
ingress {
interface (all | interface-name);
vlan (vlan-id | vlan-name);
}
egress {
interface (all | interface-name);
}
output {
interface interface-name;
vlan (vlan-id | vlan-name);
}
}
}
bpdu-block {
interface (all | [interface-name]);
disable-timeout timeout;
}
redundant-trunk-group {
group-name name {
interface interface-name <primary>;
}
}
secure-access-port {
interface (all | interface-name) {
allowed-mac {
mac-address-list;
}
(dhcp-trusted | no-dhcp-trusted );
mac-limit limit action action;
static-ip ip-address {
vlan vlan-name;
mac mac-address;
}
}
vlan (all | vlan-name) {
(arp-inspection | no-arp-inspection ); (examine-dhcp | no-examine-dhcp );
(ip-source-guard | no-ip-source-guard); mac-move-limit limit action action;
}
}
storm-control {
interface (all | interface-name) {
level level;
no-broadcast;
no-unknown-unicast;
}
}
traceoptions {
file filename <files number> <no-stamp> <replace> <size size> <world-readable | no-world-readable>;
flag flag <disable>;
}
voip {
interface (all | [interface-name | access-ports]) {
vlan vlan-name ;
forwarding-class <assured-forwarding | best-effort | expedited-
forwarding | network-control>;
}
}
}
firewall {
family family-name {
filter filter-name {
term term-name {
from {
match-conditions;
}
then {
action;
action-modifiers;
}
}
}
}
policer policer-name {
if-exceeding {
bandwidth-limit bps;
burst-size-limit bytes;
}
then {
policer-action;
}
}
}
snmp {
rmon {
history index {
bucket-size number;
interface interface-name;
interval seconds;
owner owner-name;
}
}
}
virtual-chassis {
mac-persistence-timer seconds;
preprovisioned;
member member-id {
mastership-priority number;
no-management-vlan;
serial-number;
role;
}
traceoptions {
file filename <files number> <size size> <world-readable | no-world-readable>
<match regex>;
flag flag ;
}
}
第二章操作指导
2.1通过console线连接交换机
使用下面的步骤连接路由器的Console接口:
✓准备好EX交换机设备自带的Console线缆(如果没有的话,采用Cisco或者安耐特等厂家的Console线也可以)
✓将Console线缆的DB9插头一头插到PC或者笔记本电脑的COM口上,另外一端插到路由器的CONSOLE口上。
✓打开计算机中的终端软件工具。
例如:CRT或者Windows自带的超级终端。
设置如下:
⏹端口:选择第二步中Console线缆插入到PC上的端口,通常为COM 1或者COM
2
⏹波特率:9600
⏹数据位:8位
⏹奇偶校验:无
⏹停止位:1位
⏹数据流控制:无
✓打开配置到的CRT或者超级终端,按“Enter”键,屏幕出现登陆的提示符,即连接成功。
如果没有显示,请检查线缆或者终端的配置是否正确。
2.2 system系统参数配置
system是属于EX交换机基本配置部分,在进行其它配置之前需要先完成该部分内容配置,主要配置工作如下:
(1)设置root密码
(2)设置主机名
(3)设置日期时间
(4)添加用户
(5)开启ssh/telnet/http服务
(6)设置DNS(可选配置)
(7)分配新的用户权限(可选配置)
(8)设置NTP服务器(可选配置)
2.2.1设置root密码
交换机初始化用户名是root是没有密码的,在进行commit之前必须修改root密码。
修改root密码命令:
2.2.2设置主机名
设置命令:
2.2.3设置DNS服务器
设置命令:
删除命令:
2.2.4设置日期时间
设置命令:
2.2.5设置NTP服务器
设置命令:
删除命令:
2.2.6开启远程Telnet登陆服务
说明:在默认缺省配置下,EX交换机只是开放了http远程登陆方式,因此如果想通过telnet登陆到交换机上,必须在系统中打开telnet服务。
设置命令:
删除命令:
2.2.7开启远程Ftp服务
✧说明:在默认缺省配置下,EX交换机只是开放了http远程登陆方式,因此如果想通
过ftp上传文件,例如OS或者配置到交换机上,必须在系统中打开ftp服务。
设置命令:
删除命令:
2.2.8开启远程ssh登陆
✧说明:如果想通过更加安全的ssh登陆到交换机,需要在交换机上打开ssh服务。
设置命令:
删除命令:
2.2.9开启远程http登陆服务
✧说明:在默认缺省配置下,EX交换机已经开放了http远程登陆方式。
设置命令:
删除命令:
2.2.10添加/删除用户
2.2.10.1添加用户
2.2.10.2修改用户类别
operator permissions [ clear network reset trace view ] read-only permissions [ view ]
super-user permissions [ all ]
unauthorized permissions [ none ]
2.2.10.3 修改用户密码
2.2.10.4删除用户
2.2.11用户权限设置
➢先创建一个新的用户类别,指定该用户类别具有的权限
access Can view access configuration
access-control Can modify access configuration
admin Can view user accounts
admin-control Can modify user accounts
all All permission bits turned on
clear Can clear learned network info
configure Can enter configuration mode
control Can modify any config
field Can use field debug commands
firewall Can view firewall configuration
firewall-control Can modify firewall configuration
floppy Can read and write the floppy
flow-tap Can view flow-tap configuration
flow-tap-control Can modify flow-tap configuration flow-tap-operation Can tap flows
interface Can view interface configuration
interface-control Can modify interface configuration maintenance Can become the super-user
network Can access the network
reset Can reset/restart interfaces and daemons rollback Can rollback to previous configurations routing Can view routing configuration
routing-control Can modify routing configuration
secret Can view secret statements
secret-control Can modify secret statements
security Can view security configuration
security-control Can modify security configuration
shell Can start a local shell
snmp Can view SNMP configuration
snmp-control Can modify SNMP configuration
system Can view system configuration
system-control Can modify system configuration
trace Can view trace file settings
trace-control Can modify trace file settings
view Can view current values and statistics
view-configuration Can view all configuration (not including secrets)
➢新建/修改用户并指定该用户类别为刚才创建的类别:
2.3 VLAN配置
VLAN是交换机最重要的一个功能。
EX交换机关于VLAN配置的菜单有三层,首先是
vlans菜单层次,在vlans(通过edit vlans可以进入vlans菜单里面)里面可以创建
vlan,而创建vlan的时候可以指定名字和vlan id。
在EX端口下面,可以指定该端口属于哪个VLAN。
EX交换机支持三层功能,如果要在交换机上配置三层VLAN 网关,需要先创建一个vlan interface子端口,然后将这个端口和VLAN号关联起来. interfaces vlan是EX的三层端口,而不同VLAN通过不同的unit xx子端口来产生(xx为子端口号),子端口号最好能跟VLAN号统一起来。
(例如 interface vlan.100表示interface vlan unit 100,类似于cisco 的interface vlan100)
2.3.1 VLAN配置步骤
如果创建一个名字为lab_vlan的VLAN 10,并且网关设置为192.168.1.1/24,ge-0/0/1属于该VLAN。
步骤:
(1)创建一个VLAN,指定VLAN名称和ID号
set vlans “lab_vlan” vlan id 10
(2)将交换机端口修改为access模式加入到新创建的VLAN中
set interfaces ge-0/0/1 unit 0 family ethernet-switching port-mode access
set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10
(3)创建3层VLAN子端口,并且将子端口和VLAN关联:
set interfaces vlan unit 10 family inet address 192.168.1.1/24
set vlans vlan l3-interface vlan.10 //vlan子端口和VLAN对应起来
2.3.2 VLAN配置规范要求
(1)指定VLAN名称
(2)设置端口VLAN的时候指定端口为access模式
(3)设置interface vlan子端口的时候,unit子端口号要跟vlan id一致。
2.3.3 添加VLAN
➢创建vlan
➢将端口加入到指定vlan
➢Vlan检查命令
lab@EX4200-1# run show vlans
Name Tag Interfaces
default
ge-0/0/7.0*,(*表示正在使用的接口) ge-0/0/14.0*, ge-0/0/17.0, ge-0/0/18.0, ge-0/0/19.0, ge-0/0/20.0, ge-0/0/21.0, ge-0/0/22.0, ge-
0/0/23.0
juniper_vlan 20
ge-0/0/2.0
lab_vlan 10
ge-0/0/1.0
mgmt
bme0.32769
[edit]
lab@EX4200-1#
lab@EX4200-1> show ethernet-switching interfaces
Interface State VLAN members Blocking
bme0.32769 down mgmt unblocked
ge-0/0/7.0 up default unblocked
ge-0/0/14.0 up default unblocked
ge-0/0/17.0 down default unblocked
ge-0/0/18.0 down default unblocked
ge-0/0/19.0 down default unblocked
ge-0/0/20.0 down default unblocked
ge-0/0/21.0 down default unblocked
ge-0/0/22.0 down default unblocked
ge-0/0/23.0 down default unblocked
ge-1/0/1.0 down lab_vlan unblocked
ge-1/0/2.0 down juniper_vlan unblocked
[edit]
lab@EX4200-1#
2.3.4 修改端口VLAN
➢将端口加入到指定vlan
2.3.5 删除VLAN
➢ 1.删除端口vlan
➢ 2.删除vlan对应的L3子端口
➢ 3.接着删除vlan配置
2.3.6 配置VLAN网关IP
2.4 Trunk配置
2.4.1 Trunk配置步骤
(1)指定需要成为Trunk的端口模式为Trunk
(2)设置Trunk端口允许通过的VLAN id。
2.4.2如何设置Trunk
➢端口修改成trunk
➢删除端口trunk模式
2.4.3允许/禁止VLAN通过Trunk
➢允许通过:允许vlan 10和vlan 20通过
➢禁止VLAN通过:不允许vlan 10通过
2.5端口配置
2.5.1端口配置规范要求
(1)在连接路由器或者交换机的时候要求指定速率和工作模式。
(2)对于普通网线要求不能将端口设置为1000M速率。
(3)和其它厂家互联,一定要在两边设置指定工作模式和端口速率,不能采用自动协商(避
免协商出现问题)
2.5.2修改端口速率
auto-negotiation Enable auto-negotiation
10m 10Mbps
100m 100Mbps
1g 1Gbps
2.5.3修改端口工作模式
automatic Automatic negotiate duplex
full-duplex Full-duplex operation
half-duplex Half-duplex operation
2.5.4修改端口为L3模式。