Routing by connection tracking

Hello,

I have switch port, that allows only a single MAC/IP connected to it. - But, I would like to connect two hosts, without any additional private network. (No NAT.)

Therefore the plan is adding a linux router doing proxy-arp with three interfaces, one for host1, one for host2 and one for the remaining LAN.

Now I would like to give both hosts the same IP address and use connection tracking to route a packet to host2 if and only if the connection was initiated by host2 itself.

Therefore, for both the hosts and the LAN, it should look like there is only one single host on my side.

What is the right way to do this?

Shouldn't it be possible to simply mark a connection initiated by host2 with CONNMARK and afterwards use policy routing to route all packages of marked connection to host2? (Anyone already did such things?)

Are there more problems I do not see yet?

I'm pretty much sure, that I am not the first one trying to do such things. Do you have any pointers for me to read?

You can't have more than one computer on the same IP on the same network. The MAC is how ethernet knows how to send what where.

IOW, NAT was invented to solve this.

@Corona688: I very well know what an IP and a MAC address is.
Please google for "proxy arp" and "policy routing" - things are not so simple as they seem. :wink: