Cannot make the static IP work

Hello, I am trying to setup a static IP on a nuc, and I cannot make it work.
On the USB stick I use to flash, I have created a config file in system-connections named resin-eth0 with this:

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

[ethernet]
mac-address-blacklist=

[ipv4]
address1=172.16.139.170/24,172.16.139.1
dns=192.168.1.6;192.168.1.6;
dns-search=
method=manual

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

I have also made some changes in the config.json file in case:

  ....

“files”: {
“network/network.config”: “[service_home_ethernet]\nType=ethernet\nNameservers=192.168.1.6,192.168.1.6\nIPv4 = 172.16.139.170/255.255.255.0/172.16.139.1”
}

But nothing works, my NUC is flashed, and still has an IP given by the DHCP, not the one I would like to asign.

Thanks a lot for you help

I understand you’re trying to set a static IP using the NetworkManager config format indicated in our docs [1], and you’re seeing an IP allocated by DHCP, not the static one you specified.

One question comes to mind: is the IP being set on the eth0 interface? Or is this on the wifi interface? (I’m wondering if you’d specified wifi credentials when downloading the .img from the dashboard, leading to an active wifi connection which is superceding the eth0 connection)

[1] https://www.balena.io/docs/reference/OS/network/2.x/#setting-a-static-ip

Hello, thanks for your help.
No, the wifi is not in used , will not be, and is not configured. I want to assign this static IP the the eth0 as the only network access will be by cable.

In that case, I wonder what the NetworkManager logs look like. Could you run journalctl -a -u NetworkManager and grab the output? Also, ip a s will show the state of the network interfaces.

Here is the journalctl -a -u NetworkManager

Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9232] NetworkManager (version 1.20.2) is starting... (for the first time)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9232] Read config: /etc/NetworkManager/NetworkManager.conf (etc: os-networkmanager.conf)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9426] bus-manager: acquired D-Bus service "org.freedesktop.NetworkManager"
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9503] manager[0x55f8f767a0f0]: monitoring kernel firmware directory '/lib/firmware'.
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9541] hostname: hostname: using hostnamed
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9546] dns-mgr[0x55f8f765c240]: init: dns=default,systemd-resolved rc-manager=resolvconf
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9553] manager[0x55f8f767a0f0]: rfkill: Wi-Fi hardware radio set enabled
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9553] manager[0x55f8f767a0f0]: rfkill: WWAN hardware radio set enabled
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9667] Loaded device plugin: NMWwanFactory (/usr/lib/NetworkManager/1.20.2/libnm-device-plugin-wwan.so)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9735] Loaded device plugin: NMWifiFactory (/usr/lib/NetworkManager/1.20.2/libnm-device-plugin-wifi.so)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9774] Loaded device plugin: NMBluezManager (/usr/lib/NetworkManager/1.20.2/libnm-device-plugin-bluetooth.so)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9789] Loaded device plugin: NMAtmManager (/usr/lib/NetworkManager/1.20.2/libnm-device-plugin-adsl.so)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9792] manager: rfkill: Wi-Fi enabled by radio killswitch; enabled by state file
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9803] manager: rfkill: WWAN enabled by radio killswitch; enabled by state file
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9809] manager: Networking is enabled by state file
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9816] dhcp-init: Using DHCP client 'internal'
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9818] settings: Loaded settings plugin: keyfile (internal)
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9906] device (lo): carrier: link connected
Nov 15 13:19:15 7714f7e NetworkManager[871]: <info>  [1573823955.9918] manager: (lo): new Generic device (/org/freedesktop/NetworkManager/Devices/1)
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.0007] manager: (enp2s0): new Ethernet device (/org/freedesktop/NetworkManager/Devices/2)
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.0128] settings: (enp2s0): created default wired connection 'Wired connection 1'
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.0219] device (enp2s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'external')
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.1375] manager: (resin-dns): new Bridge device (/org/freedesktop/NetworkManager/Devices/3)
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.1437] manager: (sit0): new IPTunnel device (/org/freedesktop/NetworkManager/Devices/4)
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.1756] modem-manager: ModemManager available
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.1757] bluez: use BlueZ version 5
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.1837] bluez5: NAP: added interface F4:06:69:31:91:F0
Nov 15 13:19:16 7714f7e NetworkManager[871]: <info>  [1573823956.6598] manager: (balena0): new Bridge device (/org/freedesktop/NetworkManager/Devices/5)
Nov 15 13:19:19 7714f7e NetworkManager[871]: <info>  [1573823959.9976] device (enp2s0): carrier: link connected
Nov 15 13:19:19 7714f7e NetworkManager[871]: <info>  [1573823959.9982] device (enp2s0): state change: unavailable -> disconnected (reason 'carrier-changed', sys-iface-state: 'managed')
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0002] policy: auto-activating connection 'Wired connection 1' (1413dc76-be2c-382c-aa2e-afb5fa0a9bb8)
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0020] device (enp2s0): Activation: starting connection 'Wired connection 1' (1413dc76-be2c-382c-aa2e-afb5fa0a9bb8)
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0023] device (enp2s0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0032] manager: NetworkManager state is now CONNECTING
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0038] device (enp2s0): state change: prepare -> config (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0050] device (enp2s0): state change: config -> ip-config (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:20 7714f7e NetworkManager[871]: <info>  [1573823960.0058] dhcp4 (enp2s0): activation: beginning transaction (no timeout)
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.3724] manager: (supervisor0): new Bridge device (/org/freedesktop/NetworkManager/Devices/6)
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4183] device (supervisor0): state change: unmanaged -> unavailable (reason 'connection-assumed', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4237] device (supervisor0): state change: unavailable -> disconnected (reason 'connection-assumed', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4252] device (supervisor0): Activation: starting connection 'supervisor0' (455f5d6b-59bf-4c3b-83c8-a475ce2b683b)
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4258] device (supervisor0): state change: disconnected -> prepare (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4271] device (supervisor0): state change: prepare -> config (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4279] device (supervisor0): state change: config -> ip-config (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4284] device (supervisor0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4527] device (supervisor0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4533] device (supervisor0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'external')
Nov 15 13:19:37 7714f7e NetworkManager[871]: <info>  [1573823977.4559] policy: set-hostname: set hostname to 'localhost.localdomain' (no default device)
Nov 15 13:19:37 localhost.localdomain NetworkManager[871]: <info>  [1573823977.4560] device (supervisor0): Activation: successful, device activated.
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6049] dhcp4 (enp2s0): state changed unknown -> bound
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6080] device (enp2s0): state change: ip-config -> ip-check (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6289] device (enp2s0): state change: ip-check -> secondaries (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6296] device (enp2s0): state change: secondaries -> activated (reason 'none', sys-iface-state: 'managed')
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6306] manager: NetworkManager state is now CONNECTED_LOCAL
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6327] manager: NetworkManager state is now CONNECTED_SITE
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6328] policy: set 'Wired connection 1' (enp2s0) as default for IPv4 routing and DNS
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6341] dns-mgr: Writing DNS information to /sbin/resolvconf
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6499] device (enp2s0): Activation: successful, device activated.
Nov 15 13:19:51 localhost.localdomain NetworkManager[871]: <info>  [1573823991.6516] manager: startup complete
Nov 15 13:25:14 localhost.localdomain NetworkManager[871]: <info>  [1573824314.1092] manager: (br-9a6abe6ec772): new Bridge device (/org/freedesktop/NetworkManager/Devices/7)
Nov 15 13:25:21 localhost.localdomain NetworkManager[871]: <info>  [1573824321.0369] manager: (resin-vpn): new Tun device (/org/freedesktop/NetworkManager/Devices/8)
Nov 15 13:27:18 localhost.localdomain NetworkManager[871]: <info>  [1573824438.9375] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/9)
Nov 15 13:27:20 localhost.localdomain NetworkManager[871]: <info>  [1573824440.1793] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/10)
Nov 15 13:57:34 localhost.localdomain NetworkManager[871]: <info>  [1573826254.7722] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/11)
Nov 15 14:03:22 localhost.localdomain NetworkManager[871]: <info>  [1573826602.4135] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/12)
Nov 15 14:08:33 localhost.localdomain NetworkManager[871]: <info>  [1573826913.6772] manager: (dummy0): new Dummy device (/org/freedesktop/NetworkManager/Devices/13)
Nov 15 15:21:53 localhost.localdomain NetworkManager[871]: <info>  [1573831313.7117] manager: (resin-vpn): new Tun device (/org/freedesktop/NetworkManager/Devices/14)

And here is the ip a s

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel qlen 1000
    link/ether 44:8a:5b:fd:6e:ef brd ff:ff:ff:ff:ff:ff
    inet 172.17.254.51/24 brd 172.17.254.255 scope global dynamic enp2s0
       valid_lft 35663sec preferred_lft 35663sec
    inet6 fe80::5abe:13eb:8be4:111d/64 scope link
       valid_lft forever preferred_lft forever
4: resin-dns: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue qlen 1000
    link/ether 6e:f8:f0:1d:2d:f6 brd ff:ff:ff:ff:ff:ff
    inet 10.114.102.1/24 scope global resin-dns
       valid_lft forever preferred_lft forever
    inet6 fe80::6cf8:f0ff:fe1d:2df6/64 scope link
       valid_lft forever preferred_lft forever
5: balena0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 02:42:18:7c:94:32 brd ff:ff:ff:ff:ff:ff
    inet 10.114.101.1/24 brd 10.114.101.255 scope global balena0
       valid_lft forever preferred_lft forever
6: supervisor0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 02:42:e1:5d:6b:5d brd ff:ff:ff:ff:ff:ff
    inet 10.114.104.1/25 brd 10.114.104.127 scope global supervisor0
       valid_lft forever preferred_lft forever
7: br-9a6abe6ec772: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue
    link/ether 02:42:ad:48:84:19 brd ff:ff:ff:ff:ff:ff
    inet 172.18.0.1/16 brd 172.18.255.255 scope global br-9a6abe6ec772
       valid_lft forever preferred_lft forever
14: resin-vpn: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel qlen 100
    link/[65534]
    inet 10.240.0.3 peer 10.240.0.1/32 scope global resin-vpn
       valid_lft forever preferred_lft forever
    inet6 fe80::1c7c:39a9:5ccb:bef2/64 scope link
       valid_lft forever preferred_lft forever

Thanks for those logs. I’m poring over the NetworkManager logs with a fine-tooth comb, and in the meanwhile, could you triple-check the contents of /etc/NetworkManager/system-connections/?

Thanks again !
Here is the content of the folder:

ls -l /etc/NetworkManager/system-connections/
total 3
-rw------- 1 root root 301 Nov 15 13:19 README.ignore
-rw------- 1 root root 286 Nov 15 13:19 resin-eth0
-rw------- 1 root root 245 Nov 15 13:19 resin-sample.ignore

And is resin-eth0 what you expect it to be, there?

Yes, it is the same as what I dropped on the usb key

cat /etc/NetworkManager/system-connections/resin-eth0

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

[ethernet]
mac-address-blacklist=

[ipv4]
address1=172.16.139.170/24,172.16.139.1
dns=192.168.1.6;192.168.1.6;
dns-search=
method=manual

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

thanks again for your help

Hi,
I think the problem is the wrong interface name in your connection profile. You specify interface-name=eth0, but it seems the ethernet interface is called enp2s0. Can you try to change it to interface-name=enp2s0?
Best regards,

Thanks a lot, I really did not know, eth0 could be named otherwise. It seems to work, I ll be sure when I do the final installation later this week.
Thanks again for the help !