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: VERIFIED --- 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: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Feature: Support DHCP option `dhcp-send-hostname` and `dhcp-custom-hostname` in nmstate Reason: In order to support Fedora CoreOS use case, nmstate is required to support two extra DHCP options for hostname. Result: Introduced 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.
Story Points: ---
Clone Of: Environment:
Last Closed: 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 8 Mayur Patil 2023-05-26 11:34:33 UTC
Hi Mingyu,

please provide doc text. Thanks.