This paper presents a new protocol to self assign node IDs in an Underwater Acoustic Network (UAN). The proposed solution, termed DIVE for Distributed Id assignment and topology discoVEry, is fully distributed and self-adaptive. While assigning the node IDs, additional information is shared to discover the other nodes in the network, the type of these nodes (static or mobile), and the number of hops to reach them. The DIVE protocol exploits link quality information to increase its reliability and robustness against message losses. The protocol performance has been evaluated under a variety of networking scenarios including node mobility, and node addition and removal. The results show that DIVE is an efficient and reliable solution for node ID assignment and network discovery, which scales with the network size in the presence of a unreliable channel.