With more than one project on the same network, there are connection conflicts

The Arduino shields don’t have a fixed MAC address, you specify it yourself in the code.

Take a look at these threads for info on configuring the MAC address:

You said earlier that you were using MQTT, but there’s no MQTT code in the sample you posted. Can you share your full code?

Pete.