Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The purpose of dynamically detected public IP addresses in 0.12.0 'getinfo' output? #5553

Closed
overcoin opened this issue Aug 27, 2022 · 14 comments
Assignees

Comments

@overcoin
Copy link

I understand that in 0.12.0 release dynamically detected public IP addresses are added to getinfo output. I can see that the port of my public IP address is constantly changing. What is the purpose of dynamically changing the port if router firewall is blocking this ports?

@cdecker
Copy link
Member

cdecker commented Aug 30, 2022

The IP discovery was proposed by @m-schmoock in lightning/bolts#917. It's purpose is to discover our external address if we don't specify one. The port is likely random since you are connecting out, and we should likely not use the port for outgoing connections at all, since we just get a random one back that was assigned to us by our OS.

@m-schmoock
Copy link
Collaborator

@overcoin
The getinfo output should include the dynamically detected IP address and a statically 'assumed' mainnet port 9735.
Can you give me your node getinfo output maybe including your nodeid so I can check gossip and explorers on what your node announces?

@overcoin
Copy link
Author

overcoin commented Sep 3, 2022

@cdecker
Thanks for pointing to lightning/bolts#917. It is useful.

@m-schmoock
getinfo output:

"id": "XXX",
"alias": "XXX",
"color": "XXX",
"num_peers": 69,
"num_pending_channels": 0,
"num_active_channels": 64,
"num_inactive_channels": 2,
"address": [
{
"type": "ipv4",
"address": "XXX",
"port": 9735
},
{
"type": "torv3",
"address": "XXX.onion",
"port": 9735
},
{
"type": "ipv4",
"address": "65.108.134.61",
"port": 40510
}
],
"binding": [
{
"type": "ipv4",
"address": "127.0.0.1",
"port": 9735
},
{
"type": "ipv4",
"address": "192.168.88.XXX",
"port": 9735
}
],
"version": "v0.12.0",
"blockheight": 752367,
"network": "bitcoin",
"fees_collected_msat": XXX,
"lightning-dir": "/home/XXX/.lightning/bitcoin",
"our_features": {
"init": "08a000080a69a2",
"node": "88a000080a69a2",
"channel": "",
"invoice": "02000000024100"
}

Please, note that dynamically detected IP address mentioned above is not mine. I'm sending to you private details by email. Thank you beforehand for looking into that.

@overcoin
Copy link
Author

overcoin commented Sep 3, 2022

@m-schmoock

Yes, I'm quite positive I'm running v0.12.0 following the standard procedure:
git clone https://github.com/ElementsProject/lightning.git
cd lightning
git checkout v0.12.0
git verify-tag v0.12.0

then compiling:
pip3 install --upgrade pip
pip3 install mako mistune==0.8.4 mrkd
./configure
make
sudo make install

Do you think it is possible getinfo output showing v0.12.0 while I'm running some other version?

@m-schmoock
Copy link
Collaborator

Sorry, deleted my last post.

@m-schmoock
Copy link
Collaborator

And yes, you are running 0.12.

@overcoin
Copy link
Author

overcoin commented Sep 3, 2022

There was no need to delete the entire post. You should only edit it to delete my public IP. It is okay, no worries.

@overcoin
Copy link
Author

overcoin commented Sep 3, 2022

Just for the record... Now getinfo output is changed. It is showing dynamically detected public IP address is back to my public IP address port 59828. I didn't do any config changes or restarts on my node.

@devastgh
Copy link

devastgh commented Sep 5, 2022

Just for the record... Now getinfo output is changed. It is showing dynamically detected public IP address is back to my public IP address port 59828. I didn't do any config changes or restarts on my node.

The port number in getinfo is a visual "bug". Actually that port number is true, but it's the port of your outgoing connections. Your node will announce the default port (9735 on mainnet). Maybe instead of assuming the port number, we could use the binding port number, as that way people could run autodiscovery on non-default ports as well, but that also needs the --ip-discovery=true/false(/auto) switch.

@m-schmoock
Copy link
Collaborator

@overcoin Sorry, for responding a bit late.
So, I checked your currently only announcing the IP you gave your node by config.
Did you use the --disable-ip-discoveryswitch?
I think there is no need to disable it, as you defined an IP via config already, and that should switch discovery off already.

It may be the case, as mentioned by devastgh, that this is 'visual bug' that only tells you that it would announce that if enabled. Also the port that is you outgoing port, which is dynamically. Also, I know for sure that this will not be anounced.
I'll investigate this and open up a ticket, if so.

There will be a follow up that will deprecate the --disable-ip-discovery switch and replace it by --ip-discovery true/false/auto.

@devastgh I don't like the idea of using the binding port, I already thought about that. The local binding port can be completely different, especially when talking about containerized services in docker using some kind of network bridge proxy etc.
Instead, maybe we add the option to set the 'to be announced public port' differently than 9735.

@devastgh
Copy link

devastgh commented Sep 9, 2022

@devastgh I don't like the idea of using the binding port, I already thought about that. The local binding port can be completely different, especially when talking about containerized services in docker using some kind of network bridge proxy etc. Instead, maybe we add the option to set the 'to be announced public port' differently than 9735.

Makes sense. However it might need some new option like ip-discovery-port as it would make a mess to somehow try to insert it into the current addressing scheme.

@m-schmoock
Copy link
Collaborator

@overcoin
Indeed this is a visual bug and nothing was announced.
Still needs to be addressed in #5584. Thanks for the finding.

@m-schmoock
Copy link
Collaborator

m-schmoock commented Sep 11, 2022

Also getinfo shows outbound ports on discovered IPs instead of chainparams_get_ln_port(chainparams) (which means 9735), because the port is currently set by gossipd. Will fix that too...

@m-schmoock
Copy link
Collaborator

m-schmoock commented Sep 15, 2022

@overcoin
I think this can be closed now.
Master is fixed, you can cherrypick #5584 and #5585 if you wish or wait for next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants