Disable IPv6 Functionality on Multi-Container Device

We have multi-container devices, each of which connect to a different local router (through ethernet).
We also have a specific domain that when you go to it, it checks your external IP against our devices’ external IPs and sends you to the appropriate local server for the wifi network you are at. However, for some routers, the device gets an ipv6 external address, whilst the user’s phone gets an ipv4 address. I’m hoping to put together:

  1. Disable the ipv6 functionality, a quick solution
  2. An elegant solution later on if possible.

Any assistance with this is appreciated.

If I could get any assistance with this, I would appreciate it.

Hi, here is a way to disable ipv6 on your balena device using nmcli (replace 087fd7c with your device uuid).

balena ssh 087fd7c

root@087fd7c:~# nmcli con show
NAME                UUID                                  TYPE      DEVICE
Wired connection    087fd7cd-9a6b-423c-8b64-c30cbf6a7126  ethernet  eno1
...

root@087fd7c:~# nmcli con edit 087fd7cd-9a6b-423c-8b64-c30cbf6a7126

nmcli> set ipv6.method disable

nmcli> save persistent
Connection 'Wired connection' (087fd7cd-9a6b-423c-8b64-c30cbf6a7126) successfully updated.

nmcli> quit

root@087fd7c:~# nmcli con down 087fd7cd-9a6b-423c-8b64-c30cbf6a7126; nmcli con up 087fd7cd-9a6b-423c-8b64-c30cbf6a7126

Please make sure to try in a single device (hopefully a development device) and let us know if that works for you.

Thank you!

1 Like

Hello @pipex,

That works when I ssh into the device’s host OS and run that code. However, it doesn’t appear that I can run it from one of my services on the device, as in that scenario it does not recognize nmcli. Is there any way to run a script from the host OS (on a multi-container device) during a device bootup?

I was considering changing the sysctl.conf file, something like the below? Are there any issues to this for a Balena OS device?

Cheers,
Spen