-
Bug
-
Resolution: Unresolved
-
Normal
-
None
-
rhel-9.7
-
None
-
None
-
Low
-
rhel-net-mgmt
-
3
-
False
-
False
-
-
None
-
None
-
-
None
-
None
-
Unspecified
-
Unspecified
-
Unspecified
-
None
Hi,
This bug / missing feature affects RHEL 9, but I can also reproduce it in CentOS 10 with latest upstream.
For futher details, also see upstream:
- https://github.com/nmstate/nmstate/issues/3080
- https://github.com/nmstate/nmstate/pull/3079
And downstream: - https://issues.redhat.com/browse/OCPBUGS-73902 (in RHEL 9.8, FRR will slightly change its behavior, hence it's needed to set the route-metric).
---------------------------------------------
Coming from the base configuration in centos 10, I'm statically configuring 2 interfaces:
nmcli conn mod "Wired connection 3" connection.id enp3s0 ipv4.method static ipv4.address 192.168.124.10/24 ipv6.method disabled nmcli conn mod "Wired connection 2" connection.id enp2s0 ipv4.method static ipv4.address 192.168.123.10/24 ipv6.method disabled
I can configure default route-metric for an interface via nmcli:
nmcli conn mod enp2s0 ipv4.route-metric 149
If this value is set to -1 in nmcli, then the kernel picks its own metric.
[root@metallb-k8s nmstate]# ip r
(...)
192.168.123.0/24 dev enp2s0 proto kernel scope link src 192.168.123.10 metric 436 # <---- want to change this one here, pick by kernel
(...)
[root@metallb-k8s nmstate]# nmcli conn mod enp2s0 ipv4.route-metric 149
[root@metallb-k8s nmstate]# nmcli conn up enp2s0
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/94)
[root@metallb-k8s nmstate]# ip r
(...)
192.168.123.0/24 dev enp2s0 proto kernel scope link src 192.168.123.10 metric 149 # <---- changed
(...)
Note, that's with static networking.
This is needed because I have 2 directly connected routes out of 2 interfaces:
192.168.123.0/24 dev enp2s0 proto kernel scope link src 192.168.123.10 metric 436 192.168.124.0/24 dev enp3s0 proto kernel scope link src 192.168.124.10 metric 437
However, I need to be able to set the same metric for each of them:
[root@metallb-k8s nmstate]# nmcli conn mod enp2s0 ipv4.route-metric 149 [root@metallb-k8s nmstate]# nmcli conn mod enp3s0 ipv4.route-metric 149 [root@metallb-k8s nmstate]# nmcli conn up enp2s0 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/95) [root@metallb-k8s nmstate]# nmcli conn up enp3s0 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/96) [root@metallb-k8s nmstate]# ip r (...) 192.168.123.0/24 dev enp2s0 proto kernel scope link src 192.168.123.10 metric 149 192.168.124.0/24 dev enp3s0 proto kernel scope link src 192.168.124.10 metric 149
The reason why I need this is that FRR's BGP algorithm considers the metric of the directly connected routes when determining if it wants to use multipath routing:
metallb-k8s# show ip bgp 192.0.2.0/24 BGP routing table entry for 192.0.2.0/24, version 1 Paths: (2 available, best #1, table default) Advertised to peers: 192.168.123.50 192.168.124.50 65100 192.168.123.50 (metric 149) from 192.168.123.50 (192.168.123.50) # <-- frr knowsthe metric Origin IGP, metric 0, valid, external, multipath, best (Router ID) Last update: Thu Feb 5 09:39:29 2026 65100 192.168.124.50 (metric 149) from 192.168.124.50 (192.168.124.50) # <-- frr knows the metric Origin IGP, metric 0, valid, external, multipath Last update: Thu Feb 5 09:39:29 2026
So it can install 2 nexthops:
# ip r
default via 192.168.122.1 dev enp1s0 proto dhcp src 192.168.122.19 metric 100
192.0.2.0/24 nhid 18 proto bgp metric 20
nexthop via 192.168.123.50 dev enp2s0 weight 1
nexthop via 192.168.124.50 dev enp3s0 weight 1
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.19 metric 100
192.168.123.0/24 dev enp2s0 proto kernel scope link src 192.168.123.10 metric 149
192.168.124.0/24 dev enp3s0 proto kernel scope link src 192.168.124.10 metric 14
Not pasting the output here for brevity, but if the metric of the directly connected routes isn't the same, only the better metric route will be installed.
Currently, auto-route-metric only sets ipv4.metric / ipv6.metric when the interface configuration is autoconf / dhcp. However, there must be a way to set ipv4.metric / ipv6.metric regardless of the interface mode, as this is also required e.g. for static interface configuration.
# cat nmstate.yml
interfaces:
- name: enp2s0
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
address:
- ip: 192.168.123.10
prefix-length: 24
auto-route-metric: 151 # <--------- request change to 151
forwarding: false
ipv6:
enabled: false
dhcp: false
autoconf: false
- name: enp3s0
type: ethernet
state: up
ipv4:
enabled: true
dhcp: false
address:
- ip: 192.168.124.10
prefix-length: 24
auto-route-metric: 151 # <--------- request change to 151
forwarding: false
ipv6:
enabled: false
dhcp: false
autoconf: false
# nmcli apply nmstate.yaml
(...)
# nmcli conn show enp2s0 | grep metric
ipv4.route-metric: 149 # <----- nmstate did not apply the change
ipv6.route-metric: -1
# nmstatectl show | grep auto-route-metric
[2026-02-05T11:59:01Z INFO nmstatectl] Nmstate version: 2.2.57
auto-route-metric: 149
auto-route-metric: 149