1

Can anyone help with this?

I have a gadget that has a fixed IP address 10.0.0.2, which I cannot change. It needs to talk to my laptop, which in turn needs to talk to the internet.

My main network card gets its IP from a DHCP server. I have a secondary network card with ip address 10.0.0.5 and I used to talk to the device through this interface.

I had to move to another network segment, which happens to have its ip range as 10.0.0.0/24. Great. I can't influence this either.

Now I am stuck with a problem. 10.0.0.2 is in use, so I can't just do the easy thing and plug the gadget with the fixed IP to this network and live happily ever after.

Which means I now need to mangle my Ubuntu host in such a way that it can talk to 10.0.0.254 (default gateway) through eth0 and 10.0.0.2 through eth1. How on earth do I do this? My eth0 gets a random 10.0.0.x IP and my eth1 is fixed to 10.0.0.5.

What I have tried is as follows:

  1. add a static entry to arp table to tell 10.0.0.2 is at xx:xx:xx:xx:xx:xx via interface eth1
  2. Tried to bind my outbound connection to 10.0.0.5 when talking to 10.0.0.2
  3. Change eth1 to something completely different (10.42.0.1) and use iptables to make it so that when a packet is transmitted to 10.42.0.2, it would actually go to 10.0.0.2.

None of these work. When I tcpdump eth1, all traffic still attempts to exit via eth0 in cases 1 and 2. With case 3, I can make the redirect to 10.0.0.2 happen but traffic then just chooses the wrong interface and exit from eth0 as eth1 does not have an address there.

How should I do this? I know this is a silly problem, no need to tell me that. There should be a way to change one of these networks but this simply is not an option at the moment. Eventually it will be but if I can find a temporary solution, I will save a couple of weeks time.

The only way I think I can solve it is to get another computer, attach it to eth1, use 10.42.0.0/24 network for this, and then set this computer to relay traffic to 10.0.0.2. This should now work as it does not have more than one interfaces in that network. The problem with this is obtaining the other computer or router.

H

Hannu
  • 113
  • 5

0 Answers0