Score:1

Disable ipv4 with /etc/sysctl.conf | GNU/LINUX Debian 11

ro flag

I can disable ipv6 as su in /etc/sysctl.conf on my GNU/LINUX Debian 11 with

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

and restart with

/sbin/sysctl -p

when i try to disable ipv4 in /etc/sysctl.conf and restart with

net.ipv4.conf.all.disable_ipv4 = 1
net.ipv4.conf.default.disable_ipv4 = 1

i get error message

sysctl: cannot stat ....

there is no disable_ipv4 in /proc/sys/net/ipv4/conf/all/

How can i disable ipv4 like i do with disable ipv6 with the /etc/sysctl.conf file ?

Score:1
mx flag

You can't disable IPv4 in the sysctl.conf.

You have two options: you can drop the IP-address so that no external traffic can reach your device (might as well just block everything with ufw?). But this is not persistent and would have to be done after every reboot, maybe using a bash script and cron.

ip -4 addr show eth0 # reveals your IP-address with CIDR suffix, e.g. 128.199.175.162/18
ip addr del 128.199.175.162/18 dev eth0

The second option is to edit a file so that IPv4 is disabled at boot. There is an article on DigitalOcean that describes it for Debian 9.

Also have a look at this Serverfault post which explains a few things about the IPv4 stack.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.