Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 2187622

Summary: RFE: Support missing features from fedora coreos examples at documentation
Product: Red Hat Enterprise Linux 9 Reporter: Quique Llorente <ellorent>
Component: nmstateAssignee: Gris Ge <fge>
Status: CLOSED ERRATA QA Contact: Mingyu Shi <mshi>
Severity: medium Docs Contact: Mayur Patil <maypatil>
Priority: unspecified    
Version: 9.2CC: ferferna, fge, jiji, jishi, maypatil, network-qe, sfaye, till
Target Milestone: rcKeywords: FutureFeature, Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
.The `nmstate` API support available for `dhcp-send-hostname` and `dhcp-custom-hostname` DHCP options With this enhancement, the `nmstate` utility supports configuration of the following two DHCP options in the connection file: * `dhcp-send-hostname`: `true` or `false` value. If a DHCP request needs the hostname or fully qualified domain name (FQDN) option, the hostname from that option is set. The default is `true`. * `dhcp-custom-hostname`: <string>. Use this option to configure the hostname or FQDN option in a DHCP request, value type is string. For DHCPv4 network protocols :: * If the hostname is FQDN, see the `Fully Qualified Domain Name (FQDN)`, option (81) in RFC 4702. * If the hostname is not FQDN, see the `Host Name`, option (12) in RFC 2132. For DHCPv6 network protocols:: [.text-left] Supports custom string, empty domain name, overrides the hostname for a DHCP request. See the `Fully Qualified Domain Name (FQDN)`, option (29) in RFC 4704.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-11-07 08:24:03 UTC Type: Feature Request
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Quique Llorente 2023-04-18 08:11:50 UTC
Description of problem:
Now that nmstatectl is part of FCOS/RHCOS it should support the same features presented at FCOS network examples at documentation [1]

Missing features:
- dhcp-send-hostname
- dhcp-hostname

[1] https://docs.fedoraproject.org/en-US/fedora-coreos/sysconfig-network-configuration


Version-Release number of selected component (if applicable): 2.x


How reproducible: Always


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Gris Ge 2023-04-18 12:21:54 UTC
Patch sent to upstream: https://github.com/nmstate/nmstate/pull/2315

Introducing these two DHCP options:
 * `dhcp-send-hostname`: true of false, whether DHCP request should
   contain hostname/FQDN option. Default is true.
 * `dhcp-custom-hostname`: String. Customer hostname/FQDN in DHCP
   request.

For DHCPv4, if the hostname is FQDN, the 'Fully Qualified Domain Name
(FQDN)' option(81) defined in RFC 4702 will be used.
If the hostname is not FQDN, the 'Host Name' option(12) defined in RFC
2132 will be used.

For DHCPv6, custom string to override hostname used for DHCP request in
`Fully Qualified Domain Name (FQDN)` option(29) defined in RFC 4704 as
RFC 4704 allows empty domain name.

Example YAML:

```yml
---
interfaces:
  - name: eth1
    type: ethernet
    state: up
    mtu: 1500
    ipv4:
      dhcp: true
      dhcp-client-id: iaid+duid
      enabled: true
      dhcp-send-hostname: true
      dhcp-custom-hostname: c9.example.org
    ipv6:
      dhcp: true
      autoconf: true
      enabled: true
      dhcp-send-hostname: true
      dhcp-custom-hostname: c9.example.net
```

Comment 3 Quique Llorente 2023-04-18 12:40:14 UTC
Do we cover the fcos examples with this ?

https://docs.fedoraproject.org/en-US/fedora-coreos/sysconfig-network-configuration/#_configuring_a_static_ip

Comment 4 Gris Ge 2023-04-20 11:37:46 UTC
Yes. For `ip=10.10.10.10::10.10.10.1:255.255.255.0:myhostname:ens2:none:8.8.8.8`, nmstate YAML is:


```yml
---
hostname:
  config: myhostname
dns-resolver:
  config:
    server:
    - 8.8.8.8
routes:
  config:
  - destination: 0.0.0.0/0
    next-hop-address: 10.10.10.1
    next-hop-interface: ens2
interfaces:
  - name: ens2
    type: ethernet
    state: up
    ipv4:
      address:
      - ip: 10.10.10.1
        prefix-length: 24
      dhcp: false
      enabled: true
    ipv6:
      enabled: false
```

Comment 7 Mingyu Shi 2023-05-21 09:29:48 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

[17:26:27@dell-per730-20 ~]0# nms set dhcp-send.yaml 
/tmp/nmstatelog/2023-05-21-17:27:21-038936344.log
dns-resolver: {}
route-rules: {}
routes: {}
interfaces:
- name: veth0
  type: ethernet
  state: up
  mtu: 1500
  ipv4:
    enabled: true
    dhcp: true
    dhcp-client-id: iaid+duid
    dhcp-send-hostname: true
    dhcp-custom-hostname: c9.example.org
  ipv6:
    enabled: true
    dhcp: true
    autoconf: true
    dhcp-send-hostname: true
    dhcp-custom-hostname: c9.example.net
  veth:
    peer: veth0_p
ovs-db: {}

/tmp/nmstatelog/2023-05-21-17:27:21-038936344.0.log nmstatectl set dhcp-send.yaml return 0
[17:27:23@dell-per730-20 ~]0# nmcli con show veth0 | grep -i dhcp
ipv4.dhcp-client-id:                    duid
ipv4.dhcp-iaid:                         --
ipv4.dhcp-timeout:                      2147483647 (infinity)
ipv4.dhcp-send-hostname:                yes
ipv4.dhcp-hostname:                     --
ipv4.dhcp-fqdn:                         c9.example.org
ipv4.dhcp-hostname-flags:               0x0 (none)
ipv4.dhcp-vendor-class-identifier:      --
ipv4.dhcp-reject-servers:               --
ipv6.dhcp-pd-hint:                      --
ipv6.dhcp-duid:                         ll
ipv6.dhcp-iaid:                         mac
ipv6.dhcp-timeout:                      2147483647 (infinity)
ipv6.dhcp-send-hostname:                yes
ipv6.dhcp-hostname:                     c9.example.net
ipv6.dhcp-hostname-flags:               0x0 (none)

Comment 11 errata-xmlrpc 2023-11-07 08:24:03 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