Bear with me. This relates to this Stack Overflow question.
My Linux thing (actually a BeagleBoard) has two interfaces, eth0 and eth1. It needs to connect to a client's network on eth0 (address range unknown, may be DHCP, probably 192.168.0.x). My software also needs to connect to another device on eth1 via a private link (i.e. just device to device). I want to keep the private network totally separate - it should NOT be visible on the main network. Only my own code on the Beagle will be talking to the device on eth1.
I've figured out how to make my C code bind a socket to a specific interface as well as IP address. I can also put the private link on a separate subnet to the main network and everything is happy.
However, given that I don't know the address range of the main network, and I want to use fixed IP addresses for my private link (for simplicity), how do I ensure that the address ranges don't clash? I tried putting the private device on the same IP address as something on the main network (for a test), which caused routing issues.
Is it possible to set up routing so that duplicate IP addresses (on the main network and my private network) would work (given that I can specify the interface as well as IP address)? Or is that crazy talk? I don't need to actually "route" anything between the networks and my private device doesn't need to see the main network. I just need it to still work even if the IP addresses happen to be the same.
Alternatively, can I use one of the reserved IP address ranges on my private so that I know it won't clash with the main network?
I've been searching a lot for an answer to this, but it seems like an unusual thing to do and all the answers assume the two ethernet interfaces will connect to different subnets.
Any ideas? Including doing it some other way... Thanks!