Set static IP on several interface

Hi,

I have a device with 3 network interfaces: 1 wifi and 2 ethernet.
I setup the wifi connection when I created the .img in the balena cloud dashboard.

I would like to set a static IP on one of the eth interfaces, keeping the dynamic IP on the wifi interface. (The device is connected to 2 differrent networks : wifi for internet access and eth for the local network).

I don’t understand if I need to create a second file in system-connection/or if I can use the same as for the wifi and add the eth configuration? If I create a new file, do I need to name it with a specific name?

Also, in

[connection]
id=my-ethernet
type=ethernet
interface-name=eth0
permissions=
secondaries=

[ethernet]
mac-address-blacklist=

[ipv4]
address1=192.168.1.111/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

I guess the only required fields are id, type, interface-name and address1 ? What is permissions and secondaries ?

Thanks

Actually I have the solution:

I created a new file named resin-eth-01 :

[connection]
id=resin-eth-01
type=ethernet
interface-name=enp2s0
permissions=
secondaries=

[ethernet]
mac-address-blacklist=

[ipv4]
address1=192.168.0.5/24,192.168.0.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual

[ipv6]
addr-gen-mode=stable-privacy
dns-search=
method=auto

It works, but i’m still wondering about “not required” fields. Do I really need all these fields?

Hi @lpierrat, glad you found a solution, and as you found, you should create a new file in /system-connections/ with any name. As to the other optional settings, these are described by the Network Manager settings that are used to configure the networking in balenaOS https://developer.gnome.org/NetworkManager/unstable/nm-settings.html

i only had remote access to my raspberry pi, so i used the steps below to set a static IP on the WiFi interface. I didn’t find any notes on the full process including the full path, so here it is. the file /mnt/boot/system-connections/resin-wifi-01 needs to be modified as follows.

root@3416ca5:/mnt/boot/system-connections# ls
README.ignore  resin-sample.ignore  resin-wifi-01

In the example below, the WiFi router’s gateway is at 192.168.1.1 and netmask 24. Use your network’s parameters instead. In our system, dynamic IPs only go till x.x.x.128; anything above that, e.g. x.x.x.140, will have no collisions.

Change

[ipv4]
method=auto

to

[ipv4]
address1=192.168.1.140/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual

Therefore, your file should now look like this:

root@3416ca5:/mnt/boot/system-connections# cat resin-wifi-01
[connection]
id=resin-wifi-01
type=wifi

[wifi]
hidden=true
mode=infrastructure
ssid=<your AP's SSID>

[ipv4]
address1=192.168.1.140/24,192.168.1.1
dns=8.8.8.8;8.8.4.4;
dns-search=
method=manual


[ipv6]
addr-gen-mode=stable-privacy
method=auto

[wifi-security]
auth-alg=open
key-mgmt=wpa-psk
psk=<your AP's password>
root@3416ca5:/mnt/boot/system-connections#

And then reboot :smiley:.