raspiblitz icon indicating copy to clipboard operation
raspiblitz copied to clipboard

Public IP detection failed

Open ChuckNorrison opened this issue 2 years ago • 5 comments

On my Setup with OpenVPN on top of my raspiblitz installation, the public IP detection recognized 127.0.0.1 after some days. This IP was also written to my lnd.conf.

Iam using a static public IP via VPS iam connecting to over OpenVPN.

My node is running with v1.8.0

This was solved here: https://github.com/rootzoll/raspiblitz/issues/1718

After another day, it was correct again

In case of failed IP detection i will try to call the internet.sh manually to get some more informations

sudo /home/admin/config.scripts/internet.sh status global

ChuckNorrison avatar Oct 04 '22 21:10 ChuckNorrison

Thanks for the report .. such sporadic errors are hard to get by. But will mark this issue for v.1.8.2 where I hope to give the whole IP config situation a fresh look.

rootzoll avatar Oct 06 '22 14:10 rootzoll

After disconnecting the Router and reconnect, the detected IP is 127.0.0.1.

internet.sh status global command result with the expected "globalip". "publicip" and "cleanip" was set to 127.0.0.1.

Output form internet.sh (replaced my correct public IP with 1.2.3.4):

# getting public IP from third party service ## curl returned: 1.2.3.4 ## curl exit code: 0 # sanity check of IP data: # OK IPv4 for 1.2.3.4 ### LOCAL INTERNET ### localip=192.168.8.160 localiprange=192.168.8.0/24 dhcp=1 configWifiExists=0 network_device=eth0 network_rx='2.9GiB' network_tx='18.3GiB' ### GLOBAL INTERNET ### ipv6=off # globalip --> ip detected from the outside globalip=1.2.3.4 # publicip --> may consider the static IP overide by raspiblitz config publicip=127.0.0.1 # cleanip --> the publicip with no brackets like used on IPv6 cleanip=127.0.0.1

Raspiblitz.conf publicIP was set to 127.0.0.1.

// After another reboot of the Router and some wait time, the correct public IP was recognized again

// After some wait time, its again set to 127.0.0.1 while the internet.sh always recognized the correct "globalip"

// it toggles with the correct ip and 127.0.0.1

ChuckNorrison avatar Oct 09 '22 15:10 ChuckNorrison

00infoBlitz.sh calls _cache.sh which will try to redis-cli get ln_lnd_mainnet_address. The wrong IP 127.0.0.1 is returned here.

_background.scan.sh calls lnd.monitor.sh mainnet info and retrieves the "uris" via lncli, which is still wrong and sets it to redis db with help of _cache.sh

So the issue is produced by lncli in some way. I observed this behaviour on restarting lnd.service and was able to fix it temporary with redis-cli set ln_lnd_mainnet_address [email protected]

// i think it is a race condition when lnd.service restarts unexpected

ChuckNorrison avatar Oct 18 '22 15:10 ChuckNorrison

thought it is the lnd which tries to detect the public ip, but i was wrong https://github.com/lightningnetwork/lnd/issues/7061

so iam back here

// I think the lnd.check.sh as prestart script for the lnd service could cause this behaviour https://github.com/rootzoll/raspiblitz/blob/b1c2e3c3a14595e5876466e8e2db2274dfd05d20/home.admin/config.scripts/lnd.check.sh#L186

it reads the publicIP from /mnt/hdd/raspiblitz.conf

ChuckNorrison avatar Oct 24 '22 12:10 ChuckNorrison

i did a pull request https://github.com/rootzoll/raspiblitz/pull/3382

The reason for this behaviour is here https://github.com/rootzoll/raspiblitz/issues/312#issuecomment-462675101

If lnd starts with --externalip=, it gets stuck, so 127.0.0.1 is set. I think this could be solved better if a check for existent publicIP gets done first. Currently the public IP gets written always and sometimes curl can fail. In this case it gets set to 127.0.0.1.

So i did another change https://github.com/rootzoll/raspiblitz/pull/3382/commits/b3215bc22ce8dabedde0171e9d6701bad8def288

ChuckNorrison avatar Oct 24 '22 15:10 ChuckNorrison