Route all traffic between two ethernet interfaces
I have a Linux box with 3 ethernet cards:
- eth0 - connected to internet (dhcp)
- eth1 - 192.168.0.1 connected to embedded device1
- eth2 - 192.168.0.1 also connected to embedded device2
(both eth1/eth2 have to be in identical, though separate, private networks).
Also, on eth0 I have two tunnel endpoints:
- vlan1 - 192.168.1.1 - virtual lan dev (OpenVPN or n2n)
- vlan2 - 192.168.2.1 - like previous
I would like to have access (from internet) to one of the embedded devices at a time through one of vlan devices (i.e. if I want to work with device1 I'll connect to vlan1 and at the same time someone else could work with device2 using vlan2 tunnel). Ah - both embedded devices have the same MAC addresses (I know it is wrong, but I cannot change their MACs).
OpenVPN in bridge mode is working only partially - it forwards ICMP traffic, even FTP, but not TCP/UDP packets (I've tried 'fragment' option, so it's not a problem of too big packets). What is more, the tunnel fails when embedded device restarts.
Hence my question - how to route/transfer/bridge all traffic from one ethernet device to another (eth1 <-> vlan1, eth2 <-> vlan2)?