Setting static IP on eth0 when eth0 is in a different IP range as gateway

Hello forum,

I have an RFID reader connected to a Pi 4 which sends data through a TCP socket as chips are scanned. The reader connects to the Pi through eth0, and the Pi connects to the internet through wifi and sends on the data from the RFID reader to an API on my server.

To get everything talking I had to put the RFID reader in a different IP range ( and I give eth0 on the Pi address Then the Pi wifi interface has static address in order to connect to my router, which is We couldn’t get things working while the RFID reader and Pi eth0 were in the same IP range as the wifi and router.

It all works fairly well as it is when I set the Pi’s eth0 using ifconfig in the balena cloud terminal, the only hickup is that I can’t seem to get the connection file syntax right since it doesn’t go through the gateway - my question is whether there is a way to set this static address for the Pi’s eth0? Or is there a better way to link eth0 and wifi so I can receive data from the RFID reader, let the Pi compile the JSON so it can send it to my API through wifi?

This is what I currently have in the connection file for eth0: (I realise there is no way it could work, but can we change it so that it will work?)





Alternatively, is there a way to execute this line automatically whenever the Pi starts up?

ifconfig eth0 netmask up

Found the solution with help from someone outside of the forum, just needed to drop the gateway from the connection file for eth0




Hey there, I’m glad that things got sorted out, let us know if you face any other issues. Have a nice day!