Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

将 OpenConfig VLAN 命令映射到 Junos 配置

注意:

请参阅 OpenConfig 数据模型版本 主题,了解瞻博网络 EX 系列和 QFX 系列的数据模型支持的版本及其 Junos OS 版本。

下表显示了 OpenConfig VLAN 命令与 Junos 中相关配置的映射:

  • 表 1:顶级组 VLAN 配置
  • 表 2:VLAN 成员配置
  • 表 3:MAC 表配置
  • 表 4:以太网接口配置
  • 表 5:聚合接口配置
  • 表 6:路由 VLAN 接口配置
  • 表 7:VLAN 标记的 IFL 配置
表 1:顶级组 VLAN 配置

命令名称

OpenConfig 命令路径

Junos 配置

VLAN 名称和 ID

openconfig-network-instance:network-instances {  
    network-instance <routing-instance-name>; 
        config { 
            type L2VSI; 
    } 
    openconfig-vlan:vlans {  
        vlan { 
            config { 
            name <name>; 
            } 
            vlan-id <id>; 
        } 
    }  
} 

或:

openconfig-network-instance:network-instances {  
    network-instance <routing-instance-name>; 
        config { 
            type DEFAULT-INSTANCE; 
    } 
    openconfig-vlan:vlans {  
        vlan { 
            config { 
            name <name>; 
            } 
            vlan-id <id>; 
        } 
    }  
} 
vlans {  
    vlan-name;  
    vlan-id <id>;
} 

或:

routing-instances {  
    <instance-name>;  
    instance-type virtual-switch; 
    vlans {  
        vlan-name;  
        vlan-id <id>; 
    } 
}  

或:

bridge-domains { 
    <name>; 
    vlan-id <id>; 

} 

或:

routing-instances {  
    <instance-name>; 
    instance-type virtual-switch; 
    bridge-domains { 
        <name>; 
        vlan-id <id>; 
    } 
} 

VLAN 管理状态

openconfig-network-instance:network-instances {  
    network-instance <routing-instance-name>; 
    openconfig-vlan:vlans {  
        vlan { 
            config { 
                status <activate | deactivate>; 
            } 
        } 
    }  
} 
deactivate/activate {  
    vlans <name>; 
} 

或:

deactivate/activate {  
    routing-instances {  
        <instance-name>; 
        vlans <name>; 
    }  
}  

或:

deactivate/activate {  
    routing-instances {  
        <instance-name>; 
        bridge-domains <name>; 
    }  
}   

或:

deactivate/activate {  
    bridge-domains <name>;  
}  
表 2:VLAN 成员配置

命令名称

OpenConfig 命令路径

Junos 配置

命令路径前缀:

/oc-if:interfaces/oc-if:interface/oc-eth:ethernet/switched-vlan

接口模式

/config/interface-mode

set interfaces ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk (L2NG)

本机 VLAN

/config/native-vlan

set interfaces ge-0/0/0 native-vlan-id vid (对于中继端口)set interface ge-0/0/0 unit 0 family ethernet-switching interface-mode trunk

中继 VLAN

/config/trunk-vlans

set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members 600set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members [10-200]Interface-mode = TRUNK

接入虚拟局域网

/config/access-vlan

set interfaces ge-0/0/0 unit 0 family ethernet-switching vlan members 600Interface-mode = ACCESS

表 3:MAC 表配置

命令名称

OpenConfig 命令路径

Junos 配置

MAC 老化时间
openconfig-network-instance:network-instances {  
    network-instance <instance-name>; 
    config {
        type L2VSI;
    }
    openconfig-fdb:fdb { 
        config { 
            mac-aging-time <time>; 
        }
    } 
}  

或:

openconfig-network-instance:network-instances {  
    network-instance <instance-name>; 
    config {
        type DEFAULT_INSTANCE;
    }
    openconfig-fdb:fdb { 
        config { 
            mac-aging-time <time>; 
        }
    } 
}  
routing-instances {  
    <instance-name>;  
    switch-options { 
         mac-table-aging-time { 
              <time>; 
         } 
    } 
}

或:

switch-options { 
    mac-table-aging-time <time>; 
} 
  
注意:

仅当将虚拟交换机配置为实例类型时,才允许进行 switch-options 配置。只有在增强模式下才允许进行配置 mac-table-aging-time

MAC 学习
openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type L2VSI;
    }
    openconfig-fdb:fdb { 
        config { 
            mac-learning <true | false>; 
        }  
    } 
}  

或:

openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type DEFAULT_INSTANCE;
    }
    openconfig-fdb:fdb { 
        config { 
            mac-learning <true | false>; 
        }  
    } 
}  
routing-instances {  
    <instance-name>;  
    switch-options { 
         no-mac-learning; 
    } 
}

或:

switch-options { 
    no-mac-learning; 
} 
  
最大条目数
openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type L2VSI;
    } 
    openconfig-fdb:fdb { 
        config { 
            maximum-entries <limit>; 
        }  
    } 
}  

或:

openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type DEFAULT_INSTANCE;
    } 
    openconfig-fdb:fdb { 
        config { 
            maximum-entries <limit>; 
        }  
    } 
}  
routing-instances {  
    <instance-name>;  
    switch-options { 
         mac-table-size <limit>; 
    } 
}

或:

switch-options { 
    mac-table-size <limit>; 
} 
  
MAC 固定
openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type L2VSI;
    } 
    openconfig-interface:interfaces { 
        interface <name> {
            config {
                mac-pinning <true | false>; 
            }
        }  
    } 
}  

或:

openconfig-network-instance:network-instances {  
    network-instance <instance-name>;
    config {
        type DEFAULT_INSTANCE;
    } 
    openconfig-interface:interfaces { 
        interface <name> {
            config {
                mac-pinning <true | false>; 
            }
        }  
    } 
}  
routing-instances {  
    <instance-name> ; 
    switch-options { 
        interface <name> { 
            mac-pinning; 
        } 
    } 
} 

或:

switch-options { 
    interface <name> { 
        mac-pinning 
    } 
} 
  
表 4:以太网接口配置

命令名称

OpenConfig 命令路径

Junos 配置

接口模式

openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-ethernet:ethernet { 
        openconfig-vlan:switched-vlan { 
            config { 
                interface-mode <access | trunk>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>;  
    unit 0;  
    family ethernet-switching; 
    interface-mode <access | trunk>; 
}  

本机 VLAN

openconfig-interfaces: interfaces { 
    interface <name>;  
    openconfig-if-ethernet:ethernet { 
        openconfig-vlan:switched-vlan { 
            config { 
                native-vlan <id>; 
            } 
        } 
    } 
}
interfaces {  
    <name>;  
    native-vlan-id <id>; 
}  
接入虚拟局域网
openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-ethernet:ethernet { 
        openconfig-vlan:switched-vlan { 
            config { 
                access-vlan <id>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>; 
    unit 0; 
    family ethernet-switching; 
    vlan { 
        members <id>; 
    } 
}  
中继 VLAN
openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-ethernet:ethernet { 
        openconfig-vlan:switched-vlan { 
            config { 
                trunk-vlan <id>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>; 
    unit <unit-no>; 
    family bridge; 
    vlan-id { 
        <id>; 
    } 
}  
表 5:聚合接口配置

命令名称

OpenConfig 命令路径

Junos 配置

接口模式

openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-aggregate:aggregation { 
        openconfig-vlan:switched-vlan { 
            config { 
                interface-mode <trunk | access>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>;  
    unit <unit-no>;  
    family <ethernet-switching | bridge>; 
    interface-mode <access | trunk>; 
}  

本机 VLAN

openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-aggregate:aggregation { 
        openconfig-vlan:switched-vlan { 
            config { 
                native-vlan <id>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>;  
    native-vlan-id <id>; 
}  
接入虚拟局域网
openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-aggregate:aggregation { 
        openconfig-vlan:switched-vlan { 
            config { 
                access-vlan <id>; 
            } 
        } 
    } 
}  
interfaces {  
    <name>; 
    unit 0; 
    family ethernet-switching; 
    vlan { 
        members <id>; 
    } 
}  
中继 VLAN
openconfig-interfaces:interfaces {  
    interface <name>; 
    openconfig-if-aggregate:aggregation { 
        openconfig-vlan:switched-vlan { 
            config { 
                trunk-vlan <id> ; 
            } 
        } 
    } 
}  
interfaces {  
    <name>; 
     unit <unit-no>; 
     family <bridge>; 
     vlan-id { 
         <id>; 
      } 
}  
表 6:路由 VLAN 接口配置

命令名称

OpenConfig 命令路径

Junos 配置

命令路径前缀:

/oc-if:interfaces/oc-if:interface/routed-vlan

Vlan

/config/vlan

Set vlans vlan-name l3-interface irb.vid

注意:

要创建 IRB IFL,请在路由 VLAN 层次结构下配置 IPv4/IPv6。

表 7:VLAN 标记的 IFL 配置

命令名称

OpenConfig 命令路径

Junos 配置

命令路径前缀:

/ocif:interfaces/ocif:interface/ocif:subinterfaces/ocif:subinterface/vlan

虚拟帧 ID

/config/vlan-id

set interfaces interface unit subinterface index vlan-id vidset interfaces interface vlan-tagging