Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
52 lines (36 sloc) 1.91 KB

All Extras / Lights Out / Dynamic Public IP

Now Obsolete

Since LND V0.5, this Extra is obsolete. lnd now supports the following lnd.conf entry that supports dynamic IPs.

nat=true

See https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf for more info.

Introduction

If your RaspiBolt is running on an internet connection that does not have a static IP address and your ISP changes your IP address, then your Lightning Network Node (LNN) has effectively disappeared from the Lightning Network (LN).

There is discussion among the lnd developers about adding a new lncli command to update the --externalip parameter without restarting lnd - which locks the wallet. Until that is implemented, the solution presented here is a stop-gap solution.

The basic method is:

  • Every 10 minutes:
    • Notice that the external IP address has changed
    • Restart lnd

If you also want to automatically unlock the wallet, see Auto Lightning Wallet Unlock.

Procedure

  • Login to your RaspiBolt as user admin
  • Edit the following script, save and exit

admin ~ ฿ sudo nano /usr/local/bin/getpublicip.sh

#!/bin/bash
# RaspiBolt LND Mainnet: script to get public ip address
# /usr/local/bin/getpublicip.sh

echo 'getpublicip.sh started, writing public IP address every 10 minutes into /run/publicip'
while [ 0 ];do
 source /run/publicip
 CURRENTIP=$(curl ipinfo.io/ip 2> /run/publicip.log )
 echo  PUBLICIP=$CURRENTIP > /run/publicip;
 if [ "$CURRENTIP" != "$PUBLICIP" ];then
  echo Restarting lnd.service New external IP = $CURRENTIP
  sudo /bin/systemctl restart lnd.service
 fi
 sleep 600
done;

Busy Programmer Like these Guides? Donate some satoshis.
You can’t perform that action at this time.