How to distinguish a peer by its endpoint IPV4 Address at last Router/Switch in a P2P system

In Peer2Peer System using just IPV4 Endpoint Address, suppose that we have a peer in USA and two other peers in a same office at TUWien. As you know Layer2 Switches (Common Switches used in LAN) broadcast the message to the network and just because the last address that USA peer has is the router just before the switch, we can not distinguish between two local peers in a same office. So how should I distinguish them?
1 answer

Using a random identifier or a random port for each peer in a P2P system

The solution I found is to assign a random identifying number to each peer and attach the identifier to the handshake message as well as registering the identifier with the P2P server. The other solution would be assigning random listening port to the peers so each peer listens on a random port and the probability of two peers with a same port number in a LAN is so low.