Bug 2094353

Summary: IP assigned through DHCP became secondary IP address
Product: Red Hat Enterprise Linux 9 Reporter: Fernando F. Mancera <ferferna>
Component: NetworkManagerAssignee: Fernando F. Mancera <ferferna>
Status: CLOSED ERRATA QA Contact: Vladimir Benes <vbenes>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1CC: bgalvani, lrintel, mberezny, rkhan, sfaye, sukulkar, thaller, till, vbenes
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2094778 (view as bug list) Environment:
Last Closed: 2022-11-15 10:50:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2094778    

Description Fernando F. Mancera 2022-06-07 13:11:02 UTC
This bug is a clone of https://bugzilla.redhat.com/show_bug.cgi?id=2090431 for RHEL 9.1

Description of problem:

After NetworkManager update to 8.6, IP assigned through DHCP became secondary IP address

Version-Release number of selected component (if applicable):
NetworkManager-1.36.0-4.el8

How reproducible:

Create interface with static and dynamic IP as below:

# cat /etc/sysconfig/network-scripts/ifcfg-enp8s0 
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=enp8s0
UUID=ca4b54a7-8bae-4876-9031-095400dc6919
DEVICE=enp8s0
ONBOOT=yes
IPADDR=192.168.122.231
NETMASK=255.255.255.0


before NM update : primary IP: 192.168.122.230  secondary IP: 192.168.122.231
after NM update  : primary IP: 192.168.122.231  secondary IP: 192.168.122.230
 
With 1.32.10-4 of NM DHCP IP selected as primary, after updating to the latest NM i.e. 1.36.0-4 we can see DHCP IP considered as secondary:
 
 
NetworkManager-1.32.10-4.el8:
=============================
[root@localhost ~]# ip a s enp8s0
4: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:eb:40:a5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.230/24 brd 192.168.122.255 scope global dynamic noprefixroute enp8s0  <<--- dhcp IP as primary
       valid_lft 3452sec preferred_lft 3452sec
    inet 192.168.122.231/24 brd 192.168.122.255 scope global secondary noprefixroute enp8s0
       valid_lft forever preferred_lft forever
    inet6 fe80::fd58:b9d:d593:74e2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
 
 
NetworkManager-1.36.0-4.el8
============================
[root@localhost ~]# ip a s enp8s0
4: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:eb:40:a5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.231/24 brd 192.168.122.255 scope global noprefixroute enp8s0
       valid_lft forever preferred_lft forever
    inet 192.168.122.230/24 brd 192.168.122.255 scope global secondary dynamic noprefixroute enp8s0 <<--- dhcp IP as secondary
       valid_lft 3283sec preferred_lft 3283sec
    inet6 fe80::fd58:b9d:d593:74e2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever


Then I selected development NM packages and can see this behavior visible from NetworkManager-1.36.0-0.2:
 
NetworkManager-1.36.0-0.1.el8:
==============================
[root@localhost ~]# ip a s enp8s0
4: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:eb:40:a5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.230/24 brd 192.168.122.255 scope global dynamic noprefixroute enp8s0
       valid_lft 3579sec preferred_lft 3579sec
    inet 192.168.122.231/24 brd 192.168.122.255 scope global secondary noprefixroute enp8s0
       valid_lft forever preferred_lft forever
    inet6 fe80::fd58:b9d:d593:74e2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
 
NetworkManager-1.36.0-0.2.el8:
==============================
[root@localhost ~]# ip a s enp8s0
4: enp8s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:eb:40:a5 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.231/24 brd 192.168.122.255 scope global noprefixroute enp8s0
       valid_lft forever preferred_lft forever
    inet 192.168.122.230/24 brd 192.168.122.255 scope global secondary dynamic noprefixroute enp8s0
       valid_lft 3532sec preferred_lft 3532sec
    inet6 fe80::fd58:b9d:d593:74e2/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
 


Question:
=========
- Is this behavior intentional?
- Can we know, why the behavior is changed from NetworkManager-1.36.0-0.1.el8 to NetworkManager-1.36.0-0.2.el8? Also, if there is any commit for this change, can we get that details as well?

Comment 6 Vladimir Benes 2022-07-11 08:50:18 UTC
covered in NMCI via ipv4_check_addr_order test

Comment 7 Thomas Haller 2022-08-23 08:35:41 UTC
(In reply to Fernando F. Mancera from comment #0)

> Question:
> =========
> - Is this behavior intentional?

Yes

> - Can we know, why the behavior is changed from
> NetworkManager-1.36.0-0.1.el8 to NetworkManager-1.36.0-0.2.el8? Also, if
> there is any commit for this change, can we get that details as well?

there is not one commit, because over the time there were many issues and the code got reworked heavily over time.

https://bugzilla.redhat.com/show_bug.cgi?id=1995372#c5 is a lengthy summary.

It was always the goal, is that manual configuration is to be preferred over DHCP (or other "auto" settings). If that didn't happen, it was a bug that got fixed now.

Note that NetworkManager 1.36 still has some subtle issues, that only will be fixed in 1.38+.


People in particular care about the primary/secondary flag of addresses, to affect source address selection. In some cases, you want that the DHCP address is used for an outgoing connection. This change (of prefering manual over DHCP) seems to contradict that.

However, what's also new in 1.36+ is that routes from DHCP get the source attribute set. So while the manual address may now be the primary, if a destination is to be reached via DHCP, then the DHCP address will be used for source address selection. Btw, if you want to override that yet again, add a manual route along the manual address, that uses the desired "src".

Comment 9 errata-xmlrpc 2022-11-15 10:50:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (NetworkManager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:8265