Skip to content

Commit

Permalink
ovs-configuration: use lower than NM default ethernet route metric
Browse files Browse the repository at this point in the history
Setting the default NM route metric for ovs-if-br-ex is problematic
in the presence of other Ethernet ports. In that case, ovs-if-br-ex
as well as the Ethernet ports will have the same route metric, and
the winner is undefined. Lower ovs-if-br-ex route metric to 49 to
avoid ambiguous situations.

Conflicts:
  templates/common/_base/files/configure-ovs-network.yaml

Signed-off-by: Andreas Karis <ak.karis@gmail.com>
(cherry picked from commit e6a673d)
  • Loading branch information
andreaskaris committed Jan 24, 2022
1 parent 23d93af commit 3711b7c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions templates/common/_base/files/configure-ovs-network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ contents:
done
}
# when creating the bridge, we use a value lower than NM's ethernet device default route metric
# (we pick 49 to be lower than anything that NM chooses by default)
BRIDGE_METRIC="49"
# Given an interface, generates NM configuration to add to an OVS bridge
convert_to_bridge() {
iface=${1}
bridge_name=${2}
Expand Down Expand Up @@ -171,14 +175,14 @@ contents:
extra_brex_args+="ipv6.addr-gen-mode ${ipv6_addr_gen_mode} "
fi
# create bridge; use NM's ethernet device default route metric (100)
# create bridge
if ! nmcli connection show "$bridge_name" &> /dev/null; then
nmcli c add type ovs-bridge \
con-name "$bridge_name" \
conn.interface "$bridge_name" \
802-3-ethernet.mtu ${iface_mtu} \
ipv4.route-metric 100 \
ipv6.route-metric 100 \
ipv4.route-metric "$BRIDGE_METRIC" \
ipv6.route-metric "$BRIDGE_METRIC" \
${extra_brex_args}
fi
Expand Down Expand Up @@ -323,7 +327,7 @@ contents:
else
nmcli c add type ovs-interface slave-type ovs-port conn.interface "$bridge_name" master "$ovs_port" con-name \
"$ovs_interface" 802-3-ethernet.mtu ${iface_mtu} 802-3-ethernet.cloned-mac-address ${iface_mac} \
ipv4.route-metric 100 ipv6.route-metric 100
ipv4.route-metric "$BRIDGE_METRIC" ipv6.route-metric "$BRIDGE_METRIC"
fi
fi
Expand Down

0 comments on commit 3711b7c

Please sign in to comment.