【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@%

注意使用root用戶登錄的情況下,輸入帳號/密碼以後,默認是進入shell模式的(而只有root用戶帳號有這個現象),要輸入cli命令進入用戶模式:

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用戶id2000

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   配置端口描述

user@host#set interface ge-slot/pic/port description description

2.7.2   配置端口MTU

user@host#set interface ge-slot/pic/port mtu mtu-number

2.7.3   配置端口速率

user@host#set interface ge-slot/pic/port ether-options speed (10m |100m | 1g)

2.7.4   配置端口雙工

user@host#set interface ge-0/0/0 ether-options link-mode (automatic| full-duplex |

half-duplex )

2.7.5   配置端口自動協商

user@host#set interface ge-0/0/0 ether-options (auto-negotiation |

no-auto-negotiation )

注:如需強制雙工或強制速率需要配置user@host#set interface ge-0/0/0ether-options no-auto-negotiation

root@host# set interfaces ge-3/0/0 ether-optionsauto-negotiation

2.7.6   關閉端口

root@host# set interfaces ge-0/0/0 disable

 

2.7.7        配置物理端口二層接口

root@host# set interfaces ge-0/0/16 unit 0 familyethernet-switching port-mode access

 

2.7.8        配置物理端口三層接口

EX交換機物理接口可以支持三層路由接口功能,直接可以在接口上配置三層地址

root@host# set interfaces ge-0/0/17 unit 0 family inet address 192.168.20.1/24

2.8    配置VLAN

初始化配置時候,所有端口屬於default VLANdefaultvlan 的默認ID0

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

root@host# set interfaces ge-0/0/1 unit 0 family ethernet-switchingvlan members 100

2.8.4        配置Vlan trunk

配置端口作trunk端口,支持802.1Q的標準封裝。

user@host# set interfaces name unit 0 family ethernet-switchingport-mode trunk

#配置端口的VLAN模式爲trunk模式

user@host# set interfaces name unit 0 family ethernet-switchingvlan members all|number

2.8.5        配置 native-vlan-id

EXtrunk端口下支持native-vlan(拆標籤的VLAN) 的配置:

root@host# 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查看硬件運行信息

wlzx@5_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

wlzx@5_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信息

wlzx@5_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

wlzx@5_2# run showvlans 2061

Name           Tag     Interfaces

vlan2061       2061  

                       ge-0/1/3.0*

 

{master:0}[edit]

 

 

4.5查看接口

wlzx@5_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流量

wlzx@5_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查看接口流量

wlzx@5_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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章