Bug 2212741

Summary: network system role deletes gateway information
Product: Red Hat Enterprise Linux 9 Reporter: Marko Myllynen <myllynen>
Component: nmstateAssignee: Gris Ge <fge>
Status: ON_QA --- QA Contact: Mingyu Shi <mshi>
Severity: high Docs Contact:
Priority: unspecified    
Version: 9.2CC: ferferna, fge, jiji, jishi, juschind, mtenheuv, network-qe, sfaye, spetrosi, till, wenliang
Target Milestone: rcKeywords: Triaged
Target Release: 9.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: nmstate-2.2.14-1.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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:

Description Marko Myllynen 2023-06-06 08:15:39 UTC
Description of problem:
I have two freshly installed test VMs, all defaults Server Minimal install of RHEL 8.8 and RHEL 9.2, then all updates applied and VMs rebooted.

This is their network configuration:

# grep -v ^# /etc/NetworkManager/NetworkManager.conf | grep -v ^$
[main]
plugins=keyfile
[logging]
# cat /etc/NetworkManager/system-connections/enp1s0.nmconnection
[connection]
id=enp1s0
uuid=ea4d1672-de2e-3b87-a234-5f861e452d77
type=ethernet
interface-name=enp1s0

[ethernet]

[ipv4]
address1=192.168.122.221/24,192.168.122.1
dns=192.168.1.1;
dns-options=edns0;no-aaaa;trust-ad;
dns-search=example.com;
method=manual

[ipv6]
method=disabled

[proxy]

Running a playbook on a RHEL 9 control host with:

  vars:
    network_state:
      dns-resolver:
        config:
          server:
            - 192.168.1.1
            - 127.0.0.1
          search:
            - example.com
            - domain.name
  roles:
    - redhat.rhel_system_roles.network

I see that configuration was changed for both managed VMs and on RHEL 8 the result looks like this:

[ipv4]
address1=192.168.122.170/24
dhcp-client-id=mac
dns=192.168.1.1;127.0.0.1;
dns-options=edns0;no-aaaa;trust-ad;
dns-priority=40
dns-search=example.com;domain.name;
method=manual
route1=0.0.0.0/0,192.168.122.1,100
route1_options=table=254

However on RHEL 9 the result is:

[ipv4]
address1=192.168.122.221/24
dns=192.168.1.1;127.0.0.1;
dns-options=edns0;no-aaaa;trust-ad;
dns-priority=40
dns-search=example.com;domain.name;
method=manual

Version-Release number of selected component (if applicable):
ansible-core-2.14.2-4.el9.x86_64
rhel-system-roles-1.21.1-1.el9_2.noarch

Comment 1 Wen Liang 2023-06-06 18:50:10 UTC
Thanks for reporting this, this is a valid report, I already reproduced it in RHEL 9.2 (lost the gateway information), since the `network_state` was using the nmstate as the backend, I'd like to change the component into nmstate.

Comment 4 Gris Ge 2023-07-11 13:28:34 UTC
The root cause is previous state is not generated by nmstate and using old setting method on gateway:

```
address1=192.168.122.221/24,192.168.122.1
```

we are expecting gateway been set as

```
route1=0.0.0.0/0,192.168.122.1,100
```

Anyway, you will get a fix soon.

Comment 5 Gris Ge 2023-07-17 06:52:05 UTC
Patch sent to upstream: https://github.com/nmstate/nmstate/pull/2387

If you need fix been backported to RHEL 9.2, please let me know.