juniper交換機配置指南

Ex3200開機指導
 
開機後:
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>
配置模式
用戶模式下輸入configure命令進入配置模式,配置模式下可以對設備進行各種參數的配置
root> configure
[edit]
root#
設置root用戶密碼
命令:
set system root-authentication plain-text-password
路由器初始化root用戶是沒有密碼的,在第一次進行配置的時候必須要配置root密碼才能commit成功。密碼採用字母+數字方式。
Example:
lab@M7i_GZ# set system root-authentication plain-text-password   
New password:
Retype new password:
添加系統用戶
命令:
set system login user juniper uid 2000   <-設置用戶名爲juniper用戶id爲2000
set system login user juniper class super-user  <-設置juniper用戶爲超級用戶
set system login user juniper authentication plain-text-password  <-設置juniper用戶的密碼
設置主機名
命令:
set system host-name M7i_GZ    <-設置主機名爲M7i_GZ
開啓系統telnet服務
命令:
set system services telnet
說明:系統默認是沒有打開telnet功能的,只有打開telnet服務之後才能從網絡上登陸到路由器。
開啓系統ftp服務
命令:
set system services ftp
說明:系統默認是沒有打開ftp功能的,只有打開ftp服務之後才能從網絡上ftp到路由器。
配置SNMP
set snmp community  <community>  authorization < read-only/ read-write> clients  <prefix>                   # 設置SNMP字符串
set snmp trap-options source-address 192.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的系統描述
配置物理端口參數
user@host#set interface ge-slot/pic/port description description
#配置端口描述
user@host#set interface ge-slot/pic/port mtu mtu-number
#配置端口MTU
user@host#set interface ge-slot/pic/port ether-options speed (10m | 100m | 1g)
#配置端口速率
user@host#set interface ge-slot/pic/port ether-options link-mode (automatic | full-duplex |
half-duplex )
#配置端口雙工
user@host#set interface ge-slot/pic/port ether-options (auto-negotiation |
no-auto-negotiation )
#配置端口自動協商
Example:
root@host> edit
Entering configuration mode
[edit]
root@host# set interfaces ge-3/0/0 description “to_BJ-4200-1”
[edit]
root@host# set interfaces ge-3/0/0 mtu 9216
[edit]
root@host# set interfaces ge-3/0/0 ether-options speed 1g
[edit]
root@host# set interfaces ge-3/0/0 ether-options link-mode
full-duplex
[edit]
root@host# set interfaces ge-3/0/0 ether-options auto-negotiation

配置物理端口二層接口
[edit]
root@host# set interfaces ge-0/0/16 unit 0 family ethernet-switching
port-mode access
#配置物理端口作爲二層access模式的接口,端口默認情況下就是二層access端口。
[edit]
user@host # show interfaces
ge-0/0/16 {
unit 0 {
family ethernet-switching;
}
}
配置物理端口三層接口
EX交換機物理接口可以支持三層路由接口功能,直接可以在接口上配置三層地址
[edit]
root@host# set interfaces ge-0/0/17 unit 0 family inet address
192.168.20.1/24

配置VLAN
初始化配置時候,所有端口屬於default VLAN,default vlan 的默認ID是0
user@host# set interfaces name unit 0 family ethernet-switching port-mode access
#配置端口的access模式,默認端口就是access模式。
user@host#set vlans vlan-name vlan-id number
#配置VLAN分配vlan ID
EX支持2種方式來配置access接口分配到VLAN,採用其中一種就可以實現端口VLAN的劃
分。
方式一:
user@host#set vlans vlan-name interface interface_name
直接在VLAN中添加多個物理端口
方式二:
或是在物理接口下:
user@host#set interfaces interface-name unit 0 family ethernet-switching vlan members
vlan-name or vlan-id
#添加端口到特定VLAN
user@host# show vlans vlan-name detail
#查看VLAN信息
Example:
root@host> edit
Entering configuration mode
[edit]
root@host# set vlans sales vlan-id 100
[edit]
root@host# set vlans sales interface ge-0/0/1
#或者可以如下配置,實現相同的配置效果
[edit]
root@host# set interfaces ge-0/0/1 unit 0 family ethernet-switching
vlan members sales

配置Vlan trunk
配置端口作trunk端口,支持802.1Q的標準封裝。
user@host# set interfaces name unit 0 family ethernet-switching port-mode trunk
#配置端口的VLAN模式爲trunk模式
user@host# set interfaces name unit 0 family ethernet-switching vlan members
all|number
#配置trunk端口的允許通過的VLAN,9.1版本目前不支持vlan-range,預期在9.2版本支持。
Example:
root@host> edit
Entering configuration mode
[edit]
root@host#show
interfaces {
ge-0/0/3 {
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ orange blue ];
}
}
}
}
ge-0/0/4 {
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ 100 200 ];
}
}
}
}
}
配置 native-vlan-id
EX在trunk端口下支持native-vlan 的配置:
root@host> edit
Entering configuration mode
[edit]
root@host# set interface ge-0/0/8 unit 0 family Ethernet-switch
native-vlan-id purple
[edit]
root@host#show interface
ge-0/0/8 {
unit 0 {
family ethernet-switching {
port-mode trunk;
vlan {
members [ orange blue purple ];
}
native-vlan-id purple;
}
}
 
靜態路由協議
手工添加到路由表
下一跳必須有效
所以的配置在routing-options 級別
Syntax:
[edit]
routing-options {
static {
defaults {
static-options;
}
route destination-prefix {
next-hop next-hop;
qualified-next-hop address {
metric metric;
preference preference;
}
static-options;
}
}
}
Example:
[edit]
user@host# show
routing-options {
static {
route 0.0.0.0/0 next-hop 192.168.0.1;
}
}
OSPF
單區域
[edit]
user@host# set protocols ospf area 0 interface ge-0/0/0
[edit]
user@host# show protocols ospf
ospf {
area 0.0.0.0 {
interface ge-0/0/0.0;
}
}
 配置OSPF 多區域
[edit]
user@host# show protocols ospf
ospf {
area 0.0.0.0 {
interface ge-0/0/0.0;
}
}
[edit]
user@host# set protocols ospf area 1 interface at-0/1/1.100
[edit]
user@host# show protocols ospf
ospf {
area 0.0.0.0 {
interface ge-0/0/0.0;
}
area 0.0.0.1 {
interface at-0/1/1.100;
}
 
綜合實例:
set system root-authentication plain-text-password
set system login user juniper uid 2000   <-設置用戶名爲juniper用戶id爲2000
set system login user juniper class super-user  <-設置juniper用戶爲超級用戶
set system login user juniper authentication plain-text-password  <-設置juniper用戶
set system services telnet
set vlans 10 vlan-id 10
set vlans 20 vlan-id 20
set vlans 1 lan-id 1
set interfaces ge0/0/0 unit 0 family ethernet-switching port-mode trunk
set interfaces ge0/0/0 unit 0 family ethernet-switching vlan members all
set interface ge-0/0/0 unit 0 family Ethernet-switch native-vlan-id 1
set int vlan unit 10 family inet add 192.168.1.1/24  配置vlan 10的3層地址
set int vlan unit 20 family inet add 192.168.2.1/24  配置vlan 20的3層地址
set vlan 10 l3-int vlan.10  將vlan 10和int vlan 10地址邦定
set vlan 20 l3-int vlan.20  將vlan 20和int vlan 20地址邦定
set int ge-0/0/47 un 0 fa inet add 10.1.1.1/30  配置上連接口地址
set rout static route 0/0 next-hop 10.1.1.2  配置缺省路由
save config  保存配置
commit   生效配置
 load factory-default  清空配置
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章