Network Working Group L. Neukirchen Internet-Draft vuxu.org Intended status: Informational 1 April 2020 Expires: 3 October 2020 IPv14C: A 14C dilution of IPv4 in IPv6 draft-neukirchen-ipv14c-00 Abstract "Warning: may contain traces of IPv4" We propose a novel embedding of the IPv4 address space into the IPv6 address space using ideas from homeopathy [Hahnemann]. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on 3 October 2020. Copyright Notice Copyright (c) 2020 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Neukirchen Expires 3 October 2020 [Page 1] Internet-Draft IPv14C: A 14C dilution of IPv4 in IPv6 April 2020 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Terminology . . . . . . . . . . . . . . . . . . . . . . . 2 1.2. Homeopathy essentials . . . . . . . . . . . . . . . . . . 2 2. The construction . . . . . . . . . . . . . . . . . . . . . . 3 3. Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 4 4. Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . 4 5. Security Considerations . . . . . . . . . . . . . . . . . . . 4 6. Normative References . . . . . . . . . . . . . . . . . . . . 4 Appendix A. Reference Implementation . . . . . . . . . . . . . . 5 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 6 1. Introduction It is well-known that the IPv6 address space contains the IPv4 address space, for example as IPv4-mapped addresses 0:0:0:0:0:ffff::/96 [RFC4291]. However, this embedding clumps the IPv4 address space together in a tiny fraction of the IPv6 address space. People have been noticing IPv4 is on the decline already. In order for IPv4 to become potent again, why not try homeopathy? We propose a homeopathic dilution of the IPv4 address space: after diluting IPv4 by a factor of hundred for 14 times, we can fit IPv4 into 7 one-bits ("essential property") floating in a medium of 123 zero-bits ("water"). 1.1. Terminology The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this document, are to be interpreted as described in [RFC2119]. 1.2. Homeopathy essentials From Wikipedia, we learn: | Homeopathic preparations are termed remedies and are made using | homeopathic dilution. In this process, a chosen substance is | repeatedly and thoroughly diluted. [...] | | Hahnemann created the "centesimal" or "C scale", diluting a | substance by a factor of 100 at each stage. | | A 2C dilution requires a substance to be diluted to one part in | 100, and then some of that diluted solution diluted by a further Neukirchen Expires 3 October 2020 [Page 2] Internet-Draft IPv14C: A 14C dilution of IPv4 in IPv6 April 2020 | factor of 100. [...] Higher dilutions follow the same pattern. | In homeopathy, a solution that is more dilute is described as | having a higher "potency", and more dilute substances are | considered by homeopaths to be stronger and deeper-acting. 2. The construction In order to convert an IPv4 address into an IPv14C-IPv6 address, we use the following construction: the first four bits of the resulting IPv14C MUST be 0001 (reserved as by [RFC4291]), and the remaining 6 one-bits are distributed into this /4 subnet address space. This yields even 3% more space than we need for IPv4. The actual amount of usable address space can be computed using a multinomial coefficient: 124! (118, 6)! = --------- = 4465475476 118! * 6! In contrast, there are 21267647932558653966460912964485513216 IPv6 addresses in this /4 subnet, which corresponds to 2.1e-28, or a 14C dilution. We embed IPv4 by lexicographic indexing (regarding the IPv4 address in network byte order as a natural number) into the multiset permutations of {0 x 118, 1 x 6}. The first elements of the permutation are: ...00000000000000000000000000000111111 0 ...00000000000000000000000000001011111 1 ...00000000000000000000000000001101111 2 ...00000000000000000000000000001110111 3 ...00000000000000000000000000001111011 4 ...00000000000000000000000000001111101 5 ...00000000000000000000000000001111110 6 ...00000000000000000000000000010011111 7 ...00000000000000000000000000010101111 8 ...00000000000000000000000000010110111 9 ...00000000000000000000000000010111011 10 ...00000000000000000000000000010111101 11 ...00000000000000000000000000010111110 12 ...00000000000000000000000000011001111 13 ...00000000000000000000000000011010111 14 ...00000000000000000000000000011011011 15 An example implementation in Python can be found in the appendix. Neukirchen Expires 3 October 2020 [Page 3] Internet-Draft IPv14C: A 14C dilution of IPv4 in IPv6 April 2020 3. Examples Here are some example IPv4 addresses and their corresponding IPv14C: 0.0.0.0 1000:0000:0000:0000:0000:0000:0000:003f = 1000::3f 127.0.0.1 1000:2440:0008:0000:0000:0044:0000:0000 = 1000:2440:8::44:0:0 217.10.14.234 10a0:0004:0000:0002:0001:0400:0000:0000 = 10a0:4:0:2:1:400:: 93.184.216.34 1000:0100:4000:0000:0000:0510:0000:0010 = 1000:100:4000::510:0:10 255.255.255.255 1800:0000:0401:0000:0480:0000:0100:0000 = 1800:0:401:0:480:0:100:0 4. Conclusions We have shown that the vast unused IPv6 address space provides enough room for a 14C dilution of the IPv4 address space. Whether this is a valid application of homeopathy is questionable: real homeopaths would dilute further until there are no measurable bits left, and the IPv6 addresses have absorbed the information that was there. Fitting this into a sockaddr_in6 remains an open problem. 5. Security Considerations Security issues are not discussed in this memo. Note that IPv14C does NOT provide protection against address enumeration. Due to being a deterministic one-to-one mapping of the IPv4 address space, enumeration of IPv14C is as hard as enumerating IPv4, i.e. not at all using tools like masscan. 6. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [Hahnemann] "Organon der Heilkunst (Sixth Edition)", 1921, . Neukirchen Expires 3 October 2020 [Page 4] Internet-Draft IPv14C: A 14C dilution of IPv4 in IPv6 April 2020 [RFC4291] Hinden, R. and S. Deering, "IP Version 6 Addressing Architecture", RFC 4291, DOI 10.17487/RFC4291, February 2006, . Appendix A. Reference Implementation The following reference implementation in Python 3 includes code from a StackOverflow answer by Bartosz Marcinkowski. from collections import Counter from math import factorial from functools import reduce import ipaddress # https://stackoverflow.com/a/24508736 # by Bartosz Marcinkowski, 2014-07-01 def count_permutations(counter): values = counter.values() return (factorial(sum(values))/ reduce(lambda a, v: a * factorial(v), values, 1)) def permutation(l, index): l = sorted(l) if not index: return l counter = Counter(l) total_count = count_permutations(counter) acc = 0 for i, v in enumerate(l): if i > 0 and v == l[i-1]: continue count = total_count * counter[v] / len(l) if acc + count > index: return [v] + permutation(l[:i] + l[i+1:], index - acc) acc += count raise ValueError("Not enough permutations") ipv4 = int(ipaddress.IPv4Address('93.184.216.34')) hmip = ''.join(map(str, [0,0,0,1] + permutation([0]*(128-4-6) + [1]*6, ipv4))) ipv6 = int(hmip, 2) print(ipaddress.IPv6Address(ipv6).compressed) The reverse computation is left as an exercise for the reader. Neukirchen Expires 3 October 2020 [Page 5] Internet-Draft IPv14C: A 14C dilution of IPv4 in IPv6 April 2020 Author's Address Leah Neukirchen vuxu.org Email: leah@vuxu.org Neukirchen Expires 3 October 2020 [Page 6]