设置 VLAN

    1. _nic=ens36
    2. _vlan=11
    3. _vnic_name="$_nic.$_vlan"
    4. ip link add link "$_nic" name "$_vnic_name" type vlan id "$_vlan" 2>/dev/null
    5. ip link set "$_vnic_name" up
    6. _vnic_macvlan="vnic.static.101"
    7. _ip_mask="192.168.11.1/24"
    8. ip link add link "$_vnic_name" dev "$_vnic_macvlan" type macvlan mode private
    9. ip addr add "$_ip_mask" dev "$_vnic_macvlan"
    10. ip link set "$_vnic_macvlan" up