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