Home | History | Annotate | Line # | Download | only in doc
DHCPv4-over-DHCPv6 revision 1.1
      1  1.1  christos Short notice about DHCPv4 over DHCPv6 aka RFC 7341
      2  1.1  christos --------------------------------------------------
      3  1.1  christos Note well: this code is still somewhat experimental and any user
      4  1.1  christos should take care when trying to use it.
      5  1.1  christos 
      6  1.1  christos GENERAL
      7  1.1  christos The purpose of DHCPv4 over DHCPv6 (RFC7341) is to encapsulate
      8  1.1  christos a DHCPv4 request within a DHCPv6 request in order to transmit
      9  1.1  christos it across a v6 only network.  This feature may become useful
     10  1.1  christos when, during the transition from a v4 to a v6 network, there
     11  1.1  christos are still v4 clients at the edges and v4 servers in the center
     12  1.1  christos but the links between them are v6 only.
     13  1.1  christos 
     14  1.1  christos In order to support this functionality we have chosen to use
     15  1.1  christos two processes each for the client and server.  In both pairs
     16  1.1  christos one process handles the DHCPv4 processing and the other handles
     17  1.1  christos the DHCPv6 processing.
     18  1.1  christos 
     19  1.1  christos The topology is thus something like this:
     20  1.1  christos 
     21  1.1  christos  Client processes    network    Server processes
     22  1.1  christos DHCPv4 <-> DHCPv6  <--ipv6-->  DHCPv6 <-> DHCPv4
     23  1.1  christos 
     24  1.1  christos The v6 client and server processes can continue to process
     25  1.1  christos DHCPv6 packets as normal but will also allow a DHCPv4 process
     26  1.1  christos to connect to them via a socket.  The DHCPv4 client will pass
     27  1.1  christos a request to the DHCPv6 client which will encapsulate it within
     28  1.1  christos a DHCPv6 request which is sent to the DHCPv6 server (possibly
     29  1.1  christos via DHCPv6 relays).  When the DHCPv6 server receives the packet
     30  1.1  christos it will get the DHCPv4 query and pass it to the DHCPv4
     31  1.1  christos server.  The response will by handled in a similar fashion.
     32  1.1  christos 
     33  1.1  christos When starting up the paired processes one should take care that
     34  1.1  christos they use different files for configuration, leases and process IDs.
     35  1.1  christos 
     36  1.1  christos LOCALIZATION
     37  1.1  christos Normally the DHCPv4 server choose a subnet based on a number of options:
     38  1.1  christos  - follow the Relay Agent Link Selection option if exists
     39  1.1  christos  - follow the Subnet Selection option if exists
     40  1.1  christos  - use the relay address if relayed
     41  1.1  christos  - use the receiving interface
     42  1.1  christos 
     43  1.1  christos With the exception of the last case the address must match a subnet address.
     44  1.1  christos Unfortunately when using DHCPv4 over DHCPv6 this information is not available
     45  1.1  christos in the packet, to quote RFC 7341:
     46  1.1  christos 
     47  1.1  christos    Since the DHCPv4 message is encapsulated in the DHCPv6 message, it
     48  1.1  christos    lacks the information that is typically used by the DHCPv4 server,
     49  1.1  christos    implementing [RFC2131], to make address- allocation decisions,
     50  1.1  christos    e.g., giaddr for relayed messages and IPv4 address of the interface
     51  1.1  christos    that the server is using to communicate with a directly connected
     52  1.1  christos    client.
     53  1.1  christos 
     54  1.1  christos In DHCPv4 over DHCPv6, there are a mixture of IPv6 and IPv4 addresses.
     55  1.1  christos The DHCPv4 over DHCPv6 server externally uses only IPv6 addresses,
     56  1.1  christos even on the DHCPv4 side, so shared networks associated with directly
     57  1.1  christos attached interfaces are identified by subnet6 declarations.
     58  1.1  christos For this reason, the DHCPv4 side shouldn't request an interface
     59  1.1  christos vai the command line or configuration file: all usable interfaces
     60  1.1  christos will be requested (i.e., standard behavior when no interface is
     61  1.1  christos specified in the command line or configuration file) and it is
     62  1.1  christos not an error to have an interface with an address and no matching
     63  1.1  christos subnet6 declaration, nor an error to have no usable interfaces
     64  1.1  christos (i.e., fully relayed or routed topologies are accepted).
     65  1.1  christos 
     66  1.1  christos Note also there is no involved DHCPv4 relays (DHCPv4 messages are
     67  1.1  christos directly encapsulated into DHCPv6 DHCPv4-query/DHCPv4-response
     68  1.1  christos messages by clients and servers as there is no cross DHCP version
     69  1.1  christos relays specified by RFC 7341) so to get a Relay Agent option or
     70  1.1  christos a relay address are very unlikely cases.
     71  1.1  christos 
     72  1.1  christos So the procedure is:
     73  1.1  christos  - follow the Relay Agent Link Selection option if exists
     74  1.1  christos  - follow the DHCPv4 Subnet Selection option if exists
     75  1.1  christos  - use the DHCPv4 relay address if DHCPv4 relayed
     76  1.1  christos  - when DHCPv6 relayed, use the first relay with an usable (i.e., not
     77  1.1  christos    unspecified or link-local) address
     78  1.1  christos  - use the receiving interface
     79  1.1  christos 
     80  1.1  christos The basic network configuration is something like this:
     81  1.1  christos ----
     82  1.1  christos shared-network "link1" {
     83  1.1  christos     subnet6 2001:db8:1:1::/64 { }
     84  1.1  christos 
     85  1.1  christos     subnet 192.168.1.0 netmask 255.255.255.0 {
     86  1.1  christos         range 192.168.1.100 192.168.1.199;
     87  1.1  christos     }
     88  1.1  christos }
     89  1.1  christos ----
     90  1.1  christos 
     91  1.1  christos This groups the 2001:db8:1:1::/64 subnet with the 192.168.1.0 subnet.
     92  1.1  christos When the a DHCPv4 over DHCPv6 client uses the 2001:db8:1:1::10 IPv6 address
     93  1.1  christos it will get an address from 192.168.1.1xy assigned.
     94  1.1  christos 
     95  1.1  christos There is one remaining question: on which interface should 
     96  1.1  christos a DHCPv4 over DHCPv6 client apply the assigned IPv4 address?
     97  1.1  christos RFC 7341 does not really help:
     98  1.1  christos    Before applying for an IPv4 address via a DHCPv4-query message, the
     99  1.1  christos    client must identify a suitable network interface for the address.
    100  1.1  christos    Once the request is acknowledged by the server, the client can
    101  1.1  christos    configure the address and other relevant parameters on this
    102  1.1  christos    interface.  The mechanism for determining a suitable interface is out
    103  1.1  christos    of the scope of the document.
    104  1.1  christos 
    105  1.1  christos The ISC DHCP answer is the IPv4 address is (in fact is required to be)
    106  1.1  christos specified in the command line of the DHCPv4 side of the DHCPv4 over DHCPv6
    107  1.1  christos client. BTW in the usual case where the upstream interface is IPv6 only,
    108  1.1  christos the IPv4 interface will be a different one.
    109  1.1  christos 
    110  1.1  christos 
    111  1.1  christos                                HOW TO USE
    112  1.1  christos                                ----------
    113  1.1  christos 
    114  1.1  christos 
    115  1.1  christos CONFIGURATION
    116  1.1  christos By default the DHCPv4 over DHCPv6 code is disabled and in order to use
    117  1.1  christos it you will need to configure it.  Note that this code requires that the
    118  1.1  christos dhcpv6 code be enabled (it is enabled by default.)
    119  1.1  christos 
    120  1.1  christos    ./configure --enable-dhcpv4o6
    121  1.1  christos 
    122  1.1  christos CLIENT SETUP
    123  1.1  christos The client runs both a DHCPv6 client and a DHCPv4 client on the second
    124  1.1  christos Ethernet eth1.  The following could be used to launch them from the
    125  1.1  christos client directory. 
    126  1.1  christos 
    127  1.1  christos    ./dhclient -d -v -6 -4o6 6767 -lf leases6 -pf pid6 eth1
    128  1.1  christos 
    129  1.1  christos and
    130  1.1  christos 
    131  1.1  christos    ./dhclient -d -v -4 -4o6 6767 -lf leases4 -pf pid4 eth1
    132  1.1  christos 
    133  1.1  christos In this case we are using the port pair 6767 and 6768 for communication
    134  1.1  christos and one can start or stop either client as necessary (though if the
    135  1.1  christos v6 client is stopped the v4 client won't be able to contact a server).
    136  1.1  christos The lease files are leases4 and leases6 and the process id files are pid4 and
    137  1.1  christos pid6.  You would probably put the files elsewhere.
    138  1.1  christos 
    139  1.1  christos For testing purposes it is best to run the two clients in the foreground
    140  1.1  christos and in separate windows.
    141  1.1  christos 
    142  1.1  christos SERVER SETUP
    143  1.1  christos As with any DHCP servers you will need to ensure there is a path from
    144  1.1  christos the clients to the servers - any firewalls must allow DHCPv6 traffic
    145  1.1  christos through.  You should also verify no other DHCP servers are running
    146  1.1  christos and will conflict with the DHCPv4 over DHCPv6 pair.
    147  1.1  christos 
    148  1.1  christos The server VM must have both IPv4 and IPv6 addresses.  On a system
    149  1.1  christos running Fedora with the second interface named eno33554984,
    150  1.1  christos the commands are:
    151  1.1  christos 
    152  1.1  christos    ip addr add 10.10.10.1/24 dev eno33554984
    153  1.1  christos 
    154  1.1  christos and
    155  1.1  christos 
    156  1.1  christos    ip -6 addr add 2001:db8:1:1::1/64 dev eno33554984
    157  1.1  christos 
    158  1.1  christos Note that in theory the IPv4 address is not required but:
    159  1.1  christos   - there are some DHCPv4 clients which refused responses with no or an
    160  1.1  christos     invalid server-id
    161  1.1  christos   - this avoids messages about being unable to find a subnet to configure or
    162  1.1  christos     something similar
    163  1.1  christos 
    164  1.1  christos Both ISC DHCP and Kea use 2 processes to manage DHCPv4-over-DHCPv6, one 
    165  1.1  christos in charge of DHCPv6, the other in charge of DHCPv4. They communicate via UDP.
    166  1.1  christos 
    167  1.1  christos ISC DHCP DHCPv6 SERVER
    168  1.1  christos The dhcpd.conf6 example configuration file is:
    169  1.1  christos ----
    170  1.1  christos # DHCPv6 conf
    171  1.1  christos 
    172  1.1  christos authoritative;
    173  1.1  christos 
    174  1.1  christos default-lease-time 3600;
    175  1.1  christos max-lease-time 7200;
    176  1.1  christos 
    177  1.1  christos option dhcp6.dhcp4-o-dhcp6-server 2001:db8:1:1::1;
    178  1.1  christos 
    179  1.1  christos subnet6 2001:db8:1:1::/64 {
    180  1.1  christos         range6 2001:db8:1:1::1:0/112;
    181  1.1  christos }
    182  1.1  christos ----
    183  1.1  christos 
    184  1.1  christos The server is launched from the server directory by:
    185  1.1  christos 
    186  1.1  christos   ./dhcpd -f -d -6 -4o6 6767 -cf ./dhcpd.conf6 -lf ./leases6 -pf ./pid6 eno33554984
    187  1.1  christos 
    188  1.1  christos As with the client above the servers are using the port pair 6767 and 6768
    189  1.1  christos to communicate.  The leases file (leases6) must be created before attempting
    190  1.1  christos to start the server.
    191  1.1  christos 
    192  1.1  christos ISC DHCP DHCPv4 SERVER
    193  1.1  christos The dhcpd.conf4 example configuration file is:
    194  1.1  christos ----
    195  1.1  christos # DHCPv4o6 conf
    196  1.1  christos 
    197  1.1  christos authoritative;
    198  1.1  christos 
    199  1.1  christos default-lease-time 3600;
    200  1.1  christos max-lease-time 7200;
    201  1.1  christos 
    202  1.1  christos shared-network "eno33554984" {
    203  1.1  christos     subnet6 2001:db8:1:1::/64 { }
    204  1.1  christos 
    205  1.1  christos     subnet 10.10.10.0 netmask 255.255.255.0 {
    206  1.1  christos        range 10.10.10.100 10.10.10.199;
    207  1.1  christos     }
    208  1.1  christos }
    209  1.1  christos ----
    210  1.1  christos 
    211  1.1  christos The server is launched from the server directory by:
    212  1.1  christos 
    213  1.1  christos    ./dhcpd -f -d -4 -4o6 6767 -cf ./dhcpd.conf4 -lf ./leases4 -pf ./pid4
    214  1.1  christos 
    215  1.1  christos Note that the port specification must be the same as used with the v6 server
    216  1.1  christos and that the configuration, lease and process id files should have different
    217  1.1  christos names.  Again the The leases file (leases4) must be created before attempting
    218  1.1  christos to start the server.
    219  1.1  christos 
    220  1.1  christos Finally note in the configuration file the use of the shared-network to
    221  1.1  christos connect the DHCPv4 and  DHCPv6 subnets.
    222  1.1  christos 
    223  1.1  christos USE WITH DHCPv6 RELAY(s)
    224  1.1  christos If the DHCPv6 infrastructure uses one (or more) relay because the client
    225  1.1  christos and the server are not on the same link the best choice is to put the
    226  1.1  christos first (closest to client) relay address in the dhcp4-o-dhcp6-server
    227  1.1  christos option so the same path between the DHCPv6 client part and server part
    228  1.1  christos will be used for DHCPv6 and DHCPv4-over-DHCPv6 traffic.
    229