3

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 ?

1 Answer 1

2

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.

0

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.