Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[bug]: lncli getinfo does not return the configured P2P port. #10234

Answered by ViktorT-11
luisschwab asked this question in Q&A
Discussion options

Background

lncli getinfo always returns the default P2P port 9735 on the URIs field, even when setting another port on lnd.conf.

I verified this via lsof -i tcp:<other_port>, which shows lnd listening on my defined port, and lsof -i tcp:9735, which outputs nothing. Also connected to this node from another node of mine on the non-default port.

Your environment

  • version of lnd: 19.3-beta
You must be logged in to vote

HI @luisschwab,

The port shown in the lncli getinfo response is displaying the externally advertised IP:s+ports that you've specified using the externalip config option, and not the IP:s+ports set for the listen config option.

As specified in the sample-lnd.conf file, if you do not set any port for an IP for the externalip config option, the default port used will be 9735.

In other words, if you just set:
externalip=1111年1月1日.1
That will use the default port and therefore show the lncli getinfo response as:

"uris": [
 "NODEPUB@1111年1月1日.1:9735"
],`

Where as if you specify a port for the externalip config option:
externalip=1111年1月1日.1:9666
that will then be used for the lncli getinfo res...

Replies: 1 comment 4 replies

Comment options

HI @luisschwab,

The port shown in the lncli getinfo response is displaying the externally advertised IP:s+ports that you've specified using the externalip config option, and not the IP:s+ports set for the listen config option.

As specified in the sample-lnd.conf file, if you do not set any port for an IP for the externalip config option, the default port used will be 9735.

In other words, if you just set:
externalip=1111年1月1日.1
That will use the default port and therefore show the lncli getinfo response as:

"uris": [
 "NODEPUB@1111年1月1日.1:9735"
],`

Where as if you specify a port for the externalip config option:
externalip=1111年1月1日.1:9666
that will then be used for the lncli getinfo response:

"uris": [
 "NODEPUB@1111年1月1日.1:9666"
],`
You must be logged in to vote
4 replies
Comment options

Interesting, I would think that behavior would be similar to Core, where it will advertise the port we define on listen. So in my case, my node is listening on the port I defined, but advertising the default P2P port via gossip?

Comment options

Also, changing the Tor port would need to be done via the torrc file, correct?

Comment options

my node is listening on the port I defined, but advertising the default P2P port via gossip

Yes, correct. Keep in mind though that you can use port forwarding locally.

changing the Tor port would need to be done via the torrc file

You could do that, but I also recommend you to checkout the config options lnd enables:

lnd/sample-lnd.conf

Lines 936 to 1006 in 82f77e5

[tor]
; Allow outbound and inbound connections to be routed through Tor.
; tor.active=false
; Allow the node to connect to non-onion services directly via clearnet. This
; allows the node operator to use direct connections to peers not running behind
; Tor, thus allowing lower latency and better connection stability.
; WARNING: This option will reveal the source IP address of the node, and should
; be used only if privacy is not a concern.
; tor.skip-proxy-for-clearnet-targets=false
; The port that Tor's exposed SOCKS5 proxy is listening on. Using Tor allows
; outbound-only connections (listening will be disabled) -- NOTE port must be
; between 1024 and 65535.
; Default:
; tor.socks=localhost:9050
; Example:
; tor.socks=9050
; The DNS server as IP:PORT that Tor will use for SRV queries - NOTE must have
; TCP resolution enabled. The current active DNS server for Testnet listening is
; nodes.lightning.directory.
; Default:
; tor.dns=soa.nodes.lightning.directory:53
; Example:
; tor.dns=nodes.lightning.directory
; Enable Tor stream isolation by randomizing user credentials for each
; connection. With this mode active, each connection will use a new circuit.
; This means that multiple applications (other than lnd) using Tor won't be mixed
; in with lnd's traffic.
;
; This option may not be used while direct connections are enabled, since direct
; connections compromise source IP privacy by default.
; tor.streamisolation=false
; The host:port that Tor is listening on for Tor control connections.
; tor.control=localhost:9051
; IP address that Tor should use as the target of the hidden service.
; tor.targetipaddress=
; The password used to arrive at the HashedControlPassword for the control port.
; If provided, the HASHEDPASSWORD authentication method will be used instead of
; the SAFECOOKIE one.
; Default:
; tor.password=
; Example:
; tor.password=plsdonthackme
; Automatically set up a v2 onion service to listen for inbound connections.
; tor.v2=false
; Automatically set up a v3 onion service to listen for inbound connections.
; tor.v3=false
; The path to the private key of the onion service being created.
; Default:
; tor.privatekeypath=
; Example:
; tor.privatekeypath=/path/to/torkey
; The path to the private key of the watchtower onion service being created.
; Default:
; tor.watchtowerkeypath=
; Example:
; tor.watchtowerkeypath=/other/path/
; Instructs lnd to encrypt the private key using the wallet's seed.
; tor.encryptkey=false

Note that when you're setting an advertised externalip, you can also specify your onion address.
externalip=<your-onion-address>.onion:PORT

Comment options

Yeah, I already do this. The config makes sense to me now, as you can specify multiple sockets and proxy them to the internal P2P port.

Answer selected by saubyk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Support questions, not issues with the code
Converted from issue

This discussion was converted from issue #10231 on September 22, 2025 14:24.

AltStyle によって変換されたページ (->オリジナル) /