RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2177733 - nmstate support for both dhcp and static IP at the same NIC
Summary: nmstate support for both dhcp and static IP at the same NIC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: nmstate
Version: 9.4
Hardware: Unspecified
OS: Linux
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Gris Ge
QA Contact: Mingyu Shi
Mayur Patil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-03-13 14:28 UTC by Nir Magnezi
Modified: 2023-12-14 09:56 UTC (History)
10 users (show)

Fixed In Version: nmstate-2.2.10-3.el9
Doc Type: Enhancement
Doc Text:
.`NetworkManager` now supports both static and DHCP IP configuration on the same network interface By using the `nmstate` utility, you can now assign a static IP address with `dhcp: true` or `autoconf: true` value on the DHCP or Ad-Hoc Network Autoconfiguration (autoconf) enabled interface. With this enhancement, `nmstate` supports two properties of IP addresses: * `valid_lft` means valid lifetime in seconds * `preferred_lft` means preferred lifetime in seconds Default value of both parameters is `forever` which means static. With above properties, `nmstate` can ignore DHCP/autoconf based IP addresses to avoid converting dynamic IP addresses to static IP after applying the queried state back. If your scenario requires having disabled DHCP/autoconf settings with dynamic IP addresses, `nmstate` converts those dynamic IP to static IP addresses.
Clone Of:
Environment:
Last Closed: 2023-11-07 08:24:02 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github nmstate nmstate pull 2303 0 None Merged ip: Support static IP address on with auto ip stack 2023-04-10 11:38:09 UTC
Red Hat Issue Tracker NMT-383 0 None None None 2023-03-14 08:30:31 UTC
Red Hat Issue Tracker RHELPLAN-151689 0 None None None 2023-03-14 08:33:20 UTC
Red Hat Product Errata RHBA-2023:6323 0 None None None 2023-11-07 08:24:23 UTC

Description Nir Magnezi 2023-03-13 14:28:18 UTC
Description of problem:
=======================
We have a customer that is using nmstate with assisted installer.
They use a network configuration that is not currently supported by nmstate, and I wish to know if it could change.
They need to set an IP address to a DHCP-enabled NIC; however, this is currently blocked by nmstate.
Version-Release number of selected component (if applicable):

Some details about their use case:
==================================
The SNO (single node Openshift) server will have a static internal IP set to 192.168.x.y at the factory - an initial server install. This IP will never change and will allow the cluster to move and alter external addresses without affecting the operation of the cluster.

Actual results:
===============
Error: https://github.com/nmstate/nmstate/blob/ad669296545a0fb7f3bd9745155016c8fd474aaf/rust/src/lib/ip.rs#L277-L286

Expected results:
=================
A nic with both DHCP and a static IP

Comment 8 Gris Ge 2023-04-04 11:08:44 UTC
Patch sent to upstream: https://github.com/nmstate/nmstate/pull/2303


Introducing two properties for IP address:
 * `valid-left`: seconds for IP address been valid. `forever` means
   static.
 * `preferred_left`: seconds for IP address been preferred. `forever`
   means static.

With above properties, we can identify which certain IP address is
retrieved from DHCP/Autoconf so we don't convert dynamic IP address to
static when user apply the queried state back.

With this patch, user is allowed to set static IP address with
`dhcp: true` and/or `autoconf: true`.

When desire state has DHCP/Autoconf disabled but all desired IP
addresses are dynamic, nmstate will convert those dynamic IP to static.
This is common use case where user just copy retrieved dynamic IP and
hoping nmstate can convert it to static.


Example query output of a interface has both static IP and dynamic IP:

```yml
---
interfaces:
  - name: dhcpcli
    type: ethernet
    state: up
    ipv4:
      enabled: true
      dhcp: true
      address:
      - ip: 192.0.2.99
        prefix-length: 24
      - ip: 192.0.2.97
        prefix-length: 24
        valid-left: 30sec
        preferred-left: 30sec
    ipv6:
      enabled: true
      dhcp: true
      autoconf: true
      address:
      - ip: 2001:db8:a::9
        prefix-length: 64
      - ip: 2001:db8:a::2
        prefix-length: 64
        valid-left: 30sec
        preferred-left: 30sec
```

Comment 9 Gris Ge 2023-04-04 11:20:55 UTC
Please be aware above two new properties is query only. IP address with above properties set to non-forever will be ignored unless it meet the special use case above.

Comment 14 Mingyu Shi 2023-05-22 10:03:55 UTC
Verified with:
nmstate-2.2.10-3.el9.x86_64
nispor-1.2.10-1.el9.x86_64
NetworkManager-1.43.8-1.el9.x86_64
DISTRO=RHEL-9.3.0-updates-20230520.44

Comment 19 errata-xmlrpc 2023-11-07 08:24:02 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 (nmstate 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-2023:6323


Note You need to log in before you can comment on or make changes to this bug.