juniper EX8200 系列交换机配置常用命令

启用禁用一个端口

[email protected]# set interfaces ge-0/0/4 disable   #1. 关闭端口
[email protected]# delete interfaces ge-0/0/4 disable #2. 恢复端口

配置MGT口IP
[email protected]# set interfaces me0 unit 0 family inet address  192.168.1.1/24

设置接口参数

[email protected]# edit interfaces ge-0/0/1
[email protected]# set description "Connect to Juniper 6350"  #"设置端口描述"
[email protected]# set mac 00:1f:12:38:02:12      #"设置mac地址"
[email protected]# delete  mac      #"删除配置的mac地址"
[email protected]# set mtu 1526      #"设置MTU值范围是(256..9216) "
[email protected]#delete mtu        #"删除设置的MTU值"
[email protected]# set disable     #"关闭端口,类似于Cisco的shutdown"
[email protected]#delete  disable     #"恢复端口,类似于Cisco的no shutdown"

修改端口为L2/L3模式
如果将交换机端口设置为二层模式,就可以配置交换机为vlan端口或者Trunk端口;设置为三层模式,就可以当路由器三层端口一样使用,可以配置IP地址。通常在跟路由器进行点对点连接的时候将端口设置为三层模式。

[email protected]# edit interfaces ge-0/0/1
[edit interfaces ge-0/0/1]
[email protected]# delete unit 0 family inet    #"删除端口三层信息"
[email protected]# set unit 0 family ethernet-switching  #"设置为二层端口"

[email protected]# delete unit 0 family ethernet-switching   #"删除二层信息"
[email protected]# set unit 0 family inet    #设置为三层端口
[email protected]# set unit 0 family inet address 192.168.1.1/30 #"设置三层IP地址"

[email protected]# delete  unit 0  #"删除端口二层、三层信息"

VLAN配置

EX交换机除了具有二层VLAN功能之外,还具有三层VLAN路由功能。EX交换机会有一个名字为vlan的三层逻辑端口,这个三层逻辑端口可以划分多个逻辑unit单元,unit号范围是(0..16385),而每个逻辑unit单元可以配置IP地址然后跟一个VLAN绑定,实际上unit 单元号和VLAN号没有对应关系,但是为了维护方便,我们建议在实际应用中unit单元号和vlan号配置相同(如下面的vlan.10中的10是unit单元号,它实际上可以跟VLAN 20绑定,但是在实际中最好将它和vlan 10绑定),这样在EX上就可以配置不同VLAN的网关地址了。例如下面交换机划分了3个VLAN,每个VLAN对应的网关IP分别配置在vlan.10 、vlan.20以及vlan.30端口

创建VLAN

[email protected]# edit vlans zte_vlan    #"以下所有操作都是对zte_vlan进行,如果不存在则新建一个
[email protected]# set vlan-id 10   #"设置zte_vlan的vlan id"
[email protected]# set description "Server VLAN"    #"设置vlan描述"
[email protected]# set mac-table-aging-time 600 #"设置mac生存时间(秒),范围是(60-1000000) "
[email protected]# set l3-interface vlan.10  #"将绑定三层逻辑子端口"
[email protected]# set interface ge-0/0/1.0  #"将端口加入到VLAN中"
[email protected]# set interface ge-0/0/2.0  #"将端口加入到VLAN中"

创建三层逻辑子端口

[email protected]# top   #"回到最外层菜单"
[email protected]# set interfaces vlan unit 10 family inet address 192.168.1.1/24

将交换机端口修改为access模式并加入到新创建的VLAN中

[email protected]# set interfaces ge-0/0/1  unit 0 family ethernet-switching port-mode access
[email protected]# set interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10
[email protected]# set interfaces ge-0/0/2  unit 0 family ethernet-switching port-mode access
[email protected]# set interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members 10

删除VLAN

1. 删除端口vlan
[email protected]# top  
[email protected]# delete interfaces ge-0/0/1  unit 0 family ethernet-switching port-mode access
[email protected]# delete interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10
[email protected]# delete interfaces ge-0/0/2  unit 0 family ethernet-switching port-mode access
[email protected]# delete interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members 10

2. 删除vlan对应的L3子端口
[email protected]# top  
[email protected]# delete interfaces vlan unit 10

3. 接着删除vlan配置
[email protected]# top  
[email protected]# delete vlans zte_vlan

Trunk配置

[email protected]# top     #回到最外层菜单
[email protected]# delete interfaces ge-0/0/1 unit 0  #"删除端口信息"
[email protected]# edit interfaces ge-0/0/1 unit 0 family ethernet-switching
[email protected]# set port-mode trunk     #"设置端口为Trunk模式"
[email protected]# set vlan members 10   #"允许vlan 10通过"
[email protected]# set vlan members 20    #"允许vlan 20通过"

[email protected]# set vlan members all   #"允许所有vlan通过"

Trunk删除

1. 禁止单个vlan通过:
[email protected]# top     #"返回最外层菜单"
[email protected]# edit interfaces ge-0/0/1 unit 0 family ethernet-switching  
[email protected]# delete vlan members 10   #"禁止vlan 10通过 "

2.删除端口Trunk
[email protected]# top     #"返回最外层菜单"
[email protected]# edit interfaces ge-0/0/1 unit 0 family ethernet-switching  
[email protected]# delete port-mode trunk     #"删除trunk"
[email protected]# delete vlan members     #"删除端口下所有vlan"

端口聚合

EX交换机最多支持64个聚合端口,每个聚合端口可以捆绑8条物理链路, 使用set chassis aggregated-devices ethernet device-count  N命令之后,系统会产生N个名字为ae0到aeN的聚合端口。产生ae聚合端口之后,就可以将多个物理端口使用802.3ad协议绑定到指定的ae端口

[email protected]# set chassis aggregated-devices ethernet device-count 2

静态路由

设置172.16.1.0/24网段指向下一跳地址192.168.1.253
[email protected]# top
[email protected]#set routing-options static route 172.16.1.0/24 next-hop 192.168.1.253
[email protected]# set routing-options static route 172.16.1.0/24 next-hop 10.1.1.1  preference 100 指定优先级

[email protected]# delete routing-options static route 172.16.1.0/24

设置备份静态路由

#设置主用路由优先值为100
[email protected]#  set routing-options static route 172.16.1.0/24 next-hop 10.1.1.1  preference 100

#设置备份路由优先值为200,注意只能用qualified-next-hop指定下一跳地址
[email protected]#set routing-options static route 0.0.0.0/0 qualified-next-hop 20.1.1.1 preference 200

指定静态路由下一跳端口

[email protected]# set routing-options static route 0.0.0.0/0 qualified-next-hop 20.1.1.1 interface ge-0/0/1.0

交换机配置模式:

root%   CLI启动, 输入ezsetup

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

配置模式:
[email protected]> edit   #用户模式进入配置模式(edit或者configure)
[email protected]#

交换机配置结构

1. 单一命令
[email protected]# set protocols ospf area 0 interface ge-0/0/1.0 hello-interval 10

2. 逐层配置
[edit protocols]
[email protected]# edit ospf

[edit protocols ospf]
[email protected]# edit area 0

[edit protocols ospf area 0.0.0.0]
[email protected]# edit interface ge-0/0/1.0

[edit protocols ospf area 0.0.0.0 interface ge-0/0/1.0]
[email protected]# set hello-interval 10

[edit protocols ospf area 0.0.0.0 interface ge-0/0/1.0]

3. 一次配置多个命令(比如要一次配置ospf的hello-time和dead-time)
[email protected]# set protocols ospf area 0 interface ge-0/0/1.0 hello-interval 10 dead-interval 10

在edit这种方式中,exit可以退回上一次用edit进入以前的层,直接输入top则退回最上层:

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

用户模式下的show命令是查看系统参数,而在配置下show命令是显示相关的配置,如果要在配置模式下运行用户模式命令,则需要在命令前面加一个run

[email protected]# run show interfaces
[email protected]# run ping 172.27.69.8

如何将配置转换成set命令

在show后面使用管道符号加上display set将其转换成set格式命令,然后可以直接粘贴到其它交换机上。

[email protected]# 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

commit和rollback

[email protected]# commit    #使设置生效

[email protected]# rollback 1  #回退到先前的配置,rollback 2则是回滚上2次提交之前的配置:

关闭poe功能

在项目中如果没有使用到poe功能,必须通过set poe interface all disable禁止
set poe interface all disable

登陆管理
在默认缺省配置下,EX交换机只是开放了http远程登陆方式,因此如果想通过telnet登陆到交换机上,必须在系统中打开telnet服务。

1. 开启telnet登陆

[email protected]# edit system service
[email protected]# set telnet
[email protected]# set telnet connection-limit 10 #同时telnet的最大连接数 范围1-250
[email protected]# set telnet rate-limit    10 #每分钟同时最大连接数 范围1-250
[email protected]# delete telnet

2. 开启ssh登陆
EX交换机默认是没有开启SSH服务,当你打开了SSH服务而没有制定SSH的版本,系统自动支持V1和V2版本。如果你指定了SSH的版本,则系统只允许你指定版本的SSH登陆

[email protected]# edit system service

[email protected]# set ssh protocol-version v1   #"设置SSH支持V1版本"
[email protected]# set ssh protocol-version v2    #"设置SSH支持V2版本"
[email protected]# set ssh connection-limit 10  
[email protected]# set ssh rate-limit 10   
[email protected]# delete ssh

3. 开启远程web登陆服务
在默认缺省配置下,EX交换机已经开放了web管理陆方式,你可以进行配置让它支持http和https两种管理方式。如果你想对web登陆参数调整,例如修改web的tcp端口以便增强安全性,允许从哪些端口登陆进来,则需要修改参数:

[email protected]# edit system service
[email protected]# set web-management session idle-timeout 10
[email protected]# set web-management session session-limit 10
[email protected]# set web-management http   #"打开web管理功能"
[email protected]# set web-management http port 8888  #"指定web登陆的端口,范围1- 65535"
[email protected]# set web-management http interface ge-0/0/1.0  #"指定可以登陆进来的端口"
[email protected]# set web-management http interface ge-0/0/2.0  #"指定可以登陆进来的端口"
[email protected]# delete web-management http

4. 开启FTP服务
EX交换机可以配置成为一台FTP服务器,用来上传或者下载。另外,默认情况下EX交换机本身就是FTP的客户端,具有ftp的命令(跟windows下的ftp命令一样),你可以在cli模式下使用ftp命令连接到你自己设置的FTP服务器。

[email protected]# edit system service

[email protected]# set ftp
[email protected]# set ftp connection-limit 5  
[email protected]# set ftp rate-limit 5
[email protected]# delete ftp

system系统参数配置

配置方法是利用edit system进入system菜单里面然后再配置各个参数。
[email protected]# edit system

1. 设置root密码

[email protected]# edit system
[email protected]# set root-authentication plain-text-password  明文方式

[email protected]#set root-authentication encrypted-password "$1$wyUycnLW$SuAQ36PjmNEVhAYGc1VyQ0" 加密方式

2.设置主机名

[email protected]# set host-name EX4200
[email protected]# delete host-name EX4200

3. 设置DNS

[email protected]# set name-server 192.168.1.1
[email protected]# delete name-server 192.168.1.1

[edit system]显示是在system菜单下配置,所有的set参数都是针对#system菜单下生效

4. 设置日期

[email protected]# set time-zone Asia/Shanghai
[email protected]> set date 200811071441.00   时间格式 YYYYMMDDhhmm.ss

5. 设置NTP

[email protected]# set ntp server 192.168.1.1
[email protected]# set ntp authentication-key 1 type md5
[email protected]# set ntp authentication-key 1 value "password"

[email protected]# delete ntp

2.3.10   添加/删除用户-----第27页
2.3.11   用户权限设置------第28-29页

2.2   配置交换机之前要知道
1.    交换机二层和三层信息是配置在端口下的逻辑端口,而Juniper 交换机的逻辑端口是通过unit逻辑单元来实现的,unit 0是默认的逻辑端口,所有引用到二层/三层端口都是引用unit 0,例如对于物理端口ge-0/0/0,其二层和三层协议用到的逻辑端口就是ge-0/0/0.0,IP地址信息、VLAN信息等都在ge-0/0/0.0下面配置
2.    本手册配置命令格式是利用edit,通过edit进入需要配置的菜单层次,然后再使用set命令来设置相关参数,因此在看配置命令手册的提示符就可以知道配置哪个层次的参数,如下面的[edit system services]就是显示配置system下面的services参数,所有set命令都是对services生效:

[edit system services]
[email protected]# set telnet

时间: 2024-08-04 05:00:02

juniper EX8200 系列交换机配置常用命令的相关文章

Juniper EX系列交换机commit报错解决办法

公司搭系统,需要对网络进行调整,用的是Juniper EX系列交换机结果调整完配置,要commit时报错提示信息如下:root# commiterror: could not open /var/etc/pam.conf+: Operation not permittederror: commit failed: foreign file propagation failed during preprocessing 度娘没找到解决办法,上bing国际版,直接跳到Juniper英文页面,还好有救

Linux命令:网络配置常用命令

网络配置常用命令简介:    在Linux中网络属于内核的功能 1. 执行命令生成地址:(执行后立即生效,服务重启后失效) RHEL5: /etc/modprobe.conf  RHEL6: /etc/udev/rules.d/70-persistent-net.rules  alias ifconfig [ethX]     -a: 显示所有接口的配置住处      ifconfig ethX IP/MASK [up|down]     配制后立即生效,重启后网络服务或主机失效 网络服务:  

Git 使用的配置 常用命令

老文一篇 搬过来 1. git的部分配置 # 全局提交用户名与邮箱 git config --global user.name "simon" git config --global user.email [email protected]gmail.com # 中文编码支持 echo "export LESSCHARSET=utf-8" > $HOME/.profile # 下面这条配置可以使得你在GUI界面预览本地修改但为缓存时的注释乱码问题 git co

ZooKeeper系列之一:Zookeeper常用命令大神必备

ZooKeeper服务命令: 在准备好相应的配置之后,可以直接通过zkServer.sh 这个脚本进行服务的相关操作 启动ZK服务: sh bin/zkServer.sh start 查看ZK服务状态: sh bin/zkServer.sh status 停止ZK服务: sh bin/zkServer.sh stop 重启ZK服务: sh bin/zkServer.sh restart5.QQ:2606230996可以加我一起交流zk客户端命令 ZooKeeper命令行工具类似于Linux的sh

AIX网络配置常用命令

最近测试环境用到AIX系统,AIX为类UNIX系统,是IBM为自己的硬件服务器专门打造的系统. 下面记录下AIX下常用的关于网络配置命令: 网卡等设备命令 lsdev -c adapter      查看设备(比如查看网卡) mkdev -l   ent1   将网卡ent1从defined(用户定义状态)调整为available(可用)状态 mkdev -dl  ent1   -d只定义设备为defined,不会变为可用 rmdev  -l ent1      将设备从available变为d

wifi配置常用命令总结

1:iwlist eth1 scanning 查看无线路由 2:iwconfig eth1 essid "无线路由的名称" 3: ifconfig eth1 IP 4: route add default gw 网关 对于带密码的路由器,设置如下: 1:iwconfig eth1 key s:密码 2:iwconfig eth1 key open 3:ifconfig eth1 essid "名称" 4:ifconfig eth1 IP 5:route add de

华为系列交换机配置风暴抑制

配置风暴抑制事例 针对于服务器莫名其妙的发包,可参考案例 对广播.组播或未知单播报文进行风暴控制的低阈值和高阈值 风暴控制的动作 风暴控制的检测时间间隔 操作步骤: 进入接口视图 <Quidway> system-view [Quidway] interface gigabitethernet 0/0/1 配置广播风暴控制 [Quidway-GigabitEthernet0/0/1] storm-control broadcast min-rate 1000 max-rate 2000 配置组

华为S5700系列交换机配置通过流策略实现VLAN间三层隔离

组网图形 图1 配置通过流策略实现VLAN间三层隔离组网图 组网需求 如图一所示,为了通信的安全性,某公司将访客.员工.服务器分别划分到VLAN10.VLAN20.VLAN30中.公司希望: 员工.服务器主机.访客均能访问Internet. 访客只能访问Internet,不能与其他任何VLAN的用户通信. 员工A可以访问服务器区的所有资源,但其他员工只能访问服务器A的21端口(FTP服务). 配置思路 可采用如下思路配置通过流策略实现VLAN间互访控制: 1.      配置VLAN并将各接口加

Octopus系列之SQLite3常用命令

导出脚本F:\B2CShop>sqlite3 B2CDB.db .dump > test.sql 导入脚本F:\B2CShop>sqlite3 B2CDB.db < B2C-SQLite.sql F:\B2CShop>sqlite3 B2CDB.db < F:\B2CShop\B2C-SQLite.sql 创建数据库sqlite3 Octopus.db < Octopus.sql 导入数据脚本sqlite3 Octopus.db < Octopus2.0_D