I know that I could achieve the desired result with an Ethernet switch, but I'm curious if I can get this with some cheaper solution.
The idea is as follows:
Rapsberry Pi has two Ethernet ports - one is the built-in port and the other will be some cheap USB-Ethernet adapter
one of the ports is connected directly to my local router and receives a DHCP IP address. Let's say it is 192.168.1.2.
the other port will be attached to some other device. I need this device to think that it is attached directly to the same router and to receive a DHCP IP address from the router. Let's say, the address is 192.168.1.3.
Essentially, I'd like RPi to behave like an Ethernet switch, which requests one IP for itself and then routes other requests from/to the other device.
Here is an image which explains how I'd do it with a switch:
And here is how I'd like it to work:
Now imagine that I have five (or more) such pairs "RPi plus Device X" and you'll understand why I would want to get rid of the switch, if possible - I could buy five USB-Ethernet dongles instead of five 3 port switches, which would require separate power supply and two additional wires.
Are there any Linux configuration options to make this setup to work with RPi's Ethernet port and an Ethernet dongle?