Is there an alternative to identify a lightning node without their IP or onion address? In the country where I live, only dynamic IPs are assigned to most customers unless you are willing to pay a lot more for a business service.
I guess not everyone in the world can get a static IP without paying a lot extra or doing something like running a VPS.
Also, a node operator with a static IP address doesn't have total control of the IP assigned to them.
I learned that lightning uses the IP or onion address of the node to identify it, so if a node changes their IP - I guess - it assumes the node is not online anymore. Which, I understand, is a problem if you open a channel with a node.
So, my question is: is there an alternative method, implemented or not, to identify a lightning node without knowing their IP or onion address?
Lightning network nodes are identified by their node_id which is a ECDSA pubkey. This key will not change if the network Adress (IP Adress or onion Adress) changes.
If you issue invoices you will see that neither IP nor onion Adresse are part of the invoice and necessary for routing. Only your node ID (which can be derived from yours signature) is part of the invoice. This means as long as your node is online, has open channels and is connected to its peers it will be able to send and receive money.
So the question is what happens to your node and its connections if the node changes its IP Adress? Well it will in the background open a new connection to its peers and channel partners so that they can talk to you again.
Of course for other peers to be able to connect to your node your node has to send out a new node announcment message via the gossip protocol in order to update its network adress. As gossip messages in lightning are not relayed in real time to protect against spam it can be tricky for other nodes to connect to you if your network address changes too often. However this will not be an issue for end users as their node can reestablish its necessary connections to its channel partners.
If course if all channel partners have the same problem peers could not find each other and conduct the reestablishing in real time. Thus for the routing part of the network somewhat stable network addresses are useful. In general toronions are considered more stable than dynamic IP addresses.
Of course lightning network could have relied on DNS as an alternative to solve that issue. While it does rely on DNS for node discovery as described in BOLT10 it does not use dns for your described problem. So to answer your question fully: no there is currently no alternative but that is most likely never a problem.