<?xml version="1.0" encoding="utf-8"?>
<!-- vim: et:ts=2:sw=2
  -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" category="std" docName="draft-equinox-intarea-dhcpv4-route4via6-02" ipr="trust200902" obsoletes="" submissionType="IETF" consensus="true" xml:lang="en" version="3">
  <front>
    <title abbrev="intarea-dhcpv4-route4via6">DHCPv4 Option for IPv4 routes with IPv6 nexthops</title>
    <seriesInfo name="Internet-Draft" value="draft-equinox-intarea-dhcpv4-route4via6-02"/>
    <author fullname="David 'equinox' Lamparter" initials="D" surname="Lamparter">
      <organization>NetDEF, Inc.</organization>
      <address>
        <postal>
          <city>San Jose</city>
          <country>USA</country>
        </postal>
        <email>equinox@diac24.net</email>
        <email>equinox@opensourcerouting.org</email>
      </address>
    </author>
    <author fullname="Tobias Fiebig" initials="T." surname="Fiebig">
      <organization abbrev="MPI-INF">Max-Planck-Institut fuer Informatik</organization>
      <address>
        <postal>
          <street>Campus E14</street>
          <city>Saarbruecken</city>
          <code>66123</code>
          <country>Germany</country>
        </postal>
        <phone>+49 681 9325 3527</phone>
        <email>tfiebig@mpi-inf.mpg.de</email>
      </address>
    </author>
    <date year="2025"/>
    <area>Internet</area>
    <workgroup>Internet Area Working Group</workgroup>
    <keyword>IPv6</keyword>
    <keyword>IPv4</keyword>
    <keyword>nexthop</keyword>
    <keyword>route</keyword>
    <abstract>
      <t>
          As a result of the shortage of IPv4 addresses, installations are
          increasingly recovering IPv4 addresses from uses where they are not
          strictly necessary.  One such situation is in establishing next hops
          for IPv4 routes, replacing this use with IPv6 addresses.  This
          document describes how to provision DHCP-configured hosts with
          their routes in such a situation.
      </t>
      <t>
        <cref>
          This draft lives at <eref target="https://github.com/eqvinox/dhc-route4via6"/>
        </cref>
      </t>
    </abstract>
  </front>
  <middle>
    <section>
      <name>Introduction</name>
      <t>
          IPv4 is currently (and will likely be for some time) in a situation
          where IPv4 addresses are in short supply, but services still need to be
          made available to users that do not yet have IPv6 connectivity.  In
          some cases, even the service side may not have IPv6 support
          yet.  In other cases some aspect of the service precludes using
          proxy-style service delivery with translation technologies on either
          or both sides.  This leads to a need for fine-grained deployment of
          IPv4 connectivity with minimum wastage of addresses.
      </t>
      <t>
          A particularly interesting improvement enabled by the extension
          described here is the complete removal of IPv4 addresses from
          first-hop routers acting as DHCPv4/v6 relays, while still providing IPv4
          connectivity.  In this scenario, the relay (assumed colocated with
          the router) has no IPv4 address to use to communicate with the
          client.  An almost-working solution for this case is presented by
          <xref target="DHCPv6"/> with the <xref target="DHCP4o6"/> transport
          method.  Since this mechanism encapsulates IPv4 DHCP messages, all
          related IPv4 configuration can be carried. However, DHCPv4 does not
          support a way to encode an IPv6 default gateway or other routes,
          which is necessary in this case.
      </t>
      <t>
          If the router and relay are not co-located, the relay may have an
          IPv4 address while the router does not.  In this case, the option
          described in this document could be carried in a plain IPv4 DHCP
          message.
      </t>
      <t>
          Note that the changes described in this document are to DHCPv4, not
          DHCPv6.
      </t>
    </section>
    <section>
      <name>Requirements Language</name>
      <t>
          The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
          "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
          RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
          interpreted as described in BCP 14 <xref target="RFC2119"/>
          <xref target="RFC8174"/> when, and only when, they appear in
          all capitals, as shown here.
      </t>
    </section>

    <section anchor="semantics">
      <name>Extended static route function</name>
      <t>
          This document defines a list-style DHCPv4 option.  Each item
          describes a pair of IPv4 destination prefix and an associated
          nexthop. As per usual DHCPv4 processing
          (<xref target="DHCP-LONGOPT"/>), multiple instances of the option
          are concatenated before splitting the result up into individual
          pairs.
      </t>
      <ol>
        <li>
            each pair is processed as one unit, building up a list of
            destination prefixes and next-hops.  It is expected that the
            list will in most cases present only one destination prefix (the
            default route) with one or two next-hops.  However, DHCPv4 clients
            processing the option <bcp14>MUST</bcp14> support processing
            multiple pairs of distinct destination prefix and nexthop.
        </li>
        <li>
            if one and the same destination prefix (equal address and prefix
            length) occurs multiple times, they <bcp14>MUST</bcp14> be
            merged into a single route with multiple nexthops (equal-cost
            multipath routing).  The client <bcp14>MAY</bcp14> impose a limit
            to the number of nexthops, and if that number is exceeded discard
            an arbitrary choice of excess nexthops.  The client <bcp14>MUST
            NOT</bcp14> reject the route in its entirety if the number of
            nexthops is exceeded.
            (Note the limit is permitted to be 1, i.e. no support for multiple
            nexthops.)
        </li>
        <li>
            the client <bcp14>MUST</bcp14> silently ignore repeats of the same
            pair of destination prefix and nexthop.  The server <bcp14>SHOULD
            NOT</bcp14> send such an option value.
        </li>
        <li>
            if the nexthop is a link-local address, it <bcp14>MUST</bcp14> be
            accepted and associated with the link the DHCP packet was received
            on.  This also applies when using the DHCP packet's source address
            when it is a link-local address.
            In most cases, "link" will mean "interface", however in some cases
            the client may have further information on when it is communicating
            on the same link (e.g. 802.11 SSID, or configured link aggregation)
            and apply that instead.
        </li>
      </ol>
      <section anchor="nexthops">
        <name>Applicable next-hop behavior</name>
        <t>
            Outlined in <xref target="IANA-IPv6"/>, not all IPv6 addresses are
            valid for use when encoded as next-hop and some have
            <xref target="IANA-IPv6-SPECIAL">specific functionality</xref>
            attached to them as follows:
        </t>
        <ol>
          <li>
              the unspecified-address nexthop indicates that the destination
              prefix in the pair should use the DHCP packet's source address as
              nexthop.   When <xref target="DHCP4o6"/> is in use, hosts <bcp14>MUST</bcp14>
              retrieve the IPv6 source address of the DHCPv6 packet carrying
              the DHCPV4-RESPONSE message.
            <cref>
                TODO: does it really make sense to support IPv4 here?  Maybe
                only allow this with DHCP4o6?
            </cref>
          </li>
          <li>
              the <xref target="DISCARD">Discard-Only Address block
                (0100::/64)</xref> <bcp14>MAY</bcp14> be used to express
              unreachable destinations, in particular if only limited but not
              global IPv4 connectivity is available.  If this is used, it
              <bcp14>MUST</bcp14> be the only next-hop paired with the
              destination prefix in question.  Clients <bcp14>SHOULD</bcp14>
              ignore the destination prefix entirely if this condition does not
              hold.
              If a client is unable to mark destinations as unreachable in its
              routing table, it <bcp14>MAY</bcp14> ignore the destination
              prefix and <bcp14>SHOULD</bcp14> indicate a client configuration
              issue in its administrative interfaces.
          </li>
          <li>
              any unicast IPv6 address <bcp14>MAY</bcp14> be used as next-hop.  This
              specifically also covers link-local addresses, which the client
              <bcp14>MUST</bcp14> support and <bcp14>MUST</bcp14> associate with the link that it has
              received the DHCP packets on.
          </li>
          <li>
            <cref>
                TODO: is ::ffff:192.0.2.123 an IPv4 nexthop?  Is this worth
                supporting explicitly, and then saying that the other static
                route / default gateway options should be ignored?
            </cref>
          </li>
          <li>
            <t>
                the following types/ranges of addresses are invalid and <bcp14>MUST</bcp14>
                NOT be used;  no client behavior is specified if any are
                present in a container:
            </t>
            <ul>
              <li>the loopback address (::1)
                <cref>
                    TODO: express other directly-connected IPv4 hosts with
                    this?
                </cref>
              </li>
              <li>any multicast address (ff00::/8)</li>
              <li>any address with a reserved allocation</li>
            </ul>
          </li>
        </ol>
      </section>
      <section anchor="destinations">
        <name>Applicable destination prefix behavior</name>
        <t>
            Some IPv4 prefixes, due to their function given in
            <xref target="IANA-IPv4"/>, do not make sense to use with this
            option.  DHCPv4 servers <bcp14>MUST NOT</bcp14> encode and DHCPv4 clients <bcp14>MUST</bcp14>
            ignore the following prefixes as well as any more-specific prefixes
            within them:
        </t>
        <ul>
          <li>
              0.0.0.0/8 (note that 0.0.0.0/0 is less specific than this, and thus valid)
          </li>
          <li>127.0.0.0/8</li>
          <li>224.0.0.0/4</li>
          <li>255.255.255.255/32</li>
        </ul>
        <t>
            Behavior for 240.0.0.0/4 is outside the scope of this document.
        </t>
      </section>
    </section>

    <section anchor="behavior">
      <name>Expected host behavior</name>
      <t>
          The option described in this document is intended to be implemented
          on hosts supporting IPv4 routes with IPv6 nexthops as described
          in <xref target="v4overv6"/>.  Hosts that do not support the behavior
          described there <bcp14>MUST NOT</bcp14> request and <bcp14>MUST</bcp14> ignore the option described
          in this document.
      </t>
      <t>
          Hosts that support <xref target="v4overv6"/> behavior and acquire
          their configuration from <xref target="DHCP"/> <bcp14>SHOULD</bcp14> implement the
          option described here.
      </t>
      <section anchor="singleaddr">
        <name>Singular address assignment</name>
        <t>
            While not limited to this case, this option is expected and
            intended to be used with assigning a singular IPv4 address to a
            DHCPv4 client.  This implies that the Subnet Mask option defined
            in <xref target="DHCP-OPT"/> will have the value 255.255.255.255.
        </t>
        <t>
            DHCPv4 clients implementing the option described in this document
            <bcp14>MUST</bcp14> process such a Subnet Mask option value as assigning a single
            address.  There is no network or broadcast address for this
            "single-sized" pseudo-subnet.  No IPv4 addresses are
            expressed to be on-link for the purposes of <xref target="ARP"/>
            (though they <bcp14>MAY</bcp14> become so due to additional, e.g. local
            configuration assigning additional addresses to the interface.)
        </t>
        <t>
            Whether the address is bound to the interface or host (strong
            vs. weak host model), and whether to perform or skip
            <xref target="DADv4"/> for the address is beyond the scope of this
            document.
        </t>
      </section>
      <section anchor="overlap">
        <name>Overlapping routes from other sources</name>
        <t>
            <xref target="RFC3442"/> documents a mechanism to communicate a
            set of routes and their nexthops over DHCP.  The original DHCP
            "router" option (code 3) may communicate a default router.  If
            either of these options is used, the routes communicated may
            overlap.
        </t>
        <t>
            To get consistent and unsurprising behavior, this document places
            the follwing expectations on the host:
          <cref>
              TODO: redundant paragraph/merge with text above, needs some
              merging/editing.
          </cref>
        </t>
        <ul>
          <li>
              Routes that describe distinct destination prefixes <bcp14>MUST</bcp14> be
              handled independently.  This includes routes that differ only
              in prefix length.  As a result, the routing table <bcp14>MAY</bcp14> contain
              a mix of IPv4 routes with IPv4 nexthops as well as IPv6
              nexthops.  Standard longest prefix match behavior <bcp14>MUST</bcp14> be
              observed.
          </li>
          <li>
              If routes with the same destination prefix are described both
              with previously existing methods as well as the options
              documented here, the route described by the latter <bcp14>MUST</bcp14> be used
              and the routes with IPv4 nexthops <bcp14>MUST</bcp14> be discarded.  This
              notably includes "unreachable" routes described here;  a route
              with an IPv4 nexthop for such a destination <bcp14>MUST</bcp14> still be
              discarded.
          </li>
          <li>
              Multiple routes for the same destination prefix with different
              nexthops of the same address family <bcp14>SHOULD</bcp14> be combined into a
              single route for equal-cost multipath behavior, if the host
              supports this.  If ECMP routes are not supported, the host
              <bcp14>MUST</bcp14> deterministically choose one of the routes.  This <bcp14>MAY</bcp14>
              be done by using the first or last option as seen in DHCP
              packet order, or by choosing the numerically lowest or highest
              nexthop.
          </li>
        </ul>
      </section>
      <section anchor="default">
        <name>Default route</name>
        <t>
            The default route is expressed here as a route for 0.0.0.0/0,
            which is also implied by the absence of any destination prefix
            suboption.
            There is no distinct special encoding for a default gateway, any
            nexthop for 0.0.0.0/0 <bcp14>MUST</bcp14> be treated as if it were a default
            gateway.
        </t>
      </section>
      <section anchor="connected">
        <name>Routes clashing with the connected subnet</name>
        <t>
          <cref>
              (only applicable if NOT assigning a single IPv4 address as /32)
          </cref>
          <cref>
              TODO: determine what behavior is reasonable here.  (The client
              is likely to be given a /32 subnet mask anyway.)
          </cref>
        </t>
      </section>
    </section>

    <section anchor="encoding">
      <name>DHCP Option encoding</name>
      <artwork name="DHCP(v4) extended static route container">
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Type (TBA1)  |     Length    |     Prefix/nexthop pairs      |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               |
:                              ...                              :</artwork>
      <dl>
        <dt>Type</dt>
        <dd>TBA1 (field defined in <xref target="DHCP-OPT"/>)</dd>
        <dt>Length</dt>
        <dd>as defined in <xref target="DHCP-OPT"/></dd>
        <dt>Prefix/nexthop pairs</dt>
        <dd>zero or more items as defined below.  Note multiple options
          are concatenated before processing.</dd>
      </dl>

      <section anchor="destopt">
        <name>Destination prefix and nexthop pair</name>
        <artwork name="Destination prefix suboption">
 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+
| R | prefixlen |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                      IPv4 prefix (4 octets)                   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                   IPv6 addresses (16 octets)                  |
:                              ...                              :
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+</artwork>
        <dl>
          <dt>R</dt>
          <dd>Reserved bits.  <bcp14>MUST</bcp14> be sent as zero, <bcp14>MUST</bcp14> be ignored on receipt.</dd>
          <dt>prefixlen</dt>
          <dd>IPv4 prefix length, integer value from 0 to 32 (inclusive)</dd>
          <dt>IPv4 prefix</dt>
          <dd>
            <t>
                The route's destination prefix, with unused bits zeroed.
            </t>
            <t>
                Validity and behavior for specific values is described in
                <xref target="destinations"/>.
            </t>
          </dd>
          <dt>IPv6 addresses</dt>
          <dd>
            <t>
                The IPv6 addresses specifying the nexthop for this
                route.  Refer to <xref target="nexthops"/> for valid values and
                associated behavior.
            </t>
          </dd>
        </dl>
      </section>
    </section>
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>
        <em>TBD</em>
      </t>
    </section>
    <section anchor="privacy">
      <name>Privacy Considerations</name>
      <t>
        <em>TBD</em>
      </t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <t>
          A codepoint from the "BOOTP Vendor Extensions and DHCP Options"
          registry is requested for use with the container option described in
          <xref target="encoding"/>.
          <cref>Editor note: 2 places of TBA1</cref>
      </t>
      <t>
          A registry is requested to be created for the sub-options in the
          option above.
          <cref>TBD: proper wording for this, and fill in values 1 &amp; 2</cref>
      </t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <reference anchor="DHCP">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2131.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP-OPT">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2132.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP-LONGOPT">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3396.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="v4overv6">
          <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.chroboczek-intarea-v4-via-v6" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DISCARD">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.6666.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="IANA-IPv4" target="https://www.iana.org/assignments/ipv4-address-space/">
          <front>
            <title>IPv4 Address Space Registry</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
        <reference anchor="IANA-IPv6" target="https://www.iana.org/assignments/ipv6-address-space/">
          <front>
            <title>Internet Protocol Version 6 Address Space</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
        <reference anchor="IANA-IPv6-SPECIAL" target="https://www.iana.org/assignments/iana-ipv6-special-registry/">
          <front>
            <title>IPv6 Special-Purpose Address Registry</title>
            <author><organization>IANA</organization></author>
          </front>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3442.xml"/>
        <reference anchor="DHCPv6" target="https://www.rfc-editor.org/info/rfc8415">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8415.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DHCP4o6" target="https://www.rfc-editor.org/info/rfc7341">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7341.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="ARP">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.826.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
        <reference anchor="DADv4">
          <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5227.xml" xpointer="xpointer(/reference/*)"/>
        </reference>
      </references>
    </references>
    <section anchor="ack" numbered="false">
      <name>Acknowledgements</name>
      <t>
          The authors would like to acknowledge and thank Tomek Mrugalski for
          very extensive comments, and in particular pointing out the proper
          way to use DHCP options.
      </t>
      <t>
          Comments and feedback has been received and appreciated from
          Ole Troan.
      </t>
    </section>
    <section anchor="examples" numbered="false">
      <name>Example encoded options</name>
      <t>
        <em>TBD: outdated examples removed, will be re-added</em>
      </t>
    </section>
    <section numbered="false">
      <name>Revision history (TO BE REMOVED)</name>
      <ul>
        <li>
            -02: just use a straight up list of fixed size items (prefix+NH)
            rather than an excessively complicated suboption.
        </li>
        <li>
            -01: scrap single-option encoding, use container instead, and
            reference special-purpose IPv6 addresses (e.g. for discard)
        </li>
        <li>
            -00: 
        </li>
      </ul>
    </section>
  </back>
</rfc>
