On a typical linux machine you can change kernel configuration by modifying the files located at /proc/*
.
For example, for the IPv6 accept_dad
parameter of a specific network interface (say, eth0
), you'd modify the following file:
/proc/sys/net/ipv6/conf/eth0/accept_dad
But, as I recently discovered, there is the widely spread tool, sysctl
, which has the same purpose, and works like so:
sysctl -w net.ipv6.conf.eth0.accept_dad=1
My question is, when should we use which tool? My instinct says that if you know what you're doing, you should write to file directly but, if you would like validations and what not, you should use sysctl
.
Since sysctl
is yet another layer over something that we can control directly, I think by using it we're exposing ourselves to potential bugs that are otherwise avoided by writing to files directly.