OpenVSwitch static mac address configuration for internal interface

thorazine74

Member
May 29, 2023
3
0
6
Hello, how can I set an internal interface static mac address in /etc/network/interfaces for OpenSwitch?
I'm currently have this:
Code:
auto ovs00_internal
iface ovs00_internal inet manual
  ovs_type OVSBridge
  ovs_ports ovsp_untagged

auto ovsp_untagged
iface ovsp_untagged inet manual
  ovs_type OVSIntPort
  ovs_bridge ovs00_internal
  ovs_extra set Interface ovsp_untagged mac="aa\:00\:97\:b0\:02\:c8"

When rising up the config the internal port does not created probably because of the escape char adding an extra space:

Code:
root@debi7:~# ifup -v ovs00_internal ovsp_untagged
info: requesting link dump
info: requesting address dump
info: requesting netconf dump
info: loading builtin modules from ['/usr/share/ifupdown2/addons']
info: module ppp not loaded (module init failed: no /usr/bin/pon found)
info: module batman_adv not loaded (module init failed: no /usr/sbin/batctl found)
info: executing /sbin/sysctl net.bridge.bridge-allow-multiple-vlans
info: module mstpctl not loaded (module init failed: no /sbin/mstpctl found)
info: executing /bin/ip rule show
info: executing /bin/ip -6 rule show
info: address: using default mtu 1500
info: address: max_mtu undefined
info: executing /sbin/sysctl net.ipv6.conf.all.accept_ra
info: executing /sbin/sysctl net.ipv6.conf.all.autoconf
info: executing /usr/sbin/ip vrf id
info: mgmt vrf_context = False
info: executing /bin/ip addr help
info: address metric support: OK
info: module ppp not loaded (module init failed: no /usr/bin/pon found)
info: module mstpctl not loaded (module init failed: no /sbin/mstpctl found)
info: module batman_adv not loaded (module init failed: no /usr/sbin/batctl found)
info: looking for user scripts under /etc/network
info: loading scripts under /etc/network/if-pre-up.d ...
info: loading scripts under /etc/network/if-up.d ...
info: loading scripts under /etc/network/if-post-up.d ...
info: loading scripts under /etc/network/if-pre-down.d ...
info: loading scripts under /etc/network/if-down.d ...
info: loading scripts under /etc/network/if-post-down.d ...
info: using mgmt iface default prefix eth
info: processing interfaces file /etc/network/interfaces
info: ovs00_internal: running ops ...
info: executing /usr/bin/ovs-vsctl -- --may-exist add-br ovs00_internal
info: executing /sbin/sysctl net.mpls.conf.ovs00_internal.input=0
info: ovs00_internal: netlink: ip link set dev ovs00_internal up
info: executing /etc/network/if-up.d/resolved
info: executing /etc/network/if-up.d/chrony
info: executing /etc/network/if-up.d/postfix
info: ovsp_untagged: running ops ...
info: executing /usr/bin/ovs-vsctl -- --may-exist add-port ovs00_internal ovsp_untagged -- --if-exists clear port ovsp_untagged bond_active_slave bond_mode cvlans external_ids lacp mac other_config qos tag trunks vlan_mode -- --if-exists clear interface ovsp_untagged mtu_request external-ids other_config options -- set Interface ovsp_untagged type=internal -- set Interface ovsp_untagged mac="aa :00 :97 :b0 :02 :c8"
info: executing /etc/network/if-up.d/resolved
info: executing /etc/network/if-up.d/chrony
info: executing /etc/network/if-up.d/postfix
info: running upperifaces (parent interfaces) if available ..
info: ovsp_untagged: running ops ...
info: executing /usr/bin/ovs-vsctl -- --may-exist add-port ovs00_internal ovsp_untagged -- --if-exists clear port ovsp_untagged bond_active_slave bond_mode cvlans external_ids lacp mac other_config qos tag trunks vlan_mode -- --if-exists clear interface ovsp_untagged mtu_request external-ids other_config options -- set Interface ovsp_untagged type=internal -- set Interface ovsp_untagged mac="aa :00 :97 :b0 :02 :c8"
info: executing /etc/network/if-up.d/resolved
info: executing /etc/network/if-up.d/chrony
info: executing /etc/network/if-up.d/postfix
warning: ovsp_untagged: interface not recognized - please check interface configuration
info: exit status 0

However running the same command on the terminal with proper escaping succeeds:

Code:
root@debi7:~# /usr/bin/ovs-vsctl -- --may-exist add-port ovs00_internal ovsp_untagged -- --if-exists clear port ovsp_untagged bond_active_slave bond_mode cvlans external_ids lacp mac other_config qos tag trunks 
vlan_mode -- --if-exists clear interface ovsp_untagged mtu_request external-ids other_config options -- set Interface ovsp_untagged type=internal -- set Interface ovsp_untagged mac="aa\:00\:97\:b0\:02\:c8"
root@debi7:~# ovs-vsctl list interface ovsp_untagged                                                                                                                                                               
_uuid               : 551870e1-eb49-47be-ae5a-5a2b69483f59                                                                                                                                                         
admin_state         : down                                                                                                                                                                                         
bfd                 : {}                                                                                                                                                                                           
bfd_status          : {}                                                                                                                                                                                           
cfm_fault           : []                                                                                                                                                                                           
cfm_fault_status    : []                                                                                                                                                                                           
cfm_flap_count      : []                                                                                                                                                                                           
cfm_health          : []                                                                                                                                                                                           
cfm_mpid            : []                                                                                                                                                                                           
cfm_remote_mpids    : []                                                                                                                                                                                           
cfm_remote_opstate  : []                                                                                                                                                                                           
duplex              : []                                                                                                                                                                                           
error               : []                                                                                                                                                                                           
external_ids        : {}                                                                                                                                                                                           
ifindex             : 38                                                                                                                                                                                           
ingress_policing_burst: 0                                                                                                                                                                                          
ingress_policing_kpkts_burst: 0                                                                                                                                                                                    
ingress_policing_kpkts_rate: 0                                                                                                                                                                                     
ingress_policing_rate: 0                                                                                                                                                                                           
lacp_current        : []                                                                                                                                                                                           
link_resets         : 0                                                                                                                                                                                            
link_speed          : []                                                                                                                                                                                           
link_state          : down                                                                                                                                                                                         
lldp                : {}                                                                                                                                                                                           
mac                 : "aa:00:97:b0:02:c8"                                                                                                                                                                          
mac_in_use          : "aa:00:97:b0:02:c8"                                                                                                                                                                          
mtu                 : 1500                                                                                                                                                                                         
mtu_request         : []                                                                                                                                                                                           
name                : ovsp_untagged                                                                                                                                                                                
ofport              : 1                                                                                                                                                                                            
ofport_request      : []                                                                                                                                                                                           
options             : {}                                                                                                                                                                                           
other_config        : {}                                                                                                                                                                                           
statistics          : {collisions=0, rx_bytes=0, rx_crc_err=0, rx_dropped=1, rx_errors=0, rx_frame_err=0, rx_missed_errors=0, rx_multicast_packets=0, rx_over_err=0, rx_packets=0, tx_bytes=0, tx_dropped=0, tx_err
ors=0, tx_packets=0}                                                                                                                                                                                               
status              : {driver_name=openvswitch}                                                                                                                                                                    
type                : internal
 
I set it this way - in this example vlan10 is used as pve managment vlan

Code:
iface vlan10 inet static
        ovs_type OVSIntPort
        ovs_bridge vmbr0
        ovs_options tag=10
        address 10.10.0.2/24
        gateway 10.10.0.1
        hwaddress aa:00:97:b0:02:c8