1

https://web.archive.org/web/20160528234959/https://wiki.freebsd.org/IPv6Only discusses a FreeBSD image that supported only IPv6, not IPv4. That page is no longer live, though (hence my archive link), and I can't find anything more recent about this. My question: is it possible today, on any modern UNIX or Linux system, to support only IPv6 and not IPv4, just like that old FreeBSD image did? It's okay if the way to do this requires a custom kernel or similar work.

Other places I've seen this asked (all dated after I originally asked this question):

2

Just build FreeBSD.

It's possible today, because FreeBSD continues to provide the mechanism used.

It is a set of kernel configuration and makefile options to turn off or exclude IPv4. The basic one is nooptions INET, but observe what else /usr/src/sys/conf/makeLINT.mk does. Also observe what /usr/src/sys/conf/NOTES says about the knock-on effects of not having both IPv4 and IPv6 enabled.

Further reading

  • I see in NOTES is that I won't be able to use SCTP. Is that what you were referring to, or is there more I didn't see? – Joseph Sible Sep 9 '18 at 17:41
0

Yes, of course. One way is simply not to configure any (public) IPv4 address or service on the host. More extreme would be to (if the OS supports that) remove IPv4 support, but that's more complicated, may not be possible, and if it is may break (usually older) services. Details will vary by OS as they are all very different in exactly how the network gets configured.

For example on macOS one might run

sudo ipconfig set en0 NONE
sudo ipconfig set en0 AUTOMATIC-V6

to disable IPv4 and enable IPv6 on en0. (lo0 might still have IPv4, but other systems need not know about that.)

This however may not be very useful as many things do not support or are not available on IPv6, and it's not like someone can call for a flag day like they did for the switch to TCP/IP a few years ago...

  • 1
    A "more extreme" solution as you mention is what the FreeBSD build did, and what I'm looking for. Just de-configuring the interfaces isn't what I had in mind. – Joseph Sible Sep 9 '18 at 0:44
0

It's certainly possible on Linux. Networking protocols in the kernel are configurable, you can remove all IPv4 stuff. However, most distros will expect IPv4 and try to use it, so you'll have to customize this part of your distro, too (and if only to get rid of the error messages).

Though of course the question is what do you gain from doing it that way. Yes, the kernel will be a bit smaller without IPv4 protocols. But it's a lot simpler to just use a stock kernel, and configure everything not to accept IPv4 addresses, or not to have IPv4 in the first place.

  • 1
    "Networking protocols in the kernel are configurable, you can remove all IPv4 stuff" I looked through make menuconfig, and I don't see any such options. I see an option to disable IPv6, and I see options to disable various pieces of functionality that apply to both IPv4 and IPv6. Can you specify exactly which CONFIG_* options you're talking about? – Joseph Sible Sep 14 '18 at 18:28
  • You are right, there's only CONFIG_INET to disable both IPv4 and IPv6. I thought it was finer grained. So I guess you'd have to define CONFIG_INET4 and CONFIG_INET6, go through the kernel source and add #ifdef's - if you can remove both from the kernel, you certainly can remove one variant. The question is still why you would want to do that. – dirkt Sep 15 '18 at 8:39
  • For the moment, one reason is to have a proper platform for validating applications that must run in IPv6-only environments. It is unfortunate that Linux cannot do this; Windows has been able to completely remove the IPv4 stack since Vista! (And on Windows it is IPv6 that cannot be removed.) – Michael Hampton Apr 30 at 19:05
  • @MichaelHampton Any reason why validation in IPv6 only environments can't be accomplished by not assigning IPv4 addresses to interfaces? And the Linux kernel is open source; if this feature is so important, sit down at the keyboard, spend half a day and sprinkle proper #ifdef's through the kernel code. It's not that "Linux can't do that", it's "nobody has found it important enough to implement it that way". If you feel different about that, go ahead and implement it. – dirkt May 1 at 12:15
  • That's what people do now, only getting rid of 127.0.0.1 is a bit difficult. It would be much nicer if there were a sysctl, or better yet, a proper CONFIG_ define as you proposed. I'm sure someone will write it eventually and have the kernel developers reject it. – Michael Hampton May 1 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.