2

So I have a question regarding network connectivity within LN nodes.

Scenario #1:

I have public lightning network node. it has real public IP address (let's say 123.123.123.123), which one is announced in config file. also, there is a TOR service, with configured .onion service (let's say mynode.onion). On the nodes config file there is no proxy configuration, so my node communicates with the rest of the world using clearnet. So from the outside world my node is available on 123.123.123.123:9735 and mynode.onion:9735. While outgoing connections are made from 123.123.123.123.

Now I have a friend, who's also node operator. He's a paranoid (his node is only available as a TOR hidden service on friendsnode.onion) and needs some incoming capacity. As i understand (please correct me if i am wrong), the only way to open channel to him is possible that way:

  • connect from my friends node to my node using my clearnet IP 123.123.123.123
  • connect from my node to friends node using his node ID
  • open a channel to him, using his node ID

my question is:

  1. what will happen in case of node restart or any other accidental event which can interrupt the current connection.
  2. Will the nodes re-connect to each other without any manual operations?

Scenario #2:

I have two LN nodes on my LAN. each node has its local IP (let's say NodeA - 192.168.0.1 and NodeB - 192.168.0.2) and both nodes have their dedicated public ip (let's say 5.5.5.5 and 6.6.6.6). The nodes have in their config files announcing the real IPs, not local ones. I would like to create a channel NodeA -> NodeB, but want to do so using local addresses. So what i do:

  • on NodeA connect to NodeB id@192.168.0.2:9735
  • open a channel NodeA -> NodeB

my question is:

  1. will it connect at all (not tested, but i assume - yes)
  2. will the nodes reconnect correctly on restart? (is the NodeB connection network address stored in DB/config files on NodeA or is it retrieved from "announced" addresses somehow from NodeB each time? )
  3. will be the LAN address of any node somehow visible to rest of the network? (assuming that beside NodeA<->NodeB channel there are non-related channels to third-party public node from each node as well)

Appreciate your answers!

edit: formatted & fixed some typo

  • i got an answer in telegram from one guy, so there it is: it is more iportant public key matching and how nodes connected doesn’t matter, when you try to open channel and any other operation which involve p2p communication, node first tries to find public key in active connections, then establish connection directly to ip address taken from graph cache (each node broadcast their advertised ip addres to the network, for lnd this is --externalip parameter), then in local cahce of previous successful connection... – baysx Sep 19 at 13:26
  • ...when you open a chennel with a node, and then restart both nodes, after restart each of node will try to connect to each other from both sides, infinitely please confirm someone this – baysx Sep 19 at 13:28
1

This is implementation dependent of course. Afaik every implementation will try to reconnect, so your first case works (note that your paranoid friend's Tor hidden service isn't used at all). This is common in practice, for any non-public node.

In the second case, for c-lightning the address hint will be forgotten on reconnect, so they'll try to reconnect on the public IPs. Even if we were to fix that, they'll try so the addresses including the public ones: we'd need a special option to ignore public addresses for a specific node if this were common.

  • That is the interesting part - how exactly the node implementations will reconnect. In which order, and will they do that successfully in described cases. If I understood you (and prev. commenter) correct friends node will going to reconnect to my node anyway on start-up. I understand that my friends .onion address was not used in that described case, but anyway, it is available for others and he is proxying over TOR outgoing connections. I was also thinking would it be good in c-lightning to specify proxy setting to some specific hosts only (IP range, .onions). Now it is ON xor OFF. – baysx Sep 22 at 5:02
  • 1
    Thanks, I've opened an issue: github.com/ElementsProject/lightning/issues/3085 – Rusty Russell Sep 23 at 6:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.