How to share internet from Cellular to LAN with specific static IP?

Hi Balena team,

I found the way to share internet access thru LAN from the document below.
https://www.balena.io/docs/reference/OS/network/2.x/
By set method=shared.

But have no detail about how to set the IP address of shared network.

In my case, the device connected to LAN has static IP=192.168.1.64 and Gateway=192.168.1.1.
I would like to share the internet access to this device?

Thanks in advance.

hello, does setting method=shared successfully shared the internet access for you? And now you are looking for a way to assign a static IP to the device you want to share the internet access to?

Hi Belena team,

Such as I would like to set the static IP on LAN to be 192.168.1.1 while sharing the internet.

And the connected device to LAN, set IP address = 192.168.1.64, Gateway = 192.168.1.1, and would lime the connected device can get internet access.

Hi! Just to be sure I understood correctly, you have one device connected to the internet through LAN. And you want to use that device as a hotspot for another device right? Then, for the device connected through LAN, you set the ipv4 config ip to 192.168.1.64 and gateway to: 192.168.1.1 . So which is the static IP you want to set now?

Hi Balena Team,

The BalenaFin’s LAN IP will be 192.168.1.1.

Best regards

Hi there, I think I understand what you’re asking, in which case you can set the IP address on the shared interface with the normal address1 parameter in the ipv4 section. I’d expect your config then to look something like:

[connection]
id=shared-ethernet
type=ethernet
interface-name=eth0

[ipv4]
address1=192.168.1.1
method=shared

[ipv6]
method=shared

This way the Fin would use the IP address 192.168.1.1 (rather than the default 10.42.x.0/24 address) for the shared interface eth0 and you’d be able to set your connected device to use 192.168.1.64 with gateway 192.168.1.1 and that should work fine.

There’s more information on this in the NetworkManager docs.

I hope this helps!