juniper configuration case

时间:2023-02-20 19:56:16

access

access接口绑定vlan:

root# set vlans vlan10 vlan-id 10 description vlan10

root# set interfaces ge-0/0/10 unit 0 family ethernet-switching interface-mode access

root# set interfaces ge-0/0/10 unit 0 family ethernet-switching vlan members vlan10

trunk

trunk接口放行vlan:

root# set interfaces ge-0/0/20 unit 0 family ethernet-switching interface-mode trunk

root# set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members all

ae

链路捆绑

root# set chassis aggregated-devices ethernet device-count 2        ------>  2是指聚合口可以同时捆绑多少物理接口,1-64

root# set interfaces xe-0/2/0 ether-options 802.3ad ae0                 ------>  ae0是聚合口的名字

root# set interfaces xe-0/2/1 ether-options 802.3ad ae0    

root# set interfaces ae0 aggregated-ether-options lacp active

注:

xe-0/2/0 指的是堆叠中的member 0的2号插槽的0号端口

vlan网关

root# set vlans vlan30 vlan-id 30 description vlan30

root# set interfaces irb unit 30 family inet address 192.168.30.254/24

root# set vlans vlan30 l3-interface irb.30

物理接口二转三

默认情况下,电口都是二层的,如果需要转换成三层,需要提前删除接口下默认的二层配置

root# edit interfaces ge-0/0/40

root# delete unit 0 family ethernet-switching  

root# exit  

root# edit protocols rstp

root# delete interface ge-0/0/40  

root# exit

root# set interfaces ge-0/0/40 unit 0 family inet address 192.168.40.1/24


需要提前删除默认配置,否则会出现如下报错

root# set interfaces ge-0/0/40 unit 0 family inet address 192.168.40.1/24 

{master:0}[edit]
root# commit
[edit interfaces ge-0/0/40 unit 0 family]
'ethernet-switching'
Family ethernet-switching and rest of the families are mutually exclusive
error: commit failed: (statements constraint check failed)

{master:0}[edit]

root# edit interfaces ge-0/0/40

{master:0}[edit interfaces ge-0/0/40]
root# show
unit 0 {
family inet {
address 192.168.40.1/24;
}
##
## Warning: Family ethernet-switching and rest of the families are mutually exclusive
##
family ethernet-switching {
storm-control default;
}
}

{master:0}[edit interfaces ge-0/0/40]
root# delete unit 0 family ethernet-switching

{master:0}[edit interfaces ge-0/0/40]
root# commit check
[edit protocols rstp]
'interface'
XSTP : Interface ge-0/0/40 is not enabled for Ethernet Switching
error: configuration check-out failed

{master:0}[edit interfaces ge-0/0/40]
root# exit

{master:0}[edit]
root# edit protocols rstp

{master:0}[edit protocols rstp]
root# show
interface ge-0/0/0;
interface ge-0/0/1;
interface ge-0/0/2;
interface ge-0/0/3;
interface ge-0/0/4;
interface ge-0/0/5;
interface ge-0/0/6;
interface ge-0/0/7;
interface ge-0/0/8;
interface ge-0/0/9;
interface ge-0/0/10;
interface ge-0/0/11;
interface ge-0/0/12;
interface ge-0/0/13;
interface ge-0/0/14;
interface ge-0/0/15;
interface ge-0/0/16;
interface ge-0/0/17;
interface ge-0/0/18;
interface ge-0/0/19;
interface ge-0/0/20;
interface ge-0/0/21;
interface ge-0/0/22;
interface ge-0/0/23;
interface ge-0/0/24;
interface ge-0/0/25;
interface ge-0/0/26;
interface ge-0/0/27;
interface ge-0/0/28;
interface ge-0/0/29;
interface ge-0/0/30;
interface ge-0/0/31;
interface ge-0/0/32;
interface ge-0/0/33;
interface ge-0/0/34;
interface ge-0/0/35;
interface ge-0/0/36;
interface ge-0/0/37;
interface ge-0/0/38;
interface ge-0/0/39;
interface ge-0/0/40;
interface ge-0/0/41;
interface ge-0/0/42;
interface ge-0/0/43;
interface ge-0/0/44;
interface ge-0/0/45;
interface ge-0/0/46;
interface ge-0/0/47;

{master:0}[edit protocols rstp]
root# delete interface ge-0/0/40

{master:0}[edit protocols rstp]
root# commit
configuration check succeeds
fpc1:
commit complete
commit complete

{master:0}[edit protocols rstp]
root# exit

{master:0}[edit]
root# show interfaces ge-0/0/40
unit 0 {
family inet {
address 192.168.40.1/24;
}
}

{master:0}[edit]

有其他配置的情况下

root# edit interfaces ge-1/0/40 

{master:1}[edit interfaces ge-1/0/40]
root# show
unit 0 {
family ethernet-switching {
interface-mode access;
vlan {
members vlan10;
}
}
}

{master:1}[edit interfaces ge-1/0/40]
root# delete unit 0

{master:1}[edit interfaces ge-1/0/40]
root# commit
configuration check succeeds
fpc0:
commit complete
commit complete

{master:1}[edit]
root# edit interfaces ge-1/0/40

{master:1}[edit interfaces ge-1/0/40]
root# show

{master:1}[edit interfaces ge-1/0/40]
root# set unit 0 family inet address 192.168.40.1/24

{master:1}[edit interfaces ge-1/0/40]
root# commit
configuration check succeeds
fpc0:
commit complete
commit complete

{master:1}[edit]

物理接口三转二

三层接口上配置有IP地址 unit 0 family inet address,所以直接delete,就可以变成二层接口了

root# delete interfaces ge-1/0/40 unit 0

示例

root# edit interfaces ge-1/0/40 

{master:1}[edit interfaces ge-1/0/40]
root# show
unit 0 {
family inet {
address 192.168.40.254/24;
}
}

{master:1}[edit interfaces ge-1/0/40]
root# delete unit 0

{master:1}[edit interfaces ge-1/0/40]
root# show

{master:1}[edit interfaces ge-1/0/40]
root# exit

{master:1}[edit]

验证

二层access设置成功

root# set interfaces ge-1/0/40 unit 0 family ethernet-switching interface-mode access           

{master:1}[edit]
root# set interfaces ge-1/0/40 unit 0 family ethernet-switching vlan members vlan10

{master:1}[edit]
root# commit
configuration check succeeds
fpc0:
commit complete
commit complete

{master:1}[edit]

堆叠

root# set virtual-chassis preprovisioned  

root# set virtual-chassis no-split-detection    

root# set virtual-chassis member 0 role routing-engine  

root# set virtual-chassis member 0 serial-number ZD4322130262

root# set virtual-chassis member 1 role routing-engine  

root# set virtual-chassis member 1 serial-number ZD4322130182

验证

堆叠成功

root> show virtual-chassis 

Preprovisioned Virtual Chassis
Virtual Chassis ID: 91e4.543f.0121
Virtual Chassis Mode: Enabled
Mstr Mixed Route Neighbor List
Member ID Status Serial No Model prio Role Mode Mode ID Interface
0 (FPC 0) Prsnt ZD4322130262 ex4400-48p 129 Master* N VC 1 vcp-255/1/0
1 vcp-255/1/1
1 (FPC 1) Prsnt ZD4322130182 ex4400-48p 129 Backup N VC 0 vcp-255/1/0
0 vcp-255/1/1

{master:0}

光堆叠

相比用堆叠线缆进行堆叠,多出来的一个步骤为

指定某两个光口作为堆叠口,这样在这个光口上插上的光纤就可以作为堆叠线缆使用了

光口板卡插上,先指定某个光口为堆叠口

root> request virtual-chassis vc-port set pic-slot 2 port 0 member 0     ----->  2号插槽,0号端口,member号为0

root> request virtual-chassis vc-port set pic-slot 2 port 0 member 1 

指定完后在member 0上进行常规的堆叠配置,绑定member成员

root# set virtual-chassis preprovisioned  

root# set virtual-chassis no-split-detection    

root# set virtual-chassis member 0 role routing-engine  

root# set virtual-chassis member 0 serial-number ZD4322130262

root# set virtual-chassis member 1 role routing-engine  

root# set virtual-chassis member 1 serial-number ZD4322130182

绑定完成后,光纤插上,光堆叠完成




---------------------------------------------------------------------------------------------------------------------------------------------------------待更新