Add config option to set external P2P port to facilitate incoming connections #32657

issue rleed openend this issue on June 1, 2025
  1. rleed commented at 10:45 pm on June 1, 2025: none

    Please describe the feature you’d like to see added.

    Add config option to set external P2P port to facilitate incoming connections, complementary to the externalip option.

    Without being able to specify the external port, it is impossible to receive incoming connections when the node is behind a port-forwarding system unless the same port number is used both externally and internally, which may not always be an option or may not be desired.

    Describe the solution you’d like

    Add an externalp2pport option or similar, specifying the public p2p port number to be reported to peers along with the externalip.

    Describe any alternatives you’ve considered

    One might tag on a :port number to the externalip option… but this is ambiguous as there are other ports besides p2p that might need to be specified separately. One might also want additional options for Tor, I2P, etc.

    Please leave any additional context

    The need for this arises when the node is accessed through a VPN or any other port-forwarding setup, if the local p2p port cannot be used on the external IP for any reason.

  2. rleed added the label Feature on Jun 1, 2025
  3. sipa commented at 10:52 pm on June 1, 2025: member
    Does -port not work for this?
  4. rleed commented at 11:23 pm on June 1, 2025: none

    Does -port not work for this?

    As I understand it, the value specified by -port is currently advertised along with that of -externalip to allow incoming connections to a non-default port, but in a port-forwarding situation, this only works when the external forwarded port is identical to the local listening port. However, there are situations where this is not practical. Being able to specify the external port independently would provide a general solution.

  5. sipa commented at 0:33 am on June 2, 2025: member
    I see. I believe this already works, you can add a port number to the externalip= argument.
  6. rleed commented at 9:39 am on June 2, 2025: none

    I see. I believe this already works, you can add a port number to the externalip= argument.

    Wonderful! I had tried this before, but I had overlooked a detail in my configuration….my bad. Now it’s working! Thank you!

  7. maflcko closed this on Jun 2, 2025

  8. maflcko commented at 10:03 am on June 2, 2025: member
    I guess the docs could be updated for the setting in init.cpp, to clarify this.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-15 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me