How do nodes/wallets know what is the IP of the "nearby" node running monerod. How do they discover other nodes?
Monero wallet's daemon monerod initially and when all recent peers are offline tries to connect to one of the hard coded seed nodes, currently these are:
seeds.moneroseeds.se seeds.moneroseeds.ae.org seeds.moneroseeds.ch seeds.moneroseeds.li
If it peers with enough regular network nodes, these nodes are not used any more unless all known peers are offline.