JuniperEX系列交换机
命令行配置手册
目 录
第一章 交换机基础知识....................................................................................................................................... 7 1.1 认识JUNIPER交换机 ......................................................................................................................................... 7 1.2 JUNOS操作系统基础......................................................................................................................................... 9
1.2.1 交换机配置模式 ........................................................................................................................................ 9 1.2.2 交换机配置结构 ...................................................................................................................................... 10 1.2.3 TAB和空格键的使用 ............................................................................................................................. 15 1.2.4 用户模式和配置模式show的区别 ...................................................................................................... 16 1.2.5 如何将配置转换成set命令................................................................................................................... 19 1.2.6 commit和rollback .............................................................................................................................. 20
1.3 EX交换机命令菜单结构 ................................................................................................................................. 22 第二章 操作指导 ................................................................................................................................................ 35 2.1通过CONSOLE线连接交换机 ......................................................................................................................... 35 2.2 SYSTEM系统参数配置 .................................................................................................................................... 36
2.2.1设置root密码 ........................................................................................................................................ 37 2.2.2设置主机名 .............................................................................................................................................. 37 2.2.3设置DNS服务器 .................................................................................................................................... 37 2.2.4设置日期时间 .......................................................................................................................................... 37 2.2.5设置NTP服务器 .................................................................................................................................... 38 2.2.6开启远程Telnet登陆服务 .................................................................................................................... 38 2.2.7开启远程Ftp服务 .................................................................................................................................. 39 2.2.8开启远程ssh登陆 .................................................................................................................................. 39 2.2.9开启远程http登陆服务 ........................................................................................................................ 39 2.2.10添加/删除用户 ...................................................................................................................................... 40
2.2.10.1添加用户 .......................................................................................................................................................... 40 2.2.10.2修改用户类别................................................................................................................................................... 40 2.2.10.3 修改用户密码 .................................................................................................................................................. 40
2
2.2.10.4删除用户 .......................................................................................................................................................... 41
2.2.11用户权限设置 ........................................................................................................................................ 41
2.3 VLAN配置 ..................................................................................................................................................... 43
2.3.1 VLAN配置步骤 .................................................................................................................................... 43 2.3.2 VLAN配置规范要求 ........................................................................................................................... 44 2.3.3 添加VLAN ........................................................................................................................................... 44 2.3.4 修改端口VLAN .................................................................................................................................... 46 2.3.5 删除VLAN ............................................................................................................................................ 46 2.3.6 配置VLAN网关IP ............................................................................................................................... 47
2.4 TRUNK配置 ..................................................................................................................................................... 47
2.4.1 Trunk配置步骤 ..................................................................................................................................... 47 2.4.2如何设置Trunk ...................................................................................................................................... 48 2.4.3允许/禁止VLAN通过Trunk ................................................................................................................ 48
2.5端口配置 .......................................................................................................................................................... 48
2.5.1端口配置规范要求 .................................................................................................................................. 48 2.5.2修改端口速率 .......................................................................................................................................... 49 2.5.3修改端口工作模式 .................................................................................................................................. 49 2.5.4修改端口为L3模式 ................................................................................................................................ 49 2.5.5 修改端口为L2模式 ................................................................................................................................ 50
2.6生成树配置 ...................................................................................................................................................... 50
2.6.1 RSTP协议概览 ...................................................................................................................................... 50 2.6.2 MSTP协议概览 ..................................................................................................................................... 53 2.6.3 STP配置实例(生成树) ..................................................................................................................... 54 2.6.4 RSTP配置实例(快速生成树) .......................................................................................................... 55 2.6.5 MSTP配置 实例(多生成树协议) .................................................................................................... 61
2.7 端口捆绑 ......................................................................................................................................................... 66
2.7.1 端口捆绑步骤 ......................................................................................................................................... 66
3
2.7.2 L2端口捆绑 ........................................................................................................................................... 67 2.7.3 L3端口捆绑 ........................................................................................................................................... 68
2.8 ECMP负载均衡配置 .................................................................................................................................... 68 2.9 路由协议配置 .................................................................................................................................................. 70
2.9.1 静态路由配置 ........................................................................................................................................ 70
2.9.1.1添加静态路由 ..................................................................................................................................................... 70 2.9.1.2 删除静态路由 ..................................................................................................................................................... 70 2.9.1.3调整静态路由优先值 ......................................................................................................................................... 70 2.9.1.4设置备份静态路由 ............................................................................................................................................. 70 2.9.1.5指定静态路由下一跳端口 ................................................................................................................................. 71
2.9.2 OSPF配置 ............................................................................................................................................ 71 2.9.2.1 OSPF配置步骤 .................................................................................................................................. 71 2.9.2.2 OSPF配置实例(单区域) ............................................................................................................... 75 2.9.2.3 OSPF路由过滤 .................................................................................................................................. 78
2.10 端口镜像 ...................................................................................................................................................... 79
2.10.1 端口镜像的概述................................................................................................................................... 79 2.10.2 端口镜像的目的................................................................................................................................... 80 2.10.3 端口镜像的功能................................................................................................................................... 80 2.10.4 端口镜像工作原理............................................................................................................................... 80 2.10.5 端口输入输出流量镜像 ....................................................................................................................... 82 2.10.6 带过滤条件的端口镜像 ....................................................................................................................... 83
2.11端口MAC地址限制 ..................................................................................................................................... 85 2.12端口广播风暴控制 ........................................................................................................................................ 85 2.13 VRRP 虚拟路由冗余协议 ............................................................................................................................ 86
2.13.1 VRRP概览 ........................................................................................................................................... 86 2.13.2 VRRP工作原理 ................................................................................................................................... 87 2.13.3 如何配置VRRP ................................................................................................................................... 88
4
2.13.4 如何检查VRRP状态 ........................................................................................................................... 90 2.13.5 如何切换VRRP ................................................................................................................................... 92
2.14
BFD配置 (双向转发检测) ................................................................................................................. 92
2.14.1 BFD概览 .............................................................................................................................................. 92 2.14.2 BFD介绍 .............................................................................................................................................. 93 2.14.3 BFD的报文格式 .................................................................................................................................. 93 2.14.4 2.14.5 2.14.6 2.14.7 2.14.8 2.14.9
检测模式 ......................................................................................................................................... 95 发送周期及检测时间 ..................................................................................................................... 96 参数修改 ......................................................................................................................................... 96 会话建立 ......................................................................................................................................... 97 BFD的标准化 .............................................................................................................................. 100 OSPF中配置BFD ....................................................................................................................... 100
2.14.10静态路由中配置BFD ....................................................................................................................... 101
2.15
交换机FIREWALL限制功能 ................................................................................................................... 101
2.15.1 2.15.2
2.16
限制IP地址 ................................................................................................................................. 102 限制MAC地址 ............................................................................................................................ 102
VIRTUAL-CHASSIS设置 .......................................................................................................................... 103
2.16.1 2.16.2 2.16.3 2.16.4 2.16.5
2.17
VC知识......................................................................................................................................... 103 如何建立VC组 ............................................................................................................................ 104 如何扩充VC组交换机 ................................................................................................................ 106 如何利用uplink链路组成VC ................................................................................................... 107 如何对VC组进行切换 ................................................................................................................ 110
SNMP配置 ............................................................................................................................................ 110
2.17.1 2.17.2 2.17.3
2.18
SNMP协议概览 .......................................................................................................................... 110 SNMP基本简介 .......................................................................................................................... 110 配置SNMP .................................................................................................................................. 111
SYSLOG配置 ........................................................................................................................................... 113
5