I have the following topology:
DeviceX ------ | DeviceX bridge with two Ethernet cards (created with bridge-utils) ---------------- router | | | | DeviceY ------ | | other devices on the same network (switches, PCs, WiFi devices)
I have complete control over DeviceX - it's a Linux PC and it has two Ethernet adapters, which are bridged with Linux
bridge-utils to provide LAN access for both DeviceX and DeviceY.
DeviceY is also a Linux PC, but I have no control over it. I know only that it is using DHCP IP address received from the router through my bridge on DeviceX. DeviceY might get replaced with another physical device at any time, thus I can't just look at its MAC address once and keep it - I need to determine MAC address each time my DeviceX boots or when it detects that one of its two Ethernet connections has been reset (cable disconnected and connected again etc.).
It is always guaranteed that only these two devices will be connected to the bridge on DeviceX, and no one else.
There might be many other devices connected to the router, but I need only the address of DeviceY which is always directly connected to one of two Ethernet ports.
It might not be deal-breaker if I also get address of the router itself - it will be known beforehand and I can filter it out, as long as I have adresses of only two devices - the router and DeviceY.
Now the question: from DeviceX, how do I reliably find MAC or IP address of DeviceY?
More info: I use bridge-utils on DeviceX because DeviceY should be in the same LAN as all the other devices in the LAN. Custom routing from DeviceX to DeviceY is not an option because it would create a new subnetwork and it would require NAT and what not to make DeviceY work as expected. Bridge-utils is the simplest solution.