I could use some help with this. I don't even know how to get started despite being familiar with iptables.
I have a gadget, with a static IP address 10.0.0.2/24. This is what it is and I cannot change it. My laptop used to have just one NIC. I was able to connect to the public internet and this gadget (which does not need to access any other devices but my laptop) by just plugging it into my development network and giving my laptop NIC a secondary address 10.0.0.1 and plugging the device to the same switch as my laptop. Not ideal but it worked.
Now I had to move to another development network, the IP range of which is .... (suspenseful music) .... 10.0.0.0/24. And 10.0.0.2 is in its DHCP range occupied by another device.
I have now obtained another network interface card (eth1) for my laptop and given it an IP address of 10.42.42.1.
Basically what I need to do is some iptables magic to make it so that when I access for example 10.42.42.2, this traffic when exiting eth1 gets IP address 10.0.0.5 for example and is passed to 10.0.0.2 in eth1, and when the gadget responds and eth1 receives the response, it will be passed to my host laptop as if coming from 10.42.42.2.
I probably need SNAT/DNAT rules here but how should I set them up?