Following this thread:

https://xdaforums.com/t/guide-app-root-disable-block-ipv6-on-android-prevent-ipv6-leak-on-vpn.3298659/page-2

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.

    • emotional_soup_88OP
      link
      fedilink
      English
      arrow-up
      4
      ·
      1 day ago

      I can think of no legitimate reason. I just do it because I know how to work with ipv4. I’m just about to start learning ipv6, but since networking is but a hobby and I work long hours, the time and energy at my disposal is limited. As soon as I grasp ipv6, I guess I’ll re-enable it. Until then, I’ll just practice it in a container on my PC

        • emotional_soup_88OP
          link
          fedilink
          English
          arrow-up
          1
          ·
          6 minutes ago

          And that’s how we got to the moon.

          But in all seriousness, I just love tech and I want to understand as much of it as I can before I die. :)

      • PetteriPano@lemmy.world
        link
        fedilink
        English
        arrow-up
        5
        ·
        18 hours ago

        Most big sites support IPv6 today. It does perform better because optimised headers and less need for address translation on the way. Latest numbers show consumer support creeping up towards 50% already.

        It used to be popular to disable it 20 years ago when a lot of networks had misconfigured 6rd.

      • False@lemmy.world
        link
        fedilink
        English
        arrow-up
        4
        ·
        1 day ago

        I think it would have taken less time to learn than learning how to disable it. But meh