CONFIG_NET=n
This options controls network support in the kernel. But as the docs themselves say, this might break many userland programs that do network-ish looking things:
menuconfig NET
bool "Networking support"
select NLATTR
select GENERIC_NET_UTILS
select BPF
---help---
Unless you really know what you are doing, you should say Y here.
The reason is that some programs need kernel networking support even
when running on a stand-alone machine that isn't connected to any
other computer.
If you are upgrading from an older kernel, you
should consider updating your networking tools too because changes
in the kernel and the tools often go hand in hand. The tools are
contained in the package net-tools, the location and version number
of which are given in <file:Documentation/Changes>.
For a general introduction to Linux networking, it is highly
recommended to read the NET-HOWTO, available from
<http://www.tldp.org/docs.html#howto>.
I have tested that option at: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/71d673bac48f43a2e38f5e1e4f94b10da15b7cee/kernel_config_fragment#L58
Outcome: many (all?) networking system return a failure status and do nothing, e.g.:
# nc -l -p 8000 127.0.0.1
nc: socket: Function not implemented
TODO: UNIX sockets? Not present on that version of nc
and I was lazy to try it out.
I can still use the shell and call basic utilities. but for example X-server requires networking system calls to work, and won't start properly.
A user with
– Ciro Santilli 新疆改造中心法轮功六四事件 – 2017-09-30T06:34:31.377sudo
can in theory load a kernel module that does networking, so maybe this question should be restricted to non-sudo users. Related non-permanent: https://superuser.com/questions/181254/how-do-you-boot-linux-with-networking-disabled