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.


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

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...

  • 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

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.

  • "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

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.