Skip to content

[BUG] Improve IP Address detection when hostname is given in config #5797

@petzsch

Description

@petzsch

Issue and Steps to Reproduce

When using a DNS name (i.e. pay.4sats.net) it now resolves to the first IPv4 it gets back from the local dns resolver. However in my case (VM from Contabo with Ubuntu 22.04) it got returned a local IP address (together with a public IPv4):

root@pay:~# host pay.4sats.net
pay.4sats.net has address 127.0.1.1 // it only announce this one
pay.4sats.net has address 89.117.59.102
pay.4sats.net has IPv6 address 2a02:c206:3010:4506::1

My desired behaviour would be for the announcement to:

  • exclude any local IP subnets (since they can't be reached from any other node anyway)
  • announe the one (maybe there are more) public IPv4
  • also announce the public IPv6

current workarround: comment out the local IP from /etc/hosts and life with missing ipv6.
Using the fix provided in #5795

getinfo output

{
   "id": "03bf73fb1e44cb60b13edd4fa3e81e1e9709fd9871af0b6cf8f847dfa0bfe5791c",
   "alias": "4sats.net Core-Lightning",
   "color": "03bf73",
   "num_peers": 1,
   "num_pending_channels": 0,
   "num_active_channels": 1,
   "num_inactive_channels": 0,
   "address": [
      {
         "type": "ipv4",
         "address": "127.0.1.1",
         "port": 9735
      },
      {
         "type": "torv3",
         "address": "65dbner57zrmrixqahke5usmk3wsguk4ctwe5unva5ougxhzrjgeijad.onion",
         "port": 9735
      }
   ],
   "binding": [
      {
         "type": "ipv4",
         "address": "0.0.0.0",
         "port": 9735
      }
   ],
   "version": "basedon-v22.11-2-modded",
   "blockheight": 766448,
   "network": "bitcoin",
   "msatoshi_fees_collected": 0,
   "fees_collected_msat": "0msat",
   "lightning-dir": "/root/.lightning/bitcoin",
   "our_features": {
      "init": "08a0800a0269a2",
      "node": "88a0800a0269a2",
      "channel": "",
      "invoice": "02000002024100"
   }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions