How to automatically disable ipv6 at boot
How to automatically disable ipv6 at boot
Following this thread:
I discovered that echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6 indeed works on my Samsung Galaxy S23 (One UI 7.0). However, a reboot undoes this, because it reloads system configs from a prepackaged image.
One could decompress the image, make the relevant tweaks, recompress the image and have Bob be your uncle that way, according to a quick search on the World Wide Web. However, for those of you that use Magisk - and maybe are rooted through Magisk, I am unsure (my S23 is rooted with Magisk) -, there are some directories that I suppose Magisk sets up to be used for custom boot up scripts:
https://github.com/topjohnwu/Magisk/blob/master/docs/guides.md#boot-scripts
Taking inspiration from these two guides:
https://xdaforums.com/t/guide-how-to-run-a-script-at-every-boot-using-magisk.4454493/ https://xdaforums.com/t/guide-how-to-change-any-file-or-directory-using-magisk.4543103/
I decided to put my script for disabling ipv6 into /data/adb/service.d
While this did disable ipv6 for some of the interfaces among the - pardon my French - messed up array that is the Android network stack (since I don't understand it, that is...), some interfaces either remain ipv6-enabled or get reconfigured during or after boot. Thus, I tried giving the script some waiting time, which worked. Now, after each boot, all of my relevant interfaces are ipv6-disabled:
#!/system/bin/sh
sleep 60 ; echo 1 > /proc/sys/net/ipv6/conf/all/disable_ipv6
This did not prolong the boot process 60 seconds.
Edit: while the configuration does "survive", or rather, come into effect at boot, it resets at WiFi disconnect. Maybe it has to do with MAC address randomization being turned on. I'm not putting more time and effort into this.
Edit2: I guess the takeaway is, that you could run a great variety of scripts this way.