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