Support DHCP Client FQDN. Allow IAID/DUID for all v4.

Review Request #268 — Created Nov. 12, 2016 and submitted — Latest diff uploaded

seeemef@mac.com
illumos-gate
7388, 8517, 8518, 8519
general
- add options -h,--reqhost and -1,--primary flag to ipadm create-addr for
  DHCP, and add reqhost and primary properties for
  (show|set|reset)-addrprop.
- add dhcpagent options REQUEST_FQDN, DNS_DOMAINNAME, and ADOPT_DOMAINNAME.
- add ncu ip-reqhost and ip-primary properties for NWAM DHCP.
- send for Client Fully Qualified Domain Name (DHCP client option 81) the
  nodename if the interface is primary or the value of -h,--reqhost or
  ip-reqhost in order to request that a compatible DHCP server (such as
  ISC-DHCP or Microsoft Windows DHCP with Windows DNS Dynamic Update) add A
  and PTR resource records for the life of a lease.
- leave existing /etc/hostname.* handling for non-ipadm use to send DHCP
  client option 12 (Hostname), but also recognize -1,--primary (nodename);
  -h,--reqhost; or ip-reqhost if defined. (Hostname is sent if an FQDN
  cannot be determined from configuration).
- add dhcpagent option to use RFC 3315-style client ID (IAID/DUID) for all
  DHCPv4.
- update to allow to GET_TAG of ClientID from dhcpagent state machine to
  let dhcpinfo print a readable version of the system-managed IAID/DUID.
- document defunct client option 89.
- update man pages.
IPADM tests
===========

Initial:

- /etc/nodename is "nod"
- no defined DNS_DOMAINNAME in /etc/default/dhcpagent
- ADOPT_DOMAINNAME is unset (default is no) in /etc/default/dhcpagent
- 2 interfaces: e1000g0, e1000g1

1. create-addr: -T dhcp e1000g1/v4
    - sends DHCP request without Hostname or ClientFQDN
    - show-addr: ok with assigned IP address
    - netstat -D shows no flags for e1000g1
    - no DNS entry

2. create-addr: -T dhcp -1 e1000g0/v4 (use the -1,--primary flag)
    - sends DHCP request with Hostname ("nod")
    - show-addr: ok with assigned IP address
    - netstat -D shows [PRIMARY] for e1000g0

3. edit /etc/default/dhcpagent DNS_DOMAINNAME to foo.example.com, and reboot
    - sends DHCP request with ClientFQDN ("nod" nodename + foo.example.com DNS_DOMAINNAME)
    - DNS registers the new FQDN (in a "foo" child)

    3.b. edit /etc/default/dhcpagent DNS_DOMAINNAME back to example.com, and
        ipadm-refresh-addr e1000g0/v4
    - sends DHCP extension request with new ClientFQDN (nodename + DNS_DOMAINNAME)
    - DNS registers the new FQDN and un-registers the former value

4. set-addrprop -t -p reqhost=nod-m e1000g0/v4
    - sends DHCP extension request message with new ClientFQDN (reqhost + DNS_DOMAINNAME)
    - show-addrprop -o ALL -p reqhost #-- shows correct CURRENT and no PERSISTENT
    - DNS registers the requested FQDN and un-registers the former value

    4.b. (again but without -t flag) set-addrprop -p reqhost=nod-m2 e1000g0/v4
    - sends DHCP extension request message with new ClientFQDN (reqhost + DNS_DOMAINNAME)
    - show-addrprop -o ALL -p reqhost #-- shows correct CURRENT and PERSISTENT
    - DNS registers the requested FQDN and un-registers the former value

5. set-addrprop -p reqhost=nod-m.foo.example.com e1000g0/v4
    - sends DHCP extension request message with new ClientFQDN (reqhost)
    - DNS registers the requested FQDN (in a "foo" child) and un-registers the former value

6. reset-addrprop -p reqhost e1000g0/v4
    - sends DHCP extension request with new ClientFQDN (nodename + DNS_DOMAINNAME)
    - show-addrprop: -o ALL -p reqhost -- shows empty CURRENT and PERSISTENT
    - DNS registers the nodename FQDN and un-registers the former value

7. (non-primary) set-addrprop -p reqhost=nod-r e1000g1/v4
    - sends DHCP extension request message with new ClientFQDN (reqhost + DNS_DOMAINNAME)
    - show-addrprop -o ALL -p reqhost #-- shows correct CURRENT and PERSISTENT
    - DNS registers the requested FQDN

    7.b set-addrprop -p reqhost=nod-r2 e1000g1/v4
    - sends DHCP extension request message with new ClientFQDN (reqhost + DNS_DOMAINNAME)
    - show-addrprop -o ALL -p reqhost #-- shows correct CURRENT and PERSISTENT
    - DNS registers the requested FQDN and un-registers the former value

8. reset-addrprop -p reqhost e1000g1/v4
    - send DHCP extension request without ClientFQDN or Hostname
    - show-addrprop -o ALL -p reqhost #-- shows empty CURRENT and PERSISTENT
    - DNS un-registers the former value

9. edit /etc/default/dhcpagent set ADOPT_DOMAINNAME, unset DNS_DOMAINNAME, and
        refresh-addr e1000g0/v4
    - sends DHCP request with ClientFQDN ("nod" nodename + example.com DNSdmain)
    - DNS registers the requested FQDN and un-registers the former value

10. reset DNSdmain on DHCP server to return foo.example.com, and refresh-addr e1000g0/v4
    - sends DHCP request with ClientFQDN ("nod" nodename + example.com previous DNSdmain)

    10.b (again) refresh-addr e1000g0/v4
    - sends DHCP request with ClientFQDN ("nod" nodename + foo.example.com latest DNSdmain)
    - DNS registers the requested FQDN and un-registers the former value

11. unset DNSdmain on DHCP server, and refresh-addr e1000g0/v4
    - sends DHCP request with ClientFQDN ("nod" nodename + foo.example.com previous DNSdmain)

    11.b refresh-addr e1000g0/v4 again
    - sends DHCP request with ClientFQDN ("nod" nodename + example.com from resolv.conf)

12. reboot
    - sends DHCP request with ClientFQDN ("nod" nodename + example.com from resolv.conf)

13. install new host, activate V4_DEFAULT_IAID_DUID, and create primary dhcp and addrconf addresses
    - sends DHCP Discover message with FQDN and IAID/DUID ClientID
    - IDs show as expected, with common DUID for v6 and v4
    - Windows DNS does NOT register the AAAA. ISC-DHCP 4.3 is documented, however, to
      support this (https://www.reddit.com/r/sysadmin/comments/3ky7yc/howto_with_iscdhcp_43_a_client_configured_with/).

14. create two addresses with active 'primary' flag (ipadm -T dhcp -1 ...)
    - show-addrprop -o ALL -p primary #-- shows both addresses with PERSISTENT "on" but
      only one with CURRENT "on" because dhcpagent enforces that only one can be actively
      primary

NWAM tests
==========

Initial:

- /etc/nodename is "nod"
- no defined DNS_DOMAINNAME in /etc/default/dhcpagent
- 2 interfaces: e1000g0, e1000g1; and 2 DHCP addresses managed already by NWAM

1. set ip-primary=on for e1000g0
    - NWAM bounces the address
    - sends DHCP request with Hostname ("nod" PQDN)
    - DNS server does not register the name
    - netstat -D shows [PRIMARY] for e1000g0

2. edit DNS_DOMAINNAME to example.com, and set ip-primary again to on for e100g0
    - NWAM bounces the address
    - sends DHCP request with ClientFQDN ("nod" hostname + DNS domain name)
    - DNS server registers the FQDN

3. set ip-reqhost for e1000g0 to nod-m
    - NWAM bounces the address
    - sends DHCP request with ClientFQDN ("nod-m" reqhost + DNS domain name)
    - DNS server registers the FQDN and un-registers the former value

4. clear ip-reqhost for e1000g0
    - NWAM bounces the address
    - sends DHCP request with ClientFQDN ("nod" hostname + DNS domain name)
    - DNS server registers the FQDN and un-registers the former value

5. set ip-reqhost for e1000g0 to nod-m.foo.example.com
    - NWAM bounces the address
    - sends DHCP request with ClientFQDN (reqhost)
    - DNS server registers the FQDN (in a sub-folder, "foo") and un-registers the former value
Loading...