I am running on a Ras Pi 3, and I am trying to set a static IP address on a second NIC that I’ve connected via USB. The shell on the host OS shows that the NIC appears as eth1 with no problem. I added
/mnt/boot/resin-boot/usb-ethernet with the following:
[connection] id=usb-ethernet type=ethernet interface-name=eth1 permissions= secondaries= [ethernet] mac-address-blacklist= [ipv4] address1=192.168.1.1/24,192.168.1.1 dns= dns-search= method=manual [ipv6] addr-gen-mode=stable-privacy dns-search= method=auto
but when I reboot, eth1 still has no static IP. If I run
nmcli d, I see:
root@4599018:/mnt/boot/system-connections# nmcli d status DEVICE TYPE STATE CONNECTION eth0 ethernet connected Wired connection 1 resin-dns bridge connected resin-dns supervisor0 bridge connected supervisor0 wlan0 wifi disconnected -- eth1 ethernet unavailable -- balena0 bridge unmanaged -- br-a4fc174ab352 bridge unmanaged -- lo loopback unmanaged -- resin-vpn tun unmanaged --
but if I run
nmcli connection up id usb-ethernet it properly brings the interface up and sets that static IP.
eth1 needs to have that static IP at startup. How can I do this? Is there a way I can run that nmcli command sometime at startup (after the eth1 device has appeared) or something I’ve configured wrong in NetworkManager?
Update: It turns out that eth1 updates to set that static IP if I simply plug the cable in, but then there is a different problem: the device doesn’t boot properly if the cable is plugged in. I’m guessing that it has reordered the network interfaces.
Second update since I can’t delete this: I just needed
never-default=true in the
[ipv4] section of the configuration I gave above. The network interfaces weren’t being reordered, but eth1 was being set as the default route when a link was present - so the device was unable to communicate with Resin.