RHEL nmcli 配置多VLAN trunk口网桥

概念 含义
Parent Interface A previously configured interface can be selected in the drop-down list.
VLAN ID The identification number to be used to tag the VLAN network traffic.
VLAN interface name The name of the VLAN interface that will be created. For example, enp1s0.1 or vlan2.
Cloned MAC address Optionally sets an alternate MAC address to use for identifying the VLAN interface. This can be used to change the source MAC address for packets sent on this VLAN.
MTU Optionally sets a Maximum Transmission Unit (MTU) size to be used for packets to be sent over the VLAN connection.

To use VLANs over bonds and bridges, proceed as follows:

  1. Add a bond device:
~]$ nmcli connection add type bond con-name Bond0 ifname bond0 bond.options "mode=active-backup,miimon=100" ipv4.method disabled ipv6.method ignore

Note that in this case a bond connection serves only as a "lower interface" for VLAN, and does not get any IP address. Therefore, the ipv4.method disabled and ipv6.method ignore parameters have been added on the command line.

  1. Add slaves to the bond device:
~]$ nmcli connection add type ethernet con-name Slave1 ifname em1 master bond0 slave-type bond
~]$ nmcli connection add type ethernet con-name Slave2 ifname em2 master bond0 slave-type bond
  1. Add a bridge device:
~]$ nmcli connection add type bridge con-name Bridge0 ifname br0 ip4 192.0.2.1/24
  1. Add a VLAN interface on top of bond, enslaved to the bridge device:
~]$ nmcli connection add type vlan con-name Vlan2 ifname bond0.2 dev bond0 id 2 master br0 slave-type bridge
  1. View the created connections:
~]$ nmcli connection show
 NAME     UUID                                  TYPE            DEVICE
 Bond0    f05806fa-72c3-4803-8743-2377f0c10bed  bond            bond0
 Bridge0  22d3c0de-d79a-4779-80eb-10718c2bed61  bridge          br0
 Slave1   e59e13cb-d749-4df2-aee6-de3bfaec698c  802-3-ethernet  em1
 Slave2   25361a76-6b3c-4ae5-9073-005be5ab8b1c  802-3-ethernet  em2
 Vlan2    e2333426-eea4-4f5d-a589-336f032ec822  vlan            bond0.2

经过试验,networkmanager在华为ARM服务器上也是如此配置,当然,一个软件而已,并不特定有什么要求.

Reference

  1. Redhat.com - 10.5. CONFIGURE 802.1Q VLAN TAGGING USING A GUI
posted @ 2021-05-28 09:44  素丶素  阅读(1217)  评论(0编辑  收藏  举报