juniper交换机日常维护常用配置方式
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了juniper交换机日常维护常用配置方式相关的知识,希望对你有一定的参考价值。
juniper 设备和其他厂商有所不同,采用提交生效的配置理念。大大减少了误操作。注:所有配置配置完毕后不会立即生效,需要commit提交生效。
1 开机指导
开机后:
login: root
Last login: Fri Jan 17 22:21:55 on ttyd0
--- JUNOS 7.2R3.3 built 2002-03-23 02:44:36 UTC
Terminal type? [vt100] <enter>
注意使用root用户登录的情况下,输入帐号/密码以后,默认是进入shell模式的(而只有root用户帐号有这个现象),要输入cli命令进入用户模式:
root>
2 配置模式
用户模式下输入configure命令进入配置模式,配置模式下可以对设备进行各种参数的配置
root> configure
2.1 设置root用户密码
命令:
set system root-authentication plain-text-password
初始化root用户是没有密码的,在第一次进行配置的时候必须要配置root密码才能commit成功。密码采用字母+数字方式。
Example:
set system root-authenticationplain-text-password
New password:
Retype new password:
2.2 添加系统用户
命令:
set system login user juniper uid 2000 <-设置用户名为juniper用户id为2000
set system login user juniper class super-user <-设置juniper用户为超级用户
set system login user juniper authenticationplain-text-password <-设置juniper用户的密码
2.3 设置主机名
命令:
set system host-name M7i_GZ <-设置主机名为M7i_GZ
2.4 开启系统telnet服务
命令:
set system services telnet
说明:系统默认是没有打开telnet功能的,只有打开telnet服务之后才能从网络上登陆到网络设备。
2.5 开启系统ftp服务
命令:
set system services ftp
说明:系统默认是没有打开ftp功能的,只有打开ftp服务之后才能从网络上ftp到网络设备。
2.6 配置SNMP
set snmp community <community> authorization < read-only/ read-write> clients <prefix> # 设置SNMP字符串
set snmp trap-options source-address192.168.1.1 #设置snmp trap的原地址为192.168.1.1
set snmp contact <contact> #设置snmp的联系信息
set snmp engine-id local <local> #设置snmp v3 engine ID信息
set snmp description <description> #设置snmp的系统描述
2.7 配置物理端口参数
2.7.1 配置端口描述
[email protected]#set interface ge-slot/pic/port description description
2.7.2 配置端口MTU
[email protected]#set interface ge-slot/pic/port mtu mtu-number
2.7.3 配置端口速率
[email protected]#set interface ge-slot/pic/port ether-options speed (10m |100m | 1g)
2.7.4 配置端口双工
[email protected]#set interface ge-0/0/0 ether-options link-mode (automatic| full-duplex |
half-duplex )
2.7.5 配置端口自动协商
[email protected]#set interface ge-0/0/0 ether-options (auto-negotiation |
no-auto-negotiation )
注:如需强制双工或强制速率需要配置[email protected]#set interface ge-0/0/0ether-options no-auto-negotiation
[email protected]# set interfaces ge-3/0/0 ether-optionsauto-negotiation
2.7.6 关闭端口
[email protected]# set interfaces ge-0/0/0 disable
2.7.7 配置物理端口二层接口
[email protected]# set interfaces ge-0/0/16 unit 0 familyethernet-switching port-mode access
2.7.8 配置物理端口三层接口
EX交换机物理接口可以支持三层路由接口功能,直接可以在接口上配置三层地址
[email protected]# set interfaces ge-0/0/17 unit 0 family inet address 192.168.20.1/24
2.8 配置VLAN
初始化配置时候,所有端口属于default VLAN,defaultvlan 的默认ID是0
2.8.1 创建二层VLAN
set vlans vlan100 vlan-id 100
2.8.2 创建三层vlan
set vlans vlan2061 descriptionGUANLI
set vlans vlan2061 vlan-id 2061
set vlans vlan2061 l3-interfacevlan.2061
set interfaces vlan unit 2061 familyinet address 172.16.61.52/24
2.8.3 接口划入VLAN
为端口配置VLAN 100 ACCESSS
[email protected]# set interfaces ge-0/0/1 unit 0 family ethernet-switchingvlan members 100
2.8.4 配置Vlan trunk
配置端口作trunk端口,支持802.1Q的标准封装。
[email protected]# set interfaces name unit 0 family ethernet-switchingport-mode trunk
#配置端口的VLAN模式为trunk模式
[email protected]# set interfaces name unit 0 family ethernet-switchingvlan members (all|number)
2.8.5 配置 native-vlan-id
EX在trunk端口下支持native-vlan(拆标签的VLAN) 的配置:
[email protected]# set interface ge-0/0/8 unit 0 family Ethernet-switchnative-vlan-id purple
2.14 静态路由协议
set routing-options static route 0.0.0.0/0 next-hop172.16.61.1
3 DHCP设置
set system services dhcp name-server 202.118.176.2
主DNS配置
set system services dhcp name-server 114.114.114.114
备DNS配置
set system services dhcp pool 10.30.0.0/24 address-range low10.30.0.10
set system services dhcp pool 10.30.0.0/24 address-range high10.30.0.254
地址池范围
set system services dhcp pool 10.30.0.0/24 router 10.30.0.1
地址池网关,同时也代表绑定网关所在VLAN
set interfaces vlan unit 201 familyinet address 10.30.0.1/24
配置VLAN地址
set vlans vlan201 vlan-id 201
创建VLAN
set vlans vlan201 l3-interfacevlan.201
添加VLAN三层接口。
4 排错维护
4.1查看硬件运行信息
[email protected]_2# run show chassis routing-engine
Routing Engine status:
Slot 0:
Current state Master
Temperature 33 degrees C / 91 degrees F
CPUtemperature 33 degrees C / 91degrees F
DRAM 1024
Memory utilization 50percent
CPUutilization:
User 0percent
Background 0percent
Kernel 0percent
Interrupt 0percent
Idle 100percent
Model EX4200-48T, 8 POE
Serial ID BP0214300255
Starttime 2013-09-1306:55:06 UTC
Uptime 29days, 21 hours, 44 minutes, 30 seconds
Lastreboot reason 0x1:powercycle/failure
Loadaverages: 1 minute 5 minute 15 minute
0.16 0.06 0.02
4.2产看ARP表
[email protected]_2# run show arp
MAC Address Address Name Interface Flags
70:f9:6d:18:2a:e5 172.16.61.1 172.16.61.1 vlan.2061 none
70:f9:6d:a1:d6:24 172.16.61.11 172.16.61.11 vlan.2061 none
70:f9:6d:a1:d5:ea 172.16.61.12 172.16.61.12 vlan.2061 none
70:f9:6d:a1:d1:9c 172.16.61.13 172.16.61.13 vlan.2061 none
70:f9:6d:a1:d5:3c 172.16.61.21 172.16.61.21 vlan.2061 none
70:f9:6d:a2:14:72 172.16.61.31 172.16.61.31 vlan.2061 none
70:f9:6d:a1:cd:4e 172.16.61.32 172.16.61.32 vlan.2061 none
70:f9:6d:a1:cf:92 172.16.61.33 172.16.61.33 vlan.2061 none
70:f9:6d:a1:d0:40 172.16.61.34 172.16.61.34 vlan.2061 none
64:64:9b:f0:c6:01 172.16.61.35 172.16.61.35 vlan.2061 none
64:64:9b:f0:c1:01 172.16.61.36 172.16.61.36 vlan.2061 none
64:64:9b:f0:76:81 172.16.61.37 172.16.61.37 vlan.2061 none
70:f9:6d:a1:cf:1e 172.16.61.61 172.16.61.61 vlan.2061 none
70:f9:6d:a1:cd:c2 172.16.61.62 172.16.61.62 vlan.2061 none
70:f9:6d:a1:d3:e0 172.16.61.81 172.16.61.81 vlan.2061 none
70:f9:6d:a1:d0:7a 172.16.61.91 172.16.61.91 vlan.2061 none
70:f9:6d:a1:cc:da 172.16.61.92 172.16.61.92 vlan.2061 none
70:f9:6d:a1:cc:2c 172.16.61.93 172.16.61.93 vlan.2061 none
70:f9:6d:a1:d6:d2 172.16.61.101 172.16.61.101 vlan.2061 none
64:64:9b:14:ba:81 172.16.61.103 172.16.61.103 vlan.2061 none
70:f9:6d:83:c4:2e 172.16.61.121 172.16.61.121 vlan.2061 none
70:f9:6d:a1:d2:10 172.16.61.122 172.16.61.122 vlan.2061 none
5c:dd:70:04:21:52 172.16.61.123 172.16.61.123 vlan.2061 none
70:f9:6d:a1:d4:1a 172.16.61.124 172.16.61.124 vlan.2061 none
70:f9:6d:a1:d5:02 172.16.61.125 172.16.61.125 vlan.2061 none
70:f9:6d:a1:d5:b0 172.16.61.126 172.16.61.126 vlan.2061 none
70:f9:6d:a2:11:46 172.16.61.131 172.16.61.131 vlan.2061 none
70:f9:6d:a1:cf:cc 172.16.61.132 172.16.61.132 vlan.2061 none
70:f9:6d:a1:d0:ee 172.16.61.141 172.16.61.141 vlan.2061 none
70:f9:6d:a2:0b:28 172.16.61.142 172.16.61.142 vlan.2061 none
4.3查看VLAN信息
[email protected]_2# run showvlans
Name Tag Interfaces
__pvlan_vlan502_ge-0/0/0.0__
ge-0/0/0.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/1.0__
ge-0/0/1.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/10.0__
ge-0/0/10.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/11.0__
ge-0/0/11.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/12.0__
ge-0/0/12.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/13.0__
ge-0/0/13.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/14.0__
ge-0/0/14.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/15.0__
ge-0/0/15.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/16.0__
ge-0/0/16.0*, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/17.0__
ge-0/0/17.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/18.0__
ge-0/0/18.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/19.0__
ge-0/0/19.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/2.0__
ge-0/0/2.0*, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/20.0__
ge-0/0/20.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/21.0__
ge-0/0/21.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/22.0__
ge-0/0/22.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/23.0__
ge-0/0/23.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/24.0__
ge-0/0/24.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/25.0__
ge-0/0/25.0*, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/26.0__
ge-0/0/26.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/27.0__
ge-0/0/27.0*,ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/28.0__
ge-0/0/28.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/29.0__
ge-0/0/29.0*,ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/3.0__
ge-0/0/3.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/30.0__
ge-0/0/30.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/31.0__
ge-0/0/31.0*,ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/32.0__
ge-0/0/32.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/33.0__
ge-0/0/33.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/34.0__
ge-0/0/34.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/35.0__
ge-0/0/35.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/36.0__
ge-0/0/36.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/37.0__
ge-0/0/37.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/38.0__
ge-0/0/38.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/39.0__
ge-0/0/39.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/4.0__
ge-0/0/4.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/40.0__
ge-0/0/40.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/41.0__
ge-0/0/41.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/42.0__
ge-0/0/42.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/43.0__
ge-0/0/43.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/44.0__
ge-0/0/44.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/45.0__
ge-0/0/45.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/46.0__
ge-0/0/46.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/47.0__
ge-0/0/47.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/5.0__
ge-0/0/5.0*, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/6.0__
ge-0/0/6.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/7.0__
ge-0/0/7.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/8.0__
ge-0/0/8.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/0/9.0__
ge-0/0/9.0, ge-0/1/3.0*
__pvlan_vlan502_ge-0/1/0.0__
ge-0/1/3.0*
__pvlan_vlan502_ge-0/1/1.0__
ge-0/1/3.0*
default
None
vlan2061 2061
ge-0/1/3.0*
vlan502 502
ge-0/0/0.0, ge-0/0/1.0,ge-0/0/2.0*, ge-0/0/3.0, ge-0/0/4.0, ge-0/0/5.0*, ge-0/0/6.0, ge-0/0/7.0,ge-0/0/8.0, ge-0/0/9.0, ge-0/0/10.0,
ge-0/0/11.0,ge-0/0/12.0, ge-0/0/13.0, ge-0/0/14.0, ge-0/0/15.0, ge-0/0/16.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, ge-0/0/24.0, ge-0/0/25.0*, ge-0/0/26.0, ge-0/0/27.0*,ge-0/0/28.0, ge-0/0/29.0*, ge-0/0/30.0,
ge-0/0/31.0*,ge-0/0/32.0, ge-0/0/33.0, ge-0/0/34.0, ge-0/0/35.0, ge-0/0/36.0, ge-0/0/37.0,ge-0/0/38.0, ge-0/0/39.0, ge-0/0/40.0,
ge-0/0/41.0,ge-0/0/42.0, ge-0/0/43.0, ge-0/0/44.0, ge-0/0/45.0, ge-0/0/46.0, ge-0/0/47.0,ge-0/1/3.0*
注: PVLAN 为vlan隔离,端口后面加“*”的意思为该端口up状态。
4.4单独查看某个VLAN
[email protected]_2# run showvlans 2061
Name Tag Interfaces
vlan2061 2061
ge-0/1/3.0*
{master:0}[edit]
4.5查看接口
[email protected]_2# run showinterfaces terse
Interface Admin Link Proto Local Remote
ge-0/0/0 up down
ge-0/0/0.0 up down eth-switch
ge-0/0/1 up down
ge-0/0/1.0 up down eth-switch
ge-0/0/2 up up
ge-0/0/2.0 up up eth-switch
ge-0/0/3 up down
ge-0/0/3.0 up down eth-switch
ge-0/0/4 up down
ge-0/0/4.0 up down eth-switch
ge-0/0/5 up up
ge-0/0/5.0 up up eth-switch
ge-0/0/6 up down
ge-0/0/6.0 up down eth-switch
ge-0/0/7 up down
ge-0/0/7.0 up down eth-switch
ge-0/0/8 up down
ge-0/0/8.0 up down eth-switch
ge-0/0/9 up down
ge-0/0/9.0 up down eth-switch
ge-0/0/10 up down
ge-0/0/10.0 up down eth-switch
ge-0/0/11 up down
ge-0/0/11.0 up down eth-switch
ge-0/0/12 up down
ge-0/0/12.0 up down eth-switch
ge-0/0/13 up down
ge-0/0/13.0 up down eth-switch
ge-0/0/14 up down
ge-0/0/14.0 up down eth-switch
ge-0/0/15 up down
ge-0/0/15.0 up down eth-switch
ge-0/0/16 up up
ge-0/0/16.0 up up eth-switch
ge-0/0/17 up down
ge-0/0/17.0 up down eth-switch
ge-0/0/18 up down
ge-0/0/18.0 up down eth-switch
ge-0/0/19 up down
ge-0/0/19.0 up down eth-switch
ge-0/0/20 up down
ge-0/0/20.0 up down eth-switch
ge-0/0/21 up down
ge-0/0/21.0 up down eth-switch
ge-0/0/22 up down
ge-0/0/22.0 up down eth-switch
ge-0/0/23 up down
ge-0/0/23.0 up down eth-switch
ge-0/0/24 up down
ge-0/0/24.0 up down eth-switch
ge-0/0/25 up up
ge-0/0/25.0 up up eth-switch
ge-0/0/26 up down
ge-0/0/26.0 up down eth-switch
ge-0/0/27 up up
ge-0/0/27.0 up up eth-switch
ge-0/0/28 up down
ge-0/0/28.0 up down eth-switch
ge-0/0/29 up up
ge-0/0/29.0 up up eth-switch
ge-0/0/30 up down
ge-0/0/30.0 up down eth-switch
ge-0/0/31 up up
ge-0/0/31.0 up up eth-switch
ge-0/0/32 up down
ge-0/0/32.0 up down eth-switch
ge-0/0/33 up down
ge-0/0/33.0 up down eth-switch
ge-0/0/34 up down
ge-0/0/34.0 up down eth-switch
ge-0/0/35 up down
ge-0/0/35.0 up down eth-switch
ge-0/0/36 up down
ge-0/0/36.0 up down eth-switch
ge-0/0/37 up down
ge-0/0/37.0 up down eth-switch
ge-0/0/38 up down
ge-0/0/38.0 up down eth-switch
ge-0/0/39 up down
ge-0/0/39.0 up down eth-switch
ge-0/0/40 up down
ge-0/0/40.0 up down eth-switch
ge-0/0/41 up down
ge-0/0/41.0 up down eth-switch
ge-0/0/42 up down
ge-0/0/42.0 up down eth-switch
ge-0/0/43 up down
ge-0/0/43.0 up down eth-switch
ge-0/0/44 up down
ge-0/0/44.0 up down eth-switch
ge-0/0/45 up down
ge-0/0/45.0 up down eth-switch
ge-0/0/46 up down
ge-0/0/46.0 up down eth-switch
ge-0/0/47 up down
ge-0/0/47.0 up down eth-switch
ge-0/1/3 up up
ge-0/1/3.0 up up eth-switch
vcp-0 up down
vcp-0.32768 up down
vcp-1 up down
vcp-1.32768 up down
bme0 up up
bme0.32768 up up inet 128.0.0.1/2
128.0.0.16/2
128.0.0.32/2
tnp 0x10
dsc up up
gre up up
ipip up up
lo0 up up
lo0.16384 up up inet 127.0.0.1 --> 0/0
lsi up up
me0 up down
me0.0 up down eth-switch
mtun up up
pimd up up
pime up up
tap up up
vlan up up
vlan.0 up down inet
vlan.2061 up up inet 172.16.61.52/24
vme up down
vme.0 up down inet
{master:0}[edit]
4.6查看VLAN流量
[email protected]_2# run showinterfaces vlan.2061
Logical interface vlan.2061 (Index 117) (SNMPifIndex 601)
Flags: SNMP-Traps 0x0 Encapsulation: ENET2
Input packets : 935958
Output packets: 20227
Protocol inet, MTU: 1500
Flags: None
Addresses, Flags: Is-Preferred Is-Primary
Destination: 172.16.61/24, Local:172.16.61.52, Broadcast: 172.16.61.255
{master:0}[edit]
4.7查看接口流量
[email protected]_2# run showinterfaces ge-0/0/3
Physicalinterface: ge-0/0/3, Enabled, Physical link is Down
Interface index: 132, SNMP ifIndex: 508
Link-level type: Ethernet, MTU: 1514, Speed:Auto, Duplex: Auto, BPDU Error: None, MAC-REWRITE Error: None, Loopback:Disabled, Source filtering: Disabled,
Flow control: Enabled, Auto-negotiation:Enabled, Remote fault: Online, Media type: Copper
Device flags : Present Running
Interface flags: Hardware-Down SNMP-TrapsInternal: 0x0
Link flags : None
CoS queues : 8 supported, 8 maximum usable queues
Current address: 64:64:9b:f0:58:06, Hardwareaddress: 64:64:9b:f0:58:06
Last flapped : Never
Input rate : 0 bps (0 pps)
Output rate : 0 bps (0 pps)
Active alarms : LINK
Active defects : LINK
Interface transmit statistics: Disabled
Logical interface ge-0/0/3.0 (Index 70) (SNMPifIndex 509)
Flags: Device-Down SNMP-Traps 0x0Encapsulation: ENET2
Input packets : 0
Output packets: 0
Protocol eth-switch
Flags: None
本文出自 “网络技术” 博客,请务必保留此出处http://dragon00.blog.51cto.com/11805465/1933887
以上是关于juniper交换机日常维护常用配置方式的主要内容,如果未能解决你的问题,请参考以下文章